14

For a while, I was using Phpstorm EAP, and had xdebug running perfectly. I recently purchased a personal license and imported all my settings from the EAP into 7.1.3. Now xdebug does not work.

Here's xdebug.ini

zend_extension=xdebug.so

xdebug.remote_host = 192.168.56.1
xdebug.remote_cookie_expire_time = 36000
xdebug.remote_log = /tmp/xdebug.log
xdebug.remote_port = 9000
xdebug.remote_handler = dbgp
xdebug.remote_mode = req
xdebug.remote_enable = 1
xdebug.remote_autostart = 0
xdebug.idekey="PHPSTORM"
xdebug.scream=0
xdebug.remote_connect_back=1
xdebug.show_local_vars=1

xdebug is also showing in the php.ini. I even ran it in http://xdebug.org/wizard.php and the latest version is installed.

Phpstorm is listening on port 9000 for xdebug, and "Listen for PHP Debug Connections" is on.

My xdebug log constantly tells me this:

Log opened at 2014-07-18 17:46:16
I: Checking remote connect back address.
I: Remote address found, connecting to 192.168.56.1:9000.
E: Time-out connecting to client. :-(
Log closed at 2014-07-18 17:46:16

I've even tried a registry edit: http://brianreiter.org/2010/09/18/fix-virtualbox-host-only-network-adapter-creates-a-virtual-public-network-connection-that-causes-windows-to-disable-services/

No matter what I try, xdebug times out. Even with all firewalls off.

I'm on Windows 7 Enterprise. VM is puphpet/centos65-x64

EDIT Forgot to mention the IDE key in Phpstorm is PHPSTORM

brianwalleshauser
  • 423
  • 2
  • 5
  • 12
  • From your Vargant machine -- try to connect to PhpStorm via `telnet` on that xdebug port (192.168.56.1:9000) while "Listen for PHP Debug Connections" is on, obviously. If nothing -- then it's firewall (check on BOTH sides) .. or some security settings of your Linux/Vagrant. – LazyOne Jul 18 '14 at 20:45
  • Therefore: **1)** Try different port number (must be set in both xdebug settings as well as PhpStorm while that "phone handle" icon is off) **2)** the security settings -- see what another person recently had -- maybe it will help you as well: http://devnet.jetbrains.com/message/5519942#5519942 – LazyOne Jul 18 '14 at 20:46
  • telnet said "connection refused". I have no firewalls on my workstation or on the virtual box. When I try to change the port number in the ini, the log still tries for 9000. I've verified that phpinfo is using the ini that I am editing, but still, it never changes the port. This is probably the issue. Either way, something funky is going on in the vagrant box. – brianwalleshauser Jul 21 '14 at 12:21
  • I've tried the answer in the link that you sent and it still did not work. Time-out connecting to client. :-( – brianwalleshauser Jul 21 '14 at 12:48
  • *"When I try to change the port number in the ini, the log still tries for 9000."* Have you restarted your Apache ?? Changes to php.ini most likely (in most config scenarios) are read only on startup. – LazyOne Jul 21 '14 at 14:27
  • Oh yes. I've restarted numerous times. I've stumped my entire IT department with this one. I'm currently reinstalling Phpstorm, and also upping a fresh vagrant file, just in case mine was messed up for some reason. We'll see. – brianwalleshauser Jul 21 '14 at 18:26

1 Answers1

11

To answer your confusion directly, two settings stand out. They are xdebug.remote_host and xdebug.remote_connect_back. The former setting's IP is incorrect, especially in a Vagrant setup. It should be something like 10.0.2.2. Furthermore, the latter setting should not be defined and enabled. When it is enabled, it completely ignores the former setting, thus rendering it useless. To summarize, the former setting is wrong, and the latter setting ignores it, but that latter setting is also wrong. These settings are only part of the reason Xdebug will not work, though.

Extended: setup Xdebug in PhpStorm with Vagrant

Vagrant introduces a layer of complexity not present in a standard, non-virtualized development environment. While the points above are probably correct, there are still additional settings and procedures that need to be followed in order to run Xdebug in PhpStorm through Vagrant. I struggled with this for a while, and after several failed attempts, succeeded in getting a connection. There is also a big deficit in documentation available online to achieve this kind of setup, so after successfully getting the whole setup working, I documented the guidelines on my blog. The entire setup process is described in detail, peppered with relevant screenshots. I also use CentOS 6.5 64bit, and the guidelines reflect that. It has even been tested against Magento.

How to configure Xdebug in PhpStorm through Vagrant

danemacmillan
  • 1,202
  • 12
  • 13
  • While I've opted to use the EAP for now, I feel this is a valuable resource. I've passed it on to my coworkers who are still having issues. Thanks! – brianwalleshauser Aug 08 '14 at 19:45
  • Yeah, the next major iteration of PhpStorm is going to make a lot of these processes much easier due to the ability to define remote interpreters (think Xdebug and PhpUnit). I can see why you would want to stick with EAP. If your team has any questions, they are welcome to ask on the blog. – danemacmillan Aug 08 '14 at 20:22
  • You should always include all necessary informations in your post, in case when your blog is going offline and your links dies... then your post is getting useless – Black Jul 31 '19 at 07:59
  • 1
    @Black Copying and pasting the entire post is excessive. It's a long post. I entirely disagree with your edit. You might as well post the entire contents of the Xdebug URL while you're at it, just in case, you know. Heck, just to be extra-super-duper-safe be sure to follow all the links on the Xdebug URL and paste the contents of those as well. My answer must contain the entirety of the World Wide Web to be relevant. My blog is hosted on GitHub. If it goes down, then the industry has changed. I'm restoring my original post. My response addressed OPs confusion; my blog was supplemental reading. – danemacmillan Aug 22 '19 at 16:22
  • @danemacmillan, fact is, if your link dies then your post is worthless so I am downvoting your post now. Include all NECESSARY infos in your post – Black Aug 24 '19 at 09:24