Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xdebug stopped working, where do I look for errors?

I installed Xdebug and all was fine, until suddenly it stopped working. phpinfo() gives a nice XDebug output with all variables.

php -m | grep deb 

also gives twice XDebug (for Zend and PHP), so again looks just fine. My php.ini has these lines:

zend_extension=/usr/lib/php5/20090626/xdebug.so ;extension=xdebug.so xdebug.remote_host=localhost xdebug.remote_enable=on xdebug.remote_port=9001 xdebug.remote_handler=dbgp xdebug.remote_connect_back=1 

And yet, when running this code with should check XDebug (from Netbeans docs) it's just stuck. So No IDE is working with XDebug.

<?php $address = '127.0.0.1'; $port = 9001; $sock = socket_create(AF_INET, SOCK_STREAM, 0); socket_bind($sock, $address, $port) or die('Unable to bind'); socket_listen($sock); $client = socket_accept($sock); echo "connection established: $client"; socket_close($client); socket_close($sock); 

Also, according to XDebug installation, I went twice throught the steps. What is wrong with my config? Thanks.

like image 940
valk Avatar asked Apr 01 '12 13:04

valk


People also ask

How do I debug Xdebug connection?

In the Settings/Preferences dialog ( Ctrl+Alt+S ), navigate to PHP | Debug and make sure PhpStorm and Xdebug / Zend Debugger are configured with the same port numbers. on the toolbar or selecting Run | Start Listening for PHP Debug Connections in the main menu.

Where can I find Xdebug ini?

To check that you are running the correct version of XDebug on your system, follow these instructions on the XDebug site. Find the section called "[Zend]" and comment out all of the lines by putting a semi-colon (";") at the start of each line. Find the line: zend_extension = "c:\xampp\php\ext\php_xdebug.


2 Answers

At the end, left with only two solutions - to reinstall the Ubuntu OS or to install a new VM especially for xdebug, I'm going for the second one. Funny thing is, everything was working according to the "RTM" (f=freaking). One thing that I couldn't figure out is how to read the logs for XDebug in order to understand where the real problem is.

UPDATE

After some struggling, I deleted every single line related to xdebug from every php.ini that I had. And moved these lines to /etc/php5/conf.d/xdebug.ini. Restarted Apache, and then PHPStorm, and it works. P.S. in the middle, I tried to install xdebug with pecl, from github, and the standard Ubuntu version. I think the one that I compiled is currently working. And.. the log gets updated as well.

;xdebug configuration zend_extension = /usr/lib/php5/20090626/xdebug.so xdebug.remote_host = 127.0.0.1 xdebug.remote_enable = 1 xdebug.remote_port = 9000 xdebug.remote_handler = dbgp xdebug.remote_mode = req xdebug.profiler_enable=0 xdebug.profiler_enable_trigger=1 xdebug.remote_autostart=1 xdebug.idekey=PHPSTORM xdebug.remote_log="/tmp/xdebug.log" 
like image 99
valk Avatar answered Sep 21 '22 06:09

valk


On your server, try this command:

$ netstat -anp | grep CLOSE_WAIT

Any :9000 entries will give you XDebug troubles; consider kill -9 <pid>.

like image 30
Derek Illchuk Avatar answered Sep 21 '22 06:09

Derek Illchuk