500 Internal server error with no logs...

php system apache htaccess
Reading time: 1 minute, 0 seconds

Sometimes, you can have an internal server error (500) but you don't have any information in logs on it.

To determine and resolve this type of problem, the simplier way is to display directly the error on screen.

Be careful, this solution is not secured ! It can be used only for debuging.

Apache2 with PHP module

you can create / update an .htaccess file with following code :

php_flag  display_errors                  on
php_flag  display_startup_errors          on

if the following error occurs :

Invalid command 'php_flag', perhaps misspelled or defined by a module not included in the server configuration

Install the package libapache2-mod-php5

$ sudo apt-get install libapache2-mod-php5
$ sudo service apache2 start

Apache 2 with PHP FPM

you can create / update an .htaccess file with following code

SetEnv PHP_VALUE "display_errors = on"
SetEnv PHP_VALUE "display_startup_errors = on"

Next Post Previous Post