Jac*_*cob 13 php linux port xdebug phpstorm
我设置php.ini和Debug config在phpstorm.尝试在phpstorm事件日志中调试php脚本输出:
"Error running script.php: Port 9000 is busy"
Run Code Online (Sandbox Code Playgroud)
php.ini的结尾:
[XDebug]
zend_extension="/usr/lib/php5/20090626+lfs/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_port="9000" (the default port is 9000)
xdebug.profiler_enable=1
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_dir="/etc/php5/xdebug/profiler_output_dir"
Run Code Online (Sandbox Code Playgroud)
pStorm中的调试端口也设置在9000. netstat -na输出上:
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN
Run Code Online (Sandbox Code Playgroud)
如果我设置到其他端口怎么办?例如设置它10001似乎做的工作.或者只是如何让它正常工作.我不确定我是否理解它是如何xDebug工作的.它就像Debug("script.php")(Shift+F9)在phpstorm中运行并在文件中设置断点?
有人有想法吗?
编辑:
来自:http: //xdebug.org/docs/remote
xdebug.remote_port
Type: integer, Default value: 9000
The port to which Xdebug tries to connect on the remote host. Port 9000 is the default for both the client and the bundled debugclient. As many clients use this port number, it is best to leave this setting unchanged.
Run Code Online (Sandbox Code Playgroud)
如果我更改9000以外的端口怎么办?也许超过50k的东西.
Phi*_*ael 12
在端口9000上运行的进程可能是PhpStorm本身.
检查Jacob提到的当前使用的端口(在Windows cmd上:) netstat -a -b:

如果PhpStorm.exe列在:9000下,您只需将设置>构建,执行,部署> 调试器中的内置服务器端口更改为例如63342(这是我的队友PhpStorm安装的默认设置).
使用lsof和netstat无法识别在9000端口上运行的进程的pid 。暂时最简单的解决方法是更改端口,phpstorm并更改php.ini其他未实际使用的端口(例如10k)。
基本上一些其他进程正在使用9000并且不使用它,通常对我来说同时运行另一个IDE
Windows修复 - >
打开cmd.exe
netstat -o
C:\Users\AMC75>netstat -o
Active Connections
Proto Local Address Foreign Address State PID
TCP 10.6.176.132:27018 livlt0124661:55375 ESTABLISHED 11104
TCP 10.6.176.132:49271 chilynfe01:5061 ESTABLISHED 10120
TCP 10.6.176.132:49379 hhefs14:netbios-ssn ESTABLISHED 4
TCP 10.6.176.132:49383 chifs08:netbios-ssn ESTABLISHED 4
TCP 10.6.176.132:51034 157.55.56.143:40002 ESTABLISHED 11104
TCP 10.6.176.132:51038 db3msgr6011007:https ESTABLISHED 11104
TCP 10.6.176.132:51049 wb-in-f125:5222 ESTABLISHED 10860
TCP 10.6.176.132:51282 wpapp020:50124 ESTABLISHED 848
TCP 10.6.176.132:53014 ec2-107-23-104-135:https ESTABLISHED 10860
TCP 10.6.176.132:53015 ec2-107-23-104-135:https ESTABLISHED 10860
TCP 10.6.176.132:54774 157.56.116.205:12350 ESTABLISHED 11104
TCP 10.6.176.132:54822 a23-198-48-60:https CLOSE_WAIT 7500
TCP 10.6.176.132:55166 upmon070:3306 ESTABLISHED 2652
TCP 10.6.176.132:55261 lhr08s03-in-f9:http ESTABLISHED 10860
TCP 10.6.176.132:55570 upmon070:3306 ESTABLISHED 10980
..... BLAH BLAH BLAH
Run Code Online (Sandbox Code Playgroud)
taskkill/PID XXXX
GNU / Linux解决方案(因为Windows之外还有生命):
遵循@aqm的解决方案
首先使用端口9000查找进程。
netstat -tulpn | grep :9000
Run Code Online (Sandbox Code Playgroud)
您将获得如下输出:
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 3993/programname
Run Code Online (Sandbox Code Playgroud)
您需要使用以下命令通过PID终止进程:
kill -9 3993
Run Code Online (Sandbox Code Playgroud)
注意:也许您的进程未显示其PID,可能是您正在运行使用PHP-FPM作为默认端口9000的情况,在这种情况下,您可以更改PHP-FPM端口或PHP Xdebug端口。
解决方案1-更改Xdebug配置:
编辑 /etc/php/php.ini
搜索xdebug.remote_port=9000并替换为您的新端口
解决方案2-更改PHP-FPM端口:
编辑 /etc/php/php-fpm.conf
搜索listen = 127.0.0.1:9000并用新端口替换9000
然后重新加载服务:
systemctl reload php-fpm
Run Code Online (Sandbox Code Playgroud)
然后,编辑您的nginx或Apache的配置来讲述这个新的端口,搜索127.0.0.1:9000的/etc/httpd/httpd.conf或/etc/nginx/nginx.conf与您的新端口替换
重新加载服务器:
systemctl reload nginx
Run Code Online (Sandbox Code Playgroud)
要么
systemctl reload httpd
Run Code Online (Sandbox Code Playgroud)
希望对您有所帮助:),
合十。
写给未来的自己:
就我而言,这是由于使用虚拟机端口转发(Virtual Box 上的 vagrant)引起的。我认为转发9000是个好主意。
解决方案:连接到10.166.53.1标准 Virtual Box 的
VM IP
我的内容/etc/php5/cgi/conf.d/xdebug.ini
; xdebug configuration
; xdebug.remote_host = localhost
zend_extension = /usr/lib/php5/20121212/xdebug.so
xdebug.remote_connect_back = 1
xdebug.remote_enable = 1
xdebug.remote_port = 9000
xdebug.remote_handler = dbgp
xdebug.remote_mode = req
xdebug.idekey = "PHPSTORM"
xdebug.remote_log = /var/log/xdebug.log
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
27776 次 |
| 最近记录: |