I am trying to find a way to debug PHP other than var_dump()
and I noticed Xdebug. I cannot find on the internet if Xdebug has a command-line version (I dont want to use a GUI version, bear with me(sshing another linux system)). If there is, how can I use it? If no, is there any other PHP debugging tools that can be run as command-line?
Asked
Active
Viewed 4,642 times
3

zkytony
- 1,242
- 2
- 18
- 35
1 Answers
1
xdebug
- Profiler:
With xdebug, you might run the profiler from CLI with this command:
php -d xdebug.profiler_enable=1 script.php
In order, to run this on the console, the box you are ssh'ing into must have PHP and Xdebug installed and configured.
- Remote Xdebug:
Another option would be to use xdebug.remote_host
with SSH tunneling/forwarding.
- Forwarding is described here: http://derickrethans.nl/debugging-with-xdebug-and-firewalls.html
- Remote Xdebugging here: http://xdebug.org/docs/remote
This allows to work with Netbeans or PHPStorm on the remote machine.
- Xdebug's DebugClient
You might also use the simple DebugClient xdebug ships for CLI usage. Every other debugging client, which supports the dbg-protocol, should work, too. http://xdebug.org/docs/install#debugclient
phpdbg
If you run PHP 5.6, then you might use phpdbg, which is the integrated debugger and perfect for CLI usage.

benbotto
- 2,291
- 1
- 20
- 32

Jens A. Koch
- 39,862
- 13
- 113
- 141