PHP remote debug
Contents
I’ve seen quite a lot of PHP developers don’t have PHP debugger installed on development enviornment. Instead of debugging PHP code line by line, we’re fond of echo and print the results on the web page to find the errors.
It would be hard in the past because we don’t have good PHP IDE until we have PHPStorm. Unfortunately PHPStorm doesn’t have debugger installed in the environment and we have to install it by ourselves.
Download xdebug
1 | git clone git://github.com/xdebug/xdebug.git |
Install XDebug
1 | cd xdebug |
NOTE: After the installation, it will output the path of debug.so from the command line. Save it and paste into zend_extension to the configuration setting in next step.
Paste the following code to php.ini
1 | zend_extension=/usr/lib/php/20151012/xdebug.so |
Follow the this link to enable xdebug on phpstorm:
https://confluence.jetbrains.com/display/PhpStorm/Remote+debugging+in+PhpStorm+via+SSH+tunnel