Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHPStorm, Xdebug and remote debugging (using FTP in phpstorm)

First things first:

  • Server is an Apache running on Ubuntu on SunVirtualBox x86
  • Debugging-Server is XDebug
  • Files are downloaded from FTP using phpstorm

PHP version is

PHP 5.4.9-4ubuntu2.4 (cli) (built: Dec 12 2013 04:26:30) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans

Important: XDebug is properly configured cause everything works on my localhost.

enter image description here

But I just can't set up remote debug here are all the images and steps I made, PLEASE HELP and advice me.

Step 1 - Basic click on Create new project from existing files.

Step1

Step 2 - Choose FTP

Step2

Step 3 - Project settings on file system

Step 3

Step 4 - Setting FTP connection and Advanced - Passive mode

Setting FTP connection and Advanced - Passive mode

Step 5 - Run/Debug configuration, choose PHP remote Debug, and typed in Ide key: PHPSTORM

Run/Debug configuration

Step 6 - Servers and validate remote enviroment, here pops out WARNING: No debug extension loaded

Servers and validate remote enviroment

Step 7 - Php ini configuration.

Php ini configuration.

So in the end....

1) Is there anything that I had to do on remote server from my client for this thing to work? Maybe install XDEBUG also there, maybe you will find this questions silly, believe me I lost 3 days already in this and I am little frustrated to say the lease. so please help.

2) I will happily upload more screenshots or answer to any question you might have in order to help me out. I know it is something simple but I am breaking my head over it.

Again please help, I passed certainly 15 pages on remote debug in PHPSTROM and all of them were just not precise enough. Like you can see in first pictures everything works fine on my localhost.

like image 899
Matija Avatar asked Dec 29 '13 21:12

Matija


People also ask

How do I use breakpoints in PhpStorm?

To do this, go to Settings/Preferences | Build, Execution, Deployment | Debugger and select Drag to the editor or click with middle mouse button. Clicking a breakpoint will then enable or disable it.


1 Answers

The main difference between using XDebug on your local machine, and using XDebug with a remote system, is that you have to configure two things:

1) The xdebug.remote_host on your server outside your network is going to be YOUR IP ADDRESS, as in, what you get if you go to whatismyip.com. This IP address is prone to change. (You can use dynamic DNS from certain providers and a hostname instead of an IP if your home IP changes a lot). Anyway, When XDebug starts on the remote server, it becomes the CLIENT looking for YOUR XDEBUG SERVER running on your laptop on port 9000.

This is what confuses so many users of XDebug. That then leads to the following:

2) You have to edit your home/office firewall (presumably this is the traffic cop on the IP you entered into your xdebug.ini or php.ini in step 1) to port forward incoming traffic on port 9000 to your laptop's IP on your home/office network.

The best resource about this is (IMO) here: http://matthardy.net/blog/configuring-phpstorm-xdebug-dbgp-proxy-settings-remote-debugging-multiple-users/

like image 121
phpguru Avatar answered Sep 20 '22 23:09

phpguru