简体   繁体   English

PHP调试环境无法正常工作

[英]PHP debug environment not working

I am at the end of my tail here and could really use some help! 我在这里的尽头,真的可以使用一些帮助!

Here's my setup - 这是我的设置-

  • NGINX, PHP-FPM on CentOS NGINX,CentOS上的PHP-FPM
  • Nginx conf file has the following: Nginx conf文件具有以下内容:

    location ~ .php$ { root /usr/share/nginx/html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }

  • PHP-FPM conf file at /etc/php-fpm.d/www.conf has the following listen=127.0.0.1:9000 /etc/php-fpm.d/www.conf上的PHP-FPM conf文件具有以下listen=127.0.0.1:9000

With the above configuration, NGINX can properly display PHP pages. 通过以上配置,NGINX可以正确显示PHP页面。

Now, I want to setup Xdebug. 现在,我要设置Xdebug。 So I added the following to the /etc/php.d/xdebug.ini file 所以我将以下内容添加到/etc/php.d/xdebug.ini文件中

<code>
zend_extension=/usr/lib64/php/modules/xdebug.so
xdebug.remote_enable=1
xdebug.remote_host=x.x.x.x
xdebug.remote_port=9009
xdebug.remote_autostart=1
</code>

Note remote port is set to 9009 to not conflict with the PHP-FPM port 9000. 注意,将远程端口设置为9009,以不与PHP-FPM端口9000冲突。

On the xxxx machine, I have XDebugClient running listening for incoming connections on port 9009. 在xxxx机器上,我正在运行XDebugClient侦听端口9009上的传入连接。

Next, I launch a browser from the host xxxx and request URL http://yyyy?XDEBUG_SESSION_START=1 (where yyyy) is the server with the NGINX, PHP-FPM and XDebug setup. 接下来,我从主机xxxx启动浏览器,并请求URL http:// yyyy?XDEBUG_SESSION_START = 1 (其中yyyy)是具有NGINX,PHP-FPM和XDebug设置的服务器。

The issue - nothing happens. 问题-没有任何反应。 XDebugClient never gets a connection! XDebugClient永远不会获得连接!

What am I missing? 我想念什么?

Things to check 检查事项

  • Pull up a phpinfo() page to make sure your php.ini file is configured correctly. 调出phpinfo()页面以确保正确配置了php.ini文件。 If you don't see a long xdebug section, then the problem is in your configuration. 如果没有看到较长的xdebug部分,则问题出在您的配置中。
  • Try running a trace or profile with xdebug. 尝试使用xdebug运行跟踪配置文件 If they work, then the xdebug module itself is okay. 如果它们有效,则xdebug模块本身还可以。
  • Try setting xdebug.remote_connect_back=1 in your php.ini file. 尝试在php.ini文件中设置xdebug.remote_connect_back = 1。 This will override the remote_host setting and can be helpful if the problem is related to network configuration. 这将覆盖remote_host设置,如果问题与网络配置有关,则可能会有所帮助。
  • Make sure your IDE is set to listen for the connection on port 9009. In PHPStorm, for example, you must configure the IDE to listen on the custom port, and then you have to push a button to activate the debugging tool before you load the page being debugged. 确保将您的IDE设置为侦听端口9009上的连接。例如,在PHPStorm中,必须将IDE配置为侦听自定义端口,然后在加载程序之前必须按下按钮以激活调试工具。页面正在调试。

Those are the basic steps I've had to go through quite a few times. 这些是我必须经过多次的基本步骤。 Hopefully one of them will help. 希望其中之一会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM