简体   繁体   中英

PHP cli remote debugger issue

I have this problem: I'm trying to debug PHP scripts ran over CLI (I don't care about doing so over a web server) either remotely - preferably - or locally.

I'm on Linux both on the remote server and my development local machine using xdebug, and either netbeans/eclipse remotely or vdebug on vim locally.

So my issue is this: the remote machine runs PHP scripts in the background since we're using them for system tasks, resource monitoring, etc. So while I'm trying to debug script A (which I'm working on), the debugger ends up showing me the cron'ed scripts that are being ran at the same time, making it impossible to work on what I'm doing at the time.

Am I doing something wrong? I've tried a number of approaches but I keep running into this problem.

My current configuration is this, but I've tried a multitude of variations.

zend_extension = /usr/lib64/php/modules/xdebug.so
xdebug.remote_enable = on
xdebug.remote_handler = dbgp
xdebug.remote_host = 127.0.0.1
xdebug.remote_port = 9000
xdebug.remote_autostart = On

Thoughts?

As far as I understood the question your IDE is run on different machine than script runs. In this case the option

xdebug.remote_host = 127.0.0.1

should be the host where your IDE runs.

Make sure you configure idekey as well as Eclipse itself properly.

Also make sure that the config you have is in php.ini for CLI, not for Apache.

The problem was that I had xdebug.remote_autostart set. Every PHP script that started ended up being passed through the debugger whether it was the one I was working on or not.

The relevant part of xdebug's documentation is this: When running the script from the command line you need to set an environment variable, like: export XDEBUG_CONFIG="idekey=session_name" php myscript.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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