3

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!

Community
  • 1
  • 1
Albert
  • 1,516
  • 3
  • 24
  • 55
  • 1
    Side notes: 1) *"Also, I'm not setting the remote_host IP because I'm using the remote_connect_back option to allow multiple IPs"* And now everyone has a chance to establish debug session for your live server and see your passwords etc. 2) *"I would like to start using Xdebug to debug the websites using the production server"* Great idea. Do you know that execution with xdebug installed will take 2 or more times more time? – LazyOne Oct 08 '14 at 23:57
  • As for the actual Q: so what is the problem? Can you debug or not? Because "it works but it does not work" is not the best description of the problem. 1) How can you tell that xdebug debugging is working? 2) Where this "production server" is located -- on Internet or local LAN? 3) Have you checked firewalls (on both local and remote) as it's xdebug which connects to IDE and not other way around. 4) If it's on Internet / part of another sub-net -- have you opened /ports on your router so that incoming connection can be router to your computer? – LazyOne Oct 09 '14 at 00:02
  • 5) When you have "phone handle" icon activated in IDE, can you connect from remote server to your IDE on xdebug port via `telnet`? If you cannot -- then it has to be firewall somewhere in between them 6) PhpStorm v8 supports remote interpreters -- so no need to setup all this stuff -- just setup SFTP deployment, remote interpreter and you can debug remote CLI scripts (but yes, for debugging web pages you still better do as you have planned to do) – LazyOne Oct 09 '14 at 00:04
  • *"I don't have the choose XDebug from the Debugger drop-down list option on step 3"* That's for configuring PHP interpreters (which will be used for debugging CLI scripts and have no relation to web pages) – LazyOne Oct 09 '14 at 00:08
  • @LazyOne thank you very much for your comments, there's clearly a few things I still need to learn, but that's why we're here right? ;) It will probably be best to try to debug somewhere else, my goal was to avoid possible issues of debugging on a different environment – Albert Oct 09 '14 at 06:49

1 Answers1

2

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.

Nathan
  • 83
  • 1
  • 6