How to map Xdebug in Vscode to a vhost?

Asked

Viewed 48 times

-3

I have a project that’s coming from the SD Card:

/Volumes/SDCARD/sd_projects/sistema-news/sistema-news-web/

Xdebug works when I have a file at the root of the localhost directory: /Applications/Ampps/www/, but nay in my project which is a virtualhost:

<IfModule ssl_module>
<VirtualHost _default_:443>
    <Directory "/Volumes/SDCARD/sd_projects/sistema-news/sistema-news-web">
    Options FollowSymLinks Indexes
    AllowOverride All
    Order deny,allow
    allow from All
    </Directory>
       ServerAdmin [email protected]
       DocumentRoot "/Volumes/SDCARD/sd_projects/sistema-news/sistema-news-web"

       ServerName local.system.com.br  
       ServerAlias www.local.system.local
       php_flag always_populate_raw_post_data -1
       setEnv APPLICATION_ENV "development"

        SSLEngine on
        SSLCertificateFile /Volumes/SDCARD/sd_projects/sistema-news/sistema-news-web/sistema.com.br.crt
        SSLCertificateKeyFile /Volumes/SDCARD/sd_projects/sistema-news/sistema-news-web/sistema.com.br.key

        DocumentRoot "/Volumes/SDCARD/sd_projects/sistema-news/sistema-news-web"
        ErrorLog "/Applications/Ampps/apache/logs/https.local.sistema.com.br.err"
        CustomLog "/Applications/Ampps/apache/logs/https.local.sistema.com.br.log" combined
  
</VirtualHost>
</IfModule>

Xdebug is enabled: inserir a descrição da imagem aqui

inserir a descrição da imagem aqui

In php.ini I have this:

;Debug
[XDebug] 
zend_extension=/usr/local/php/extensions/xdebug.so
xdebug.remote_port=9000
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.profiler_output_dir=/Applications/AMPPS/tmp 
xdebug.idekey="vscode_xdebug"

But when I mark the red ball on the line (breakpoint), and hit the page that calls this method, nothing is happening. It was supposed to throw me back to the vscode.

inserir a descrição da imagem aqui

This is the configuration of Listen in vscode (Launch.json), with the PHP Debug plugin (Felix Becker):

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 9000
        }
    ]
}

Additional details: The php version is 7.3.11, Xdebug is 2.9.6 (for MAC)

Example I couldn’t apply.

1 answer

0

Solved the mapping:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 9000
        }
       
    ],
    "pathMappings": {
        "/Volumes/SDCARD/sd_projects/": "https://local.gutennews.com.br:8810/"
      }

}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.