Running a PHP script gives 500 internal server error

mikeg1971

Registered
Aug 5, 2011
2
0
51
Hi all,

I'm new here. Recently installed CPanel on a testing server/trial license before I purchase a license and put it on a production server. My PHP files are returning a 500 Internal Server error. HTML files work fine however.

This is on a fresh, clean install on CentOS 5.

I would be grateful if someone could shed some light on the subject. Apologies if this topic has already been covered.

Thank you to all in advance.
 
Last edited:

ChrisRHS

Well-Known Member
Jul 12, 2006
292
5
168
Hello there,

Please check your PHP handler through WHM (Main >> Service Configuration >> Configure PHP and SuExec), and see if it is set to SuPHP. If so, you need to check the ownership and writes of the files you are trying to load. The ownership should reflect the owner of the account, and the files should not have more that 644 for permissions.

If this is not the case, I would suggest you check your Apache error log for the reason it is flagging 500 errors.

Chris
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
The Apache error log is at /usr/local/apache/logs/error_log location. To check it when loading a site in a browser, you can do:

Code:
tail -fn0 /usr/local/apache/logs/error_log
 

mikeg1971

Registered
Aug 5, 2011
2
0
51
Hi again,

Thanks for your replies. I've turned SUExec off, now the 500 error has gone, but PHP files tries to download when I load them, seems like PHP isn't setup right somehow...

By the way plain html files work fine.

Regards,

Mike
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
Hello Mike,

Did you tail the Apache error log when suExec was turned on to see the return upon browsing the page that isn't working?

Thanks!