Xdebug for Debian9 remote Server

Answered

Creating this post because I have exhausted all resources.

I have a IntelliJ Ultimate installation, with the php plugins (these are two: "PHP  version 182.4892.16"  Vendor JetBrains

and

another plugin called "PHP latest version 0.4  Vendor Artem Khvastunov)

I have a virtual machine running debian9 (stretch), with apache version 2.4.25   and  php 7.0.33-0+deb9ul (cli)

My workstation running IntelliJ Ultimate and the debian VM are both on the same network (192.168.1.0/24).

I am a little bit lost on *what* do I have to put into the php.ini on my server.

 

I did install xdebug in the server via:  apt-get install php-xdebug.

On a phpinfo() page, I do have listed the Xdeb v2.5.0.

On that page, on the "Apache Environment" section, there is:

HTTP_COOKIE PHPSESSID=dka2l0i5inlqubtl2abcab9re4; XDEBUG_SESSION=PHPSTORM

I also have a section in that page titled "xdebug", and it has:

version 2.5.0

IDE Key PHPSTORM

 

Now I am lost.

What happens next?

When I run a php page (say, main.php)... what happens?

Do I have to enter into php.ini the IP address of my workstation?

Or should I go about it with the FireFox extension "Xdebug helper - by BrianGilbert_" ??

 

Thank you in advace.

Much appreciated!

10 comments

What happens next?

The most common step next would be setting up your php.ini so that xdebug.remote_host was an address the VM could access your workstation. Please also don't forget to set xdebug.remote_enable to on.

After that,

Or should I go about it with the FireFox extension "Xdebug helper - by BrianGilbert_" ??

yes, I would recommend that, although I usually go with the Debug this page bookmarklet.

https://www.jetbrains.com/help/phpstorm/browser-debugging-extensions.html

Please check this guide, it has answers to all your questions and more: https://www.jetbrains.com/help/phpstorm/debugging-with-phpstorm-ultimate-guide.html

Please also note that the Xdebug remote log is extremely helpful in troubleshooting debugging.

https://intellij-support.jetbrains.com/hc/en-us/articles/206544819-How-to-collect-remote-log-for-XDebug

0

Thank you Eugene Morozov!

I am going to try this and report back.

0

Ok, I believe everything should be working.

In php.ini, I have:

zend_extension="/usr/lib/php/20151012/xdebug.so"
xdebug.remote_enable=1
xdebug_remote_host="192.168.10.164"
xdebug.remote_port="9000"

 

The ip address is my current machine's address, and the "server" (which is running php) is 192.168.10.143.

I can ping from one machine to the other just fine.

 

I opened up a phpinfo(); page, and under the "xdebug" section, it does state:

Version 2.5.0

IDE Key PHPSTORM

These two values were automatically populated by the system.

So I *imagine* the "PHPSTORM" was reported back by my IntelliJ Ultimate edition.

 

Yet!

The code is not hitting my breakpoints in the application.

If I set a simple page with "echo 'mark10';"  and put a breakpoint on that line... I never get a hit.

 

Am I missing something?

0

Ok, I started almost from zero the entire configuration.

I am "stuck" on this step, Section: Web server debugging (here is the parent link).

 

Once I have all the configuration ready, in IntelliJ Ultimate, I go to Run --> Web Server Debug Validation

A new window opens, where I select "Remote Web Server".

Screenshot is attached below.

The "Deployment server" is the same on selected/created as "Remote Host" for the project (and where I set the php.ini with the Xdebug settings).

The problem is the "Path to create a validation script:".

If I set it to " / ", I get the message: Please, configure remote path mapping for the validation directory.

If I set it to either " /var/www/html " OR TO " /var/www/html/app ", I get the message: Path to the validation directory is invalid.

Am I missing something?

(Note, I have apache set to have as Document Root: /var/www/html/app)

 

All help is greatly appreciated!

0

In fact, this is local address -- you could easily check this by clicking "..." button.

Hope it helps!

0

Thank you for the help Vasiliy Yur!

I saw that if I click on the elipsis "...", I do get the "file directory browser" for my *local* machine.

So I then selected a local directory, yet I am still getting a message:

"Please, configure remote path mapping for the validation directory."

0

Ok, getting some good progress.

I entered the "Remote Host" configuration.

Created a new mapping --> set a new directory in my local machine, then set the "/var/www/html/app" directory on the development server.

NOTE: In my apache config, the "server root" is /var/www/html/app  .

Now I am getting the screenshot below.

I believe the Information-Message is from the xdebug config on the server side.

Will update shortly...

0

I believe the message is telling me to change the xdebug.remote_host on the php.ini *in the server*.

Yet I do have it set like that.

0

Alright!

Ready!!

I had a typo in php.ini

WRONG: xdebug_remote_host

CORRECT: xdebug.remote_host

Fixed, and now IntelliJ Ultimate is happy.

Onwards to the next speed-bump!

0

And now it's working!

If I go to FireFox, I enable the Xdebug helper extension

 

Then, head on over to IntelliJ Ultimate, and enable the "Start Listening for PHP Debug Connections"

 

Then set a breakpoint in the middle of the code:

We then reload the page, and IntelliJ stops the execution on the breakpoint!

Awesometastic!!!

 

Thanks to everyone!!

2

Please sign in to leave a comment.