skip to Main Content

We have the following development setup on our developing platform: A dedicated Ubuntu server and Apache with multiple subdomains and virtual hosts with separated configured php-fpm-sockets. All developers have their own home directory with its own working directory to which the virtual hosts are pointing to:

  • User A: a.url.de points to /home/a/workingdir
  • User B: b.url.de points to /home/b/workingdir

Further the developers have their own local PC with VSCode installed and they are connecting via SSH to the Server, so they can develop remotely in their own home working directory from anywhere.

Xdebug is successfully configured, since any developer can start a debug-session in VSCode in listening mode (no separate Webserver is started for the debug-session) and break points are working.

Of course only one developer at the same time can debug, since the port 9003 is in use then. Is there a possibility to use multiple ports, so all users can start the debug-session in listening mode? Any other workaround would be welcome.

We wanted to try DBGp Proxy Tool, would this help us to resolve our problem? Since the Proxy Tool also uses one port, I don’t think so?

2

Answers


  1. Chosen as BEST ANSWER

    With the following method, I was able to configure PHP and XDebug so that multiple developers can debug on the same server via SSH. We successfully tested it with breakpoints; however, I can't say at the moment whether this configuration might cause any unwanted side effects.

    Create a separate subdomain and Apache VirtualHost for each developer, e.g.:

    <VirtualHost userA.example.com:80>
        DocumentRoot /home/userA/workingdir
        <Directory /home/userA/workingdir>
            Require all granted
        </Directory>
        <FilesMatch .php$>
            SetHandler "proxy:unix:/run/php/php8.3-fpm-userA.sock|fcgi://localhost"
        </FilesMatch>
    </VirtualHost>
    

    Configure a separate PHP-FPM socket for each developer under /etc/php/8.3/fpm/pool.d, for example:

    [userA]
    user = userA
    group = userA
    listen = /run/php/php8.3-fpm-userA.sock
    listen.owner = www-data
    listen.group = www-data
    listen.mode = 0660
    chdir = /home/userA/wks
    php_admin_value[xdebug.client_port] = 9004
    php_admin_value[xdebug.trigger_value] = debug_userA
    

    This way, you can set separate php.ini settings for each developer, particularly the xdebug.client_port.


  2. The DBGp proxy set-up is meant for the situation, where is everybody on the same LAN, with the development server being external. Xdebug can only be configured with one port and one IP address. If that is the IP/port of the proxy, then the proxy can distribute among multiple people.

    You could install DBGp proxy on the development server, but then each of the developers need to have an internet accessible IP address with the Xdebug port open. That’s not often possible, especially not with home-grade DSL, cable, etc.

    For your specific situation, there is another solution: Xdebug Cloud, where both Xdebug (on the development server) and the IDE (on the developer’s home machine) connect through its service, side stepping the networking issue.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search