2016-12-08 52 views
1

我有Xdebug作爲安裝在OSX上的PHP5.6的一部分與Homebrew一起運行。我可以運行PHP-FPM併爲我的網站提供服務,但是使用X-debug進行調試似乎不起作用。如何用Caddy和PHP-FPM配置Xdebug和PhpStorm

這裏是我的EXT-xdebug.ini

[xdebug] 
zend_extension="/usr/local/opt/php56-xdebug/xdebug.so" 
xdebug.remote_enable = On 
xdebug.remote_port="9000" 
xdebug.profiler_enable=1 
xdebug.profiler_output_dir="/tmp" 
xdebug.idekey=PHPSTORM 
+1

最低限度更改xdebug端口不是'9000',因爲php-fpm默認使用它。例如使用'9001'(需要在php.ini以及PhpStorm設置中更改):http://stackoverflow.com/a/33816324/783119; http://stackoverflow.com/a/38644688/783119 – LazyOne

回答

0

PHP-FPM通常在端口9000 運行這也是XDebug的默認端口。

調整在PHP-FPM你的XDebug設置爲使用端口9001 如果使用BREW安裝,他們在這裏找到:

/usr/local/etc/php/5.6/conf.d/ext-xdebug.ini 

以下內容添加到您的分機,xdebug.ini

[xdebug] 
zend_extension="/usr/local/opt/php56-xdebug/xdebug.so" 
xdebug.remote_enable=On 
xdebug.remote_connect_back=On 
xdebug.remote_port=9001 

Docs for those xdebug settings.

調整phpStorm使用端口9001進行調試。 它在首選項 - >語言&框架 - > php調試中找到。

只是爲了完整性,這裏是我的Caddyfile

:80 
log ./caddy.log 

root ./html 

fastcgi/127.0.0.1:9000 php { 
env WHEREAMI dev 
} 

rewrite { 
    if {path} not_match ^\/wp-admin 
    to {path} {path}/ /index.php?_url={uri} 
} 

重啓球童,PHP-FPM和phpstorm和你應該是好乾什麼去了。