Albert
Albert

Reputation: 1526

How to set up remote debugging with phpstorm and Xdebug

I've seen other questions/answer about this topic but none of them seem to have the same issue I have, so here we go:

What I'm trying

I'm using phpStorm 8 to develop PHP websites (CakePHP 2.5.1 in this specific case). I have a copy of the website on my computer, make whatever changes there and upload the new version to the production server via the integrated FTP tool. So far all pretty simple, no issues at all.

Now I would like to start using Xdebug to debug the websites using the production server (PHP 5.3.28), so I'm trying to set up remote debugging with phpStorm and Xdebug.

What I have done so far

I have installed Xdebug 2.1.3 on the production server, and it seems to be working. To test that I've done whats recommended in this other SO question, and all those things work.

This is how the config in php.ini looks like:

zend_extension="/usr/local/src/xdebug-2.1.0/modules/xdebug.so"

xdebug.profiler_enable='0'
xdebug.profiler_enable_trigger='1'
xdebug.profiler_output_dir='/home/username/debug'
xdebug.remote_enable='1'
xdebug.remote_connect_back ='1'

I'm not setting the remote_port variable because I'm fine with the default port (9000). Also, I'm not setting the remote_host IP because I'm using the remote_connect_back option to allow multiple IPs, as explained here.

I've also tried 2 different approaches to set all this up:

  1. I followed this Zero Configuration tutorial, but at step 7 I never get the Incoming Connection dialog.

  2. I also followed this different tutorial but in the Integrating XDebug with PhpStorm step I don't have the choose XDebug from the Debugger drop-down list option on step 3

What I need

If someone could help me figure out what I'm missing or doing wrong that would be great!

Upvotes: 3

Views: 7496

Answers (1)

Nathan
Nathan

Reputation: 83

I would have added this to the comments, but don't have the needed rep.

Have you set the preferences correctly in your project? Were you able to configure and validate your deployment server (under Deployment)?

After that, set up the server under PHP > Server and validate it as well.

Don't forget to check the firewall on your host.

Make sure that you can get XDebug working without PHPStorm, then circle back around and integrate it.

These are the php.ini settings, other than the driver path, that I am using for my CLI project:

xdebug.remote_enable = 1
xdebug.remote_connect_back = 1
xdebug.remote_autostart = 1
xdebug.remote_host = 192.168.100.1

Most importantly, listen to LazyOne. Specify your remote host. And don't run debuggers on your production gear. Spend some time learning about Virtual Machines. My recommendation is to check out VirtualBox, Vagrant, and SaltStack. Used together, these tools will allow you to debug your code in an environment that is as close to production as possible without adding the burdens and risks involved with your debugging tools.

Upvotes: 2

Related Questions