Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging in HHVM?

When running my PHP scripts in HHVM I see that I can pass a debug-host and debug-port arguments, but I can't seem to work out exactly what it does and how to use it.

Are those arguments for debugging HHVM itself (or maybe the compiled PHP itself) or is it for debugging the PHP script? That is to say, is it for debugging the way that HHVM works, or is it for debugging as I would normally do with XDebug, say?

At first I tried to connect it to my IDE that is set up for XDebug, but that doesn't seem to do anything so without going on a wild goose chase I thought I would ask here.

What are the debug arguments for HHVM for, exactly, and how can I use them to debug my PHP scripts in HHVM please?

like image 601
Narcissus Avatar asked Oct 18 '13 16:10

Narcissus


3 Answers

Getting remote debugging working was fairly tricky and involved some gotchas and misunderstandings of the documentation.

You have to configure what they call as "sandbox" on the server side.

Then you have to use another instance of hhvm invoked with -m debug -h to attach the debugger to the running server. From there you can then use the full features of the debugger.

I wrote an article describing the process.

like image 100
Yermo Lamers Avatar answered Oct 24 '22 22:10

Yermo Lamers


It seems that HHVM is adding XDebug in version 3.3.0 LTS. Clearly it's not production ready yet. You can enable it by adding xdebug options listed below to your server.ini file. It connects, but usually ends up crashing HHVM for me.

hhvm.xdebug-not-done.enable=1
hhvm.xdebug-not-done.remote_enable=1
hhvm.xdebug-not-done.idekey="PHPSTORM"
hhvm.xdebug-not-done.remote_host="localhost"
hhvm.xdebug-not-done.remote_port=9089
like image 27
Lance Badger Avatar answered Oct 25 '22 00:10

Lance Badger


In Response to Lance Badger :

3.4.0 renamed xdebug-not-done to xdebug. The xdebug section of your php.ini should therefore look like this:

xdebug.enable=1
xdebug.remote_enable=1
xdebug.idekey="PHPSTORM"
xdebug.remote_host="localhost"
xdebug.remote_port=9089

Sources: Issue 4348, Pull Request 3779

like image 45
tback Avatar answered Oct 25 '22 00:10

tback