brew install php56 --with-imap --with-tidy --with-debug --with-mysql --with-fpm
do not use --with-debug
brew install php56 --with-imap --with-tidy --with-mysql --with-fpm
brew search php56-xdebug
https://xdebug.org/wizard.php
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff }
span.s1 { }
span.s2 { color: #5230e1 }
xingchongs-MacBook-Pro-3:~ xingchong$
xingchongs-MacBook-Pro-3:~ xingchong$
xingchongs-MacBook-Pro-3:~ xingchong$ brew search php56-xdebug
==> Searching local taps...
josegonzalez/php/php56-xdebug
==> Searching taps on GitHub...
homebrew/php/php56-xdebug
==> Searching blacklisted, migrated and deleted formulae...
xingchongs-MacBook-Pro-3:~ xingchong$ brew install josegonzalez/php/php56-xdebug
Updating Homebrew...
==> Installing php56-xdebug from josegonzalez/php
==> Downloading https://homebrew.bintray.com/bottles-php/php56-xdebug-2.5.5.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring php56-xdebug-2.5.5.sierra.bottle.tar.gz
==> Caveats
To finish installing xdebug for PHP 5.6:
* /usr/local/etc/php/5.6/conf.d/ext-xdebug.ini was created,
do not forget to remove it upon extension removal.
* Validate installation via one of the following methods:
*
* Using PHP from a webserver:
* - Restart your webserver.
* - Write a PHP page that calls "phpinfo();"
* - Load it in a browser and look for the info on the xdebug module.
* - If you see it, you have been successful!
*
* Using PHP from the command line:
* - Run `php -i "(command-line ‘phpinfo()‘)"`
* - Look for the info on the xdebug module.
* - If you see it, you have been successful!
==> Summary
?? /usr/local/Cellar/php56-xdebug/2.5.5: 4 files, 196KB
xingchongs-MacBook-Pro-3:~ xingchong$
xingchongs-MacBook-Pro-3:~ xingchong$
xingchongs-MacBook-Pro-3:~ xingchong$
先让php支持xdebug
方式一:
https://xdebug.org/download.php 下载相应的xdebug
可以到http://xdebug.org/wizard.php 把phpinfo的所有信息粘贴上去,会给出相应的版本
解压 tar -zxvf xdebug
cd xdebug目录下
执行 phpize(我的目录是/usr/local/bin/phpize,用sudo执行)
报错出现Cannot find autoconf. Please check your autoconf
查原因是需要装autoconf
Brew install autoconf
ok 后
./configure --enable-xdebug
make && make install
方式二:
用brew search php 找到xdebug扩展
brew install homebrew/php/xdebug-osx
安装完成,出现如下提示:
Installing shared extensions: /usr/local/Cellar/php56/5.6.32_8/lib/php/extensions/no-debug-non-zts-20131226/
+----------------------------------------------------------------------+
| |
| INSTALLATION INSTRUCTIONS |
| ========================= |
| |
| See http://xdebug.org/install.php#configure-php for instructions |
| on how to enable Xdebug for PHP. |
| |
| Documentation is available online as well: |
| - A list of all settings: http://xdebug.org/docs-settings.php |
| - A list of all functions: http://xdebug.org/docs-functions.php |
| - Profiling instructions: http://xdebug.org/docs-profiling2.php |
| - Remote debugging: http://xdebug.org/docs-debugger.php |
| |
| |
| NOTE: Please disregard the message |
| You should add "extension=xdebug.so" to php.ini |
| that is emitted by the PECL installer. This does not work for |
| Xdebug. |
| |
+----------------------------------------------------------------------+
配置php.ini,在phpinfo里看清楚自己的配置文件
[Xdebug]
;extension=php_xdebug.dll
zend_extension = "/usr/local/Cellar/php56/5.6.32_8/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so"
xdebug.auto_trace=1
xdebug.collect_params=1
xdebug.collect_return=1
xdebug.trace_output_dir="/usr/local/var/xdebug/trace"
xdebug.profiler_enable=1
xdebug.profiler_output_dir="/usr/local/var/xdebug/profiler"
xdebug.remote_autostart=1 #自动
xdebug.remote_enable=true
xdebug.remote_host=localhost
xdebug.remote_port=9050 #我用的php-fpm方式启动的PHP,9000端口被它占了,所以换端口
xdebug.remote_handler = “dbgp” #不写,默认也是dbgp
xdebug.idekey = PHPSTORM #可不写,默认会是环境变量
重启php
以上是配置php支持xdebug,用php -v 或者phpinfo 看到xdebug开了就行了。
----------------------------------------------
设置phpstorm监听xdebug 折腾了近2天,真是
起初应该是PHP和xdebug不匹配,直接下了个2.5.5的,检测过没注意到说要2.5.4,然后入坑里出不来,以上的配置主要是extension的路径要写对,autostart 配置为1,
以上这些配置在xdebug官网里都有说明,不过关键的xdebug的原理看https://xdebug.org/docs/remote
dbgp的说明:https://xdebug.org/docs-dbgp.php#standard-dbgp-port
------
说phpstorm里的配置,在
dbgp的默认端口应该都是80吧,ide key 写配置里的值就好,端口应该都是80,开始时默认是9001没改
-----------------------------
另外补充,点虫子边上的edit config里的几个配置介绍
phpstorm的官网里https://confluence.jetbrains.com/display/PhpStorm/Debugging+PHP+Web+Applications+with+Run+Debug+Configurations对
都有说明
原文地址:https://www.cnblogs.com/xingchong/p/8444905.html