Loading...
 
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

Previous...

Slim Web Project - Initial Set Up

References

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
xdebug.remote_enable=1
xdebug.remote_connect_back=1
xdebug.remote_port=9000
xdebug.remote_host=192.168.33.10
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:

info.php
<?php

echo phpinfo();


Open your favourite browser to http://192.168.33.10/info.php, 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: http://192.168.33.10/
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

Next...

Slim Web Project - PHPUnit

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

Books

Linux Command Line and Shell Scripting Bible Linux Command Line and Shell Scripting Bible - Linux Command Line and Shell Scripting Bible is your essential Linux guide. With detailed instruction and abundant examples, this book teaches you how to bypass the graphical interface and communicate directly with your computer, saving time and expanding capability.


Linux Bible Linux Bible - Linux continues to be an excellent, low-cost alternative to expensive operating systems. Whether you're new to Linux or need a reliable update and reference, this is an excellent resource. Veteran bestselling author Christopher Negus provides a complete tutorial packed with major updates, revisions, and hands-on exercises so that you can confidently start using Linux today.


Learning Python Learning Python - Portable, powerful, and a breeze to use, Python is the popular open source object-oriented programming language used for both standalone programs and scripting applications.


Modern PHP: New Features and Good Practices Modern PHP: New Features and Good Practices - PHP is experiencing a renaissance, though it may be difficult to tell with all of the outdated PHP tutorials online. With this practical guide, you'll learn how PHP has become a full-featured, mature language with object-orientation, namespaces, and a growing collection of reusable component libraries.