Xdebug is a powerfull tool for debugging PHP. It can display formated errors and embed the usefull var_dump
function.
This page explains how to install and configure Xdebug.
The following has been tested on a Cloud9 server with the following versions:
Sometime, Xdebug is not configure, and the var_dump
function is not displayed properly.
Create a PHP file on your server with the following content:
<?php var_dump( array('CodeIgniter', 'php', 'phpMyAdmin', 'lucidar.me') ); ?>
Check if the display is formated. On the following illustration, var_dump
is not displayed properly:
Check if the Xdebug module is installed. The following command displays the list of PHP modules instaled:
php -m
If Xdebug is already installed (Xdebug is in the list of instaled module), skip the next step.
Install the following package:
sudo apt-get install php-xdebug
If you need to install xdebug for a given version, use :
sudo apt-get install php7.3-xdebug
Restart Apache2 manualy or with the following command:
sudo service apache2 restart
Check if var_dump
is now formated properly. If not, add or update the html_errors
parameter in your php.ini file:
html_errors = On
Display should now be formated:
I also strongly recommand to set the following parameters only on your local environment in your php.ini. This will display PHP errors and warning in the page:
display_errors = On
display_startup_errors = On
error_reporting = E_ALL