#在mac上用phpstorm里debug调试php
# # Background
Recently in order to complete a demand, looking at the ' smarty ' source code, when I try to see directly, the pain of vomiting blood, 工欲善其事 must first sharp weapon, although has been used Phpstorm debugging Nodejs, but has not used phpstorm to debug PHP.
# # Suggestions
First look at this: Phpstorm 8.0.2 help:: Configuring Xdebug
# # Installation Xdebug
1. Open: xdebug:downloads Click Source to download the source package
2. Then install
"' Bash
#解压tar包
Tar-xzf xdebug-2.2.5.tgz
#进入根目录
CD xdebug-2.2.5
#执行phpize
Phpize
#编译安装xdebug
./configure--enable-xdebug
Make
Make install
```
# # config to PHP
1. Open php.ini File
"' Bash
cd/private/etc/
#默认没有php. ini, you need to copy
sudo cp php.ini.default php.ini
sudo vi php.ini
```
2. Add the following
"' Bash
[Xdebug]
zend_extension= "/usr/local/php_user/xdebug.so"
Xdebug.remote_enable = On
; XDEBUG.REMOTE_HANDLER=DBGP
Xdebug.remote_host= "127.0.0.1"
xdebug.remote_port=9000
xdebug.profiler_enable = 1
Xdebug.profiler_enable_trigger = Off
Xdebug.profiler_output_name = cachegrind.out.%t.%p
Xdebug.remote_autostart = On
```
3. Restart ' Apache '
"' Bash
sudo apachectl restart
```
4. Check the phpinfo () information inside to search for ' debug ' if there is, you have succeeded.
# # config Phpstorm
1. Open the Phpstorm and go to the top navigation ' phpstrom->perferences. `
2. Click on ' php ' and click ' ... ' button after ' interpreter '
3. Click the Refresh (' ... ') button after ' PHP home '
4. At this time you will see ' Debugger:not installed ' become ' Xdebug 2.3.2 ' (the version number may be different)
6. Enter the ' php ' section of ' Server ', click ' + ' to create a new server:host fill your local host (such as 127.0.0.1), click ' Apply ' to save, and exit the ' perferences ' dialog box.
7. Click on the top navigation ' run ', click ' + ', select ' php Web application ', select the new ' server ' in the previous step, ' Start URL ' to fill in, you want to debug the PHP file address, the following will generate an address, This address should be able to browse the test normally in the browser, and click ' Apply ' to save it.
# # Start Happy to use
1. In the column to the right of the file line you want to debug, click on it to have a breakpoint.
2. Click on the top navigation ' run '->debug, select your newly created ' debug ' name, this time will pop up the browser to load this PHP file. Reference website: 1190000005878593http://blog.csdn.net/zhyh1986/article/details/45172685
Phpstorm mac Xdebug Configuration