XDEBUG session timeout with “Service Unavailable” message

Some Background

My application runs on a CentOS machine with Apache 2.4 and PHP 5.6 (from Remi’s repo), and I’m using PHP-FPM (via Apache proxy option) to handle the php files (not the Apache module). And I was trying to debug a remote PHP application (using xdebug) running on a VM.

I setup my IDE for remote debugging, and start setting some break points and going though the code, and right after 60 seconds (while I’m still running though the code and stepping over some lines) the browser will stop and  display the message “Service Unavailable”.

I started with this xdebug setup,

[xdebug]
xdebug.idekey=XDEBUG
xdebug.remote_connect_back=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
;xdebug.remote_host=192.168.160.1
xdebug.remote_mode=req
xdebug.remote_port=9000
xdebug.remote_cookie_expire_time = 3600

I’m basically will start the xdebug service on my machine on port 9000, and I’m telling xdebug on the remote machine to connect back to the address the initiate the debug session (in this case the remote_host option will be ignored).

At first I though it was php/xdebug miss behaving, to I tried to play with the cookie_expire_time but the didn’t solved my problem, so I moved to look if it was PHP or the connection between Apache and the PHP layer, and this is what solved my problem.

TL;DR

<Proxy "fcgi://127.0.0.1:9000">
    # Needed for XDEBUG, to allow long debug session.
   ProxySet timeout=900
</Proxy>

 

Resources

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *