Thursday, January 29, 2026

XAMP: Show Actual PHP Error Instead of HTTP 500 Error

I'm running an XAMPP Server on a VirtualBox Linux Mint machine to test web code.  I was getting HTTP 500 errors when I had simple PHP syntax errors.  I wanted to see the PHP error instead of the generic HTTP 500 Error.  To do this, you need to make a simple change to your php.ini file.  Here's how:

Open the file /opt/lampp/etc/php.ini with a text editor in sudo mode. In your text editor, search for and change the line display_errors = Off to display_errors = On

This makes PHP show the PHP Error instead of the HTTP 500 Error, making your code easier to debug.

Once you've saved your changes, open a Terminal Windows and run:

  sudo /opt/lampp/lampp restart

This will restart your XAMPP services making the changes take effect.

In your PHP code you might want to add this to the start of your PHP pages while testing:

<?php
error_reporting(E_ALL);
ini_set('display_erros', 1);
?>


BONUS TIP FOR WINDOWS USERS

For Windows XAMPP setups, open the file C:\xampp\php\php.ini with a text editor. In your text editor search for and change the line display_errors = Off to display_errors = On

Once you've saved your changed php.ini file, use the XAMPP application to stop and restart you XAMPP server.
sudo /opt/lampp/lampp restart
sudo /opt/lampp/lampp restart

sudo /opt/lampp/lampp restart
sudo /opt/lampp/lampp restart