Remote debug in phpstorm with xdebug
I try remote debug php application with phpstorm. I use centos 6.4, php5.3 and apache 2.2 on vmware virtual machine, and phpstorm with firefox on real ubuntu. xdebug is really installed:
Installed Packages
Name : php-pecl-xdebug
Arch : i686
Version : 2.1.4
Release : 1.el6
Size : 580 k
Repo : installed
From repo : epel
Summary : PECL package for debugging PHP scripts
URL : http://pecl.php.net/package/xdebug
License : PHP
And phpinfo confirm this too:
This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with Xdebug v2.1.4, Copyright (c) 2002-2012, by Derick Rethans
When i run script (simple hello world) from console via ssh my script is stopped, i get connection to phpstorm from xdebug and xdebug write info in own log. But when i run script from browsen - is has no effect, even in xdebug log. I try use firefox extension to start debug session, i try use xdebug.remote_autostart=1 option, try turn off iptables in centos, but no effect too. What i do wrong? xdebug config:
; Enable xdebug extension module
zend_extension=/usr/lib/php/modules/xdebug.so
xdebug.remote_enable=1
;xdebug.remote_connect_back=1
xdebug.remote_port=9001
xdebug.remote_host=10.0.0.1
xdebug.remote_handler=dbgp
xdebug.remote_autostart=1
xdebug.remote_log="/tmp/xdebug.log"
;xdebug.remote_mode=req
;xdebug.profiler_enable=1
;xdebug.profiler_enable_trigger=1
;xdebug.idekey=PHPSTORM
Please sign in to leave a comment.
Hi there,
What php.ini are you editing exactly?
On Linux, it's rather normal to see separate php.ini for CLI and web.
So ..
Thanks for reply.
phpinfo says:
And i edit xdebug.ini in /etc/php.d
Is xdebug definitely loaded when page is requested via web?
In xdebug section of the phpinfo() output -- do you see the same settings/values as you have them set up .. or they somehow different?
Will adding xdebug_break(); (force breakpoint) into your code produce any different behavior ?
If everything as it should .. but it still produces nothing in xdebug log -- then please check that user (which is used by apache/php) has enough access rights to that log location. You should have something in xdebug log as long as xdebug tries to connect.
No other ideas unfortunately (except magical "Windows" hint: if something does not work try restarting computer)
Sad, but yes, the same variables.
I check it now. I create php-script writing in a file and it work fine. But result is same. When i run script from command-line as - xdebug write data in log. I even change log's owner to apache's user, but when i run script from browser - log is empty. :( I even make chmod 777 on log file.
I even try restart VM. :)
And xdebug_break(); not work. Script just print output in browser, without any write in log file. :( I try google it now.
Anyway, thanks for the help.
Oh my god, problem solved. It's all selinux.
setsebool httpd_can_network_connect=1, nttpd restart - and phpstorm get connection from xdebug.