Slim Web Project - XDebug Set Up

Slim Web Project - XDebug Set Up

Xdebug is an extension for PHP to assist with debugging and development. It contains a single step debugger to use with IDEs; it upgrades PHP's var_dump() function; it adds stack traces for Notices, Warnings, Errors and Exceptions; it features functionality for recording every function call and variable assignment to disk; it contains a profiler; and it provides code coverage functionality for use with PHPUnit.1


Slim Web Project - Initial Set Up


Launch Vagrant VM

To launch the VM use Vagrant command vagrant up - This command creates and configures guest machines according to your Vagrantfile.

PHPStorm Vagrant Up

Access the Vagrant VM

Use PHPStorm's embedded Terminal to vagrant ssh - this will SSH into a running Vagrant machine and give you access to a shell.

$ vagrant ssh
PHPStorm Vagrant SSH

Install XDebug

$ sudo -s
$ pecl channel-update pecl.php.net
$ pecl install xdebug
$ echo "zend_extension=xdebug.so" > /etc/php/7.2/mods-available/xdebug.ini
$ ln -sf /etc/php/7.2/mods-available/xdebug.ini /etc/php/7.2/fpm/conf.d/05-xdebug.ini
$ ln -sf /etc/php/7.2/mods-available/xdebug.ini /etc/php/7.2/cli/conf.d/05-xdebug.ini

Configure XDebug

Edit xdebug.ini

vi /etc/php/7.2/mods-available/xdebug.ini
Add the following to xdebug.ini
Restart PHP and Check XDebug
$ systemctl restart php7.2-fpm
$ php --version
PHPStorm XDegug Install

Quick PHP / XDebug Test

Create a info.php file in the mySlimApp/htdocs/public directory, with the following:


echo phpinfo();

Open your favourite browser to, search for XDebug, and you should see:

PHPStorm XDegug PHPInfo

Web Server Debug and Validation

  • From the main menu, choose Run | Web Server Debug and Validation
Path to create validation script: (Path to the public folder of scotch box on your machine. For example: /home/malber/AppDev/localdev/mySlimApp/htdocs/public\)
Url to validation script:
PHPStorm XDegug Validation
  • Validate and check if it returns blue icons for all testing steps

Languages & Frameworks XDebug Settings

  • From the main menu, choose File | Settings and navigate to Languages & Frameworks | PHP | Debug
make sure the Xdebug port is set to “9000” and all boxes are checked
PHPStorm XDegug Integration

Set Up HTTP Server

  • From the main menu, choose File | Settings and navigate to Languages & Frameworks | PHP | Servers
click the “+” icon and set up the “Soctch Box” server
PHPStorm Scotch Box Server

Run Configuration

  • From the main menu, choose Run | Edit Configurations
Click the “+” button to add a “PHP Web Page”. Give a name to it, select “Scotch Box” in the server list, set the Home URL and set the browser to be used for debugging the project
PHPStorm Run Configuration

Run XDebug

  • From the main menu, choose Run | Debug


Slim Web Project - PHPUnit

Last edited by MichaelAlber .
Page last modified on Friday January 11, 2019 02:43:57 UTC.