Can't troubleshoot error 500

anay

Verified User
Joined
Dec 7, 2005
Messages
119
Hi,

I have a php app which works fine (php 5.6) however, when I access its admin area say domain.com/admin , there is blank page after providing login credential. Immediately I checked error logs in admin panel but no error was logged. I then checked access.log where it shows that visiting "domain.com/admin" is throwing "error 500" on request.

So, there is error 500 but there is nothing in error logs. I then checked error log directly ie. from ssh :
Code:
/var/log/httpd/domains/domain.com.error.log
Nothing there, however, if I add some intentional changes to that script, then it is being logged .

In short, access logs for the domain is showing that page has "Error 500" but error log for the domain is logging nothing related to it however, its login other php error.

Please advice.
 
Also look at /var/log/httpd/domains/domain.com.log to see if you find something there.

It can be some php error which is not logged, if you run apache, you could temporarily enable logs in your .htaccess file like this:
Code:
php_flag display_startup_errors on
php_flag display_errors on
php_flag html_errors on
php_flag log_errors on
php_value error_log /home/user/domains/domain.com/public_html/PHPERROR.log

This would create probably php error output and/or a PHPERROR.log file in your public_html.

If you are on php-fpm this won't work by default, you can install htscanner for example.
 
Since its OpenLiteSpeed server, I think it uses lsphp for php mode.
Apparently the above .htaccess code part is not working as I do not see any PHPERROR.log file if a deliberately add some error to php script, although those are being logged to default error log file ie. /var/log/httpd/domains/domain.com.error.log

Further, as I already mentioned, there that from access logs ie. /var/log/httpd/domains/domain.com.log , I can see that page is giving error 500, now I need more details about it so that can troubleshoot it. Generally we get that from error logs but there is nothing related to that in it.
 
I don't use OLS and don't know how it works there, maybe with a user php.ini file or you might temporarily change the error reporting setting in the main php.ini file.

You said the php script is working with php 5.6, but what do you use now? Is it php 7.x or something?
You might check the connection to the database if any. I remember after our upgrade from php 5.6 to 7.2 that some scripts got a blank page without errors. Seemed they still used this connection options:
Code:
mysql_connect("localhost"
etc. which should now be
Code:
mysqli_connect("localhost"
etc.
Same for mysql_select_db which should be changed to mysqli_select_db.

If that is not the case, then I hope somebody else can help you who is more familiar with OLS.
 
Back
Top