PHPStorm remote debugging on cPanel server xdebug 3.1.2

I've read and tried different settings for two days and still no joy so hoping someone can help...

I set up a new project from existing files, selected remote host accessible by FTP/SFTP/FTPS.  Files correctly replicated to my local from the remote after the SFTP server was set up. 

I'm working on a Windows 10 box, connecting to a server running cPanel running PHP 7.4 and I do not have WHM access to the server.  In MultiPHPINI editor I have added the following:

zend_extension = "/home/virtfs/proj/opt/cpanel/ea-php74/root/usr/lib64/php/modules/"
xdebug.mode = debug
xdebug.client_host = // my public IP
xdebug.client_port = 9003
xdebug.start_with_request = trigger
xdebug.log = "/proj/home/public_html/"  //no log entries so far
xdebug.log_level = 7

xdebug 3.1.2 is installed according to PHPINFO.  PHPStorm 2021.2.3 running on local and I can debug locally with no issues.

I can establish a SSH tunnel with port forwarding using SSH username@domain -R 9003:localhost:9003.

My local has WAMP64 with localhost serving the project out of www/project_name - works as expected, debugs locally as expected.

The cPanel server is serving out of /home/proj/public_html/project_name.  I can browse to http://project_name with no issues.

I use the SFTP connection in Deployment - connects as expected, browses remote directory.  I have Root path: set to /home/proj/public_html/project_name  which is different than what Autodetect returns (/home/proj) but when using the complete path the Browse Remote Directory opens the project_name with no issues.

I have been trying to find a mapping that works to validate the debugger.  I have two currently in the Deployment server:

Local Path: c:\wamp64\www\project_name, Deployment Path: /home/proj/public_html/project_name, Web Path: http://project_name

Local Path: c:\wamp64\www\project_name, Deployment Path: /logfiles, Web Path: http://project_name

I have tried multiple options in Debug Configuration - checking "Filter debug connection by IDE key" and xdebug.helper in Chrome with IDE key set to "PHPStorm" and also with the option unchecked.

When trying to validate the debugger, I check Remote Web Server, select my Deployment server, set Path to create validation script to: c:\wamp64\www\project_name\logfiles.  Validate returns: Please, configure remote path mapping for the validation directory.

I have tried every iteration of /home/proj/public_html/project_name there is:  simply using a /, using /home/proj/public_html/logfiles,  and /home/proj/public_html, and /home/proj, and just /home.

Any help in solving this will be greatly appreciated!

1 comment
Comment actions Permalink

Hi there,

xdebug 3.1.2 is installed according to PHPINFO.

Please show the full output of xdebug_info(); captured via web page (you are trying to debug a web page, not a CLI script, right?). This is to ensure that your LIVE Xdebug settings are correct and that the right is used (as you may have one PHP versions for CLI and another for a web server; and each can use different configs)

xdebug.client_host = // my public IP

Public IP of what? Just in case -- this has to be an IP of your computer as seen from the server as it's Xdebug that connects to the IDE and NOT other way around. You may also need to open the Xdebug port on you firewall/router for incoming connection to reach the IDE.

I can establish a SSH tunnel with port forwarding using SSH username@domain -R 9003:localhost:9003.

In such a case xdebug.client_host should point to as far as I know (so the SSH can forward it back to the local PC via SSH tunnel). Just in case:

xdebug.log = "/proj/home/public_html/"  //no log entries so far

If Xdebug tries to debug then the file should contains the logs. Check the file permissions (so that anyone can write to it -- make an empty file in advance just in case and assign full 777). Check the path. If SELinux is used (together with Apache) -- you may need to configure it to allow outgoing connections (sudo setsebool -P httpd_can_network_connect=1 kind of stuff)

Try also adding programmatic breakpoint into your PHP code: xdebug_break(); -- this will start the debug session even if not requested. Or even xdebug.start_with_request = yes in your php.ini.

I have been trying to find a mapping that works to validate the debugger.

Remote paths -- your description is too confusing / sounds like you are not sure what the path is... Anyway: the Xdebug log will have the path of the file (once you make it to connect to your PC first).

Anyway: your local project root should point to the remote website root. Adjust as needed. Based on your description (confusing to me, TBH) it should be something like:

c:\wamp64\www\project_name --> /home/proj/public_html/project_name

You better use pictures to illustrate your current config. that can shed the light on certain things (what you may be doing wrong / correct but in the wrong place etc).

I suggest:

  1. PhpStorm Ultimate Debugging Guide
  2. Debug with PhpStorm: Ultimate Guide | PhpStorm

Please sign in to leave a comment.