Use slic xdebug status
to find the configuration details for the project that you have run slic use
on. This command will give you the path mappings and the port number that you need.
In PHPStorm settings:
- Search for
debug
- Select
PHP
>Debug
- Ensure that the Debug port is set to whatever
slic xdebug status
returns. (typically9001
)
In PHPStorm settings:
- Search for
server
- Select
PHP
>Servers
- Click the
+
button to add a new server - Set the
Name
toslic
- Set the
Host
to whateverslic xdebug status
returns. (typicallyhttp://localhost:8888
... yes, put the whole thing in theHost
field) - Set the
Port
to80
- Check the
Use path mappings
checkbox - Find the
wp-content/plugins
directory and set theAbsolute path on the server
to/var/www/html/wp-content/plugins
- If you've added the
slic
directory to your workspace, find theslic/_wordpress
directory and set theAbsolute path on the server
to/var/www/html
Screenshot from PhpStorm's video:
Here's a standard configuration for Xdebug in VSCode or VSCode-like editors. (Note: Be sure to use slic xdebug status
to get the correct paths and port number.)
{
"version": "0.2.0",
"configurations": [
{
"name": "Slic: Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9001,
"pathMappings": {
"/var/www/html/wp-content/plugins": "${workspaceFolder}/<PATH_TO_WP_CONTENT_DIR>/plugins",
"/var/www/html": "${workspaceFolder}/slic/_wordpress"
},
"ignore": [
"**/vendor/**/*.php"
],
"stopOnEntry": false
}
]
}
In this launch.json
file, there are two pathMappings
entries:
- The first one maps the
slic
plugins directory (left side) to your local WP's plugins directory (right side). - The second one is technically optional, but it assumes you've added the
slic
directory to your VSCode workspace and maps theslic
WP root (left side) to your localslic
directory's WP root (right side).