Avatar photoTelium Support Group
Participant
Post count: 262

There are many causes for a 500 (internal serve) error.  The cause will likely not show up in your apache logs because of how PHP is setup.  The default PHP configuration is designed to maximize speed (and therefor less logging).  If you change your PHP configuration slightly the root cause will show in the apache error log.  Please follow these steps:

Locate your php.ini file:

el@apollo:~$ locate php.ini
/etc/php5/apache2/php.ini

Edit that file as root:

sudo vi /etc/php5/apache2/php.ini

Find this line in php.ini:

display_errors = Off

Change the above line to this:

display_errors = On

Lower down in the file you’ll see this:

; display_startup_errors
; Default Value: Off
; Development Value: On
; Production Value: Off

;error_reporting
; Default Value: E_ALL & ~E_NOTICE
; Development Value: E_ALL | E_STRICT
; Production Value: E_ALL & ~E_DEPRECATED

The semicolons are comments, that means the lines don’t take effect. Change those lines so they look like this:

display_startup_errors = On
; Default Value: Off
; Development Value: On
; Production Value: Off

error_reporting = E_ALL
; Default Value: E_ALL & ~E_NOTICE
; Development Value: E_ALL | E_STRICT
; Production Value: E_ALL & ~E_DEPRECATED

What this communicates to PHP is that we want to log all these errors. Warning, there will be a large performance hit, so you don’t want this enabled on production because logging takes work and work takes time, time costs money.
Restarting PHP and Apache should apply the change.

Next, do what you did to cause the 500 Internal Server error again, and check the log:

tail -f /var/log/apache2/error.log

You should see the 500 error at the end, something like this:

[Wed Dec 11 01:00:40 2024] [error] [client 192.168.11.11] PHP Fatal error:
Call to undefined function Foobar\\byob\\penguin\\alert() in /yourproject/
your_src/symfony/Controller/MessedUpController.php on line 249

The cause should then be obvious – or email us the relevant log excerpts and we’ll help you figure it out.  If you run a different Linux OS or different version, then the settings may differ slightly but the same basic instructions apply.