PHP-CLI script debugging with dbg-cli |
|
Hi All,
First I want to say thanks for such a wonderful tool. I have been using dbg to debug apache based php and it works great! I am working on a purely php-cli based project and would like to use dbg-cli to debug it. Reading through the postings here, there have been others struggling to get dbg-cli to connect. I have tried all the suggestions and have not been able to get this thing to connect. So here is my setup: php version 4.4.0 (cli) dbg version 2.11.32 dbg-cli version 2.11.32 php.ini contains:
php -i includes the following section:
Running dbg-cli I get:
The dbgbase.log file seems to be included in the session output so I won't include that. I have tried telneting in to the port and find nothing listening. A "tcpdump host localhost" doesn't return anything. I had debugger.JIT_host = clienthost but that made no difference. It is strange because I have been using the mod_php version with apache with no problems. Any help would be very much appreciated! I am happy to dig into the code if need be. I need this thing to work Cheers, James Pellow |
||||||||||||||||||
|
|
Thanks for your reply. Here are the results of that test. First the php script I ran with the debugger:
and the contents of output.txt if I run it from the command line:
Here is my debugging session:
As you can see, it is still failing. The output.txt file does not show up after the debugging session, so I know even though php was forked and started, it never executed my test script. Thanks for the good feedback. Let me know if there is more I can provide to help resolve this. Cheers, James |
||||||||||||||||||
|
Site Admin
|
If you run Linux/x86, you may want to try dbg-cli binaries available on https://sourceforge.net/projects/dbg2 (see dbg-cli-2.11.32-glibc-2.2.tar.gz).
To investigate the problem with dbg-cli compiled by yourself, please try to fork a shell script which would dump content of environment variables and working directory into a file, for example: file p.sh: #!/bin/sh set >./env.txt pwd >>./env.txt (don't forget to set exec permissions) then run dbg-cli and set cgiexec /path/to/p.sh then file something.php then run then quit. Dumped env.txt would contain the following variables: REDIRECT_STATUS REDIRECT_URL SCRIPT_FILENAME PATH_TRANSLATED PATH_INFO REQUEST_URI REMOTE_ADDR GATEWAY_INTERFACE SERVER_PROTOCOL REQUEST_METHOD with correct values. |
||||||||||||
|
|
Thanks again for your help. I am a gentoo user and have built both with the source code, and with the gentoo ebuild. Both behave exactly the same on my system. I would love to be able to continue using the ebuild as it makes upgrades automatic and easy. So, I would love to continue debugging. Here are the results from the test you suggested:
For completeness I included the entire environment. It was created as you suggested, by forking off a new process through dbg-cli. I hope that gives you some more clues. It all looked reasonable to me. The debug info from dbg-cli all looked the same as before. Thanks again for your help. |
||||||||||||||
|
|
Just a bit more info... I compiled the binary I used above directly from the source tarball I got off of sourceforge. You recommended I try the binary from sourceforge as well... I have tried a session with that binary and get the same results. Still times out connecting to the forked php process.
Thanks for your help. Cheers, James |
||||||||||||
|
Site Admin
|
WHERE DID THIS ENV variable come from? From your previous post >dbh_create_listen_socket(, 7870) it should contain port 7870, not 10001. I see no reason why would PATH_INFO, REQUEST_URI and PATH_TRANSLATED refer to test.php while SCRIPT_FILENAME refers to p.sh. there must be something wrong with your environment. |
||||||||||||||
|
|
I noticed the SCRIPT_FILENAME issue and assumed it must be referring to cgiexec. Evidently that is not the case. The port mismatch is probably because I have 7870 in the config file, and I didn't specify a port for this test since p.sh wasn't going to connect back on it anyway... (Maybe I missunderstand something here...) Since dbg-cli didn't find anything on the default 7869, would it have tried 10001 automatically?
Anyway, it seems like PATH_INFO, REQUEST_URI, PATH_TRANSLATED, SCRIPT_FILENAME would all be set in dbg-cli and not be part of my default environment, so if they are wrong wouldn't it be a problem in dbg-cli? Any ideas on how I could correct the issues? I haven't had time yet, but I plan to dig into the code and see if something pops out at me there. Any ideas would be appreciated! Thanks for sticking with me on this. |
||||||||||||
|
|
I have this same problem. Has a solution been found yet? Thanks.
|
||||||||||||
|
|
Same here with 2.15.1 from source.
|
||||||||||||
|
PHP-CLI script debugging with dbg-cli |
|
||
Content © NuSphere Corp., PHP IDE team
Powered by phpBB © phpBB Group, Design by phpBBStyles.com | Styles Database.
Powered by
Powered by phpBB © phpBB Group, Design by phpBBStyles.com | Styles Database.
Powered by