1. Introduction
There was no good tutorial for debugging php, when it was 2017/3/31. So I kept my experience as a note.
2. Environment
mac os10.12, php5.6 (php -v)
3. Install Xampp (Xampp7.1, Xdebug2.5.1)
Install php7.1 with xampp. If you installed older ones, please delete it.
The version of Xdebug shall correspond to php, so php5.6 is not working under Xdebug.
To upgrade Xdebug: http://www.jianshu.com/p/be74c4707b58, with1
brew install homebrew/php/php71-xdebug
after installation, under /usr/local/Cellar/,there shall be1
/usr/local/Cellar/php71-xdebug/2.5.1/xdebug.so
add the following into php.ini(be careful of the path of zend_extention)1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17extention = xdebug.so
[xdebug]
zend_extension = /usr/local/Cellar/php71-xdebug/2.5.1/xdebug.so
xdebug.profiler_append = 0
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "/tmp"
xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.remote_autostart=on
xdebug.remote_enable=on
xdebug.remote_enable=1
xdebug.remote_mode="req"
xdebug.remote_log="/var/log/xdebug.log"
xdebug.remote_host=localhost/127.0.0.1
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
xdebug.idekey="PhpStorm"
For more configurations:
http://muscliy.github.io/2016/04/19/mac%E4%B8%8B%E6%90%AD%E5%BB%BAphp%E6%9C%8D%E5%8A%A1%E5%99%A8xampp-phpstorm-xdebug/
http://laichuanfeng.com/work/configuring-xdebug-with-phpstrom/
Check if you can find Xdebug under1
http://localhost/xampp/phpinfo.php
4. Debug with PhpStorm
If you did not config debug server, the it will go to explorer and askes you to install plug-in.
If you want debug locally, check:
https://www.youtube.com/watch?v=mEJ21RB0F14
http://blog.163.com/xinchuangyi123@yeah/blog/static/1208767522013360303645
be careful about the settings of server, such as port shall correspond to Xdebug.
5. Conclusion
Without doubt, PHP is the best language in the world, but Debugging helper you make it faster even than Hongkong journalist.