I have installed Xdebug with VS Code and Flywheel local and I am learning how to make themes. I have put a breakpoint in my index.php file. However, the said breakpoint is not working.
I am not getting any errors in my console. Nothing is happening in VS Code debug terminal when I load my site. It's just all blank. I have also installed PHP Debug extension in VS Code.
However, when I type in debug console anything I get this message - Cannot evaluate code without a connection.
What went wrong here?
My php.ini
[xdebug]
{{#if os.windows}}
zend_extension = php_xdebug.dll
{{else}}
zend_extension = {{extensions.xdebug}}
{{/if}}
xdebug.remote_enable=1
xdebug.remote_connect_back=Off
xdebug.remote_port="9000"
xdebug.profiler_enable=0
xdebug.remote_autostart = 1
xdebug.mode=debug
My launch.json
{
// 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": {
"C:/Users/ajayb/Local Sites/wordpress-theme-1/app/public": "${workspaceRoot}"
}
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9000
}
]
}
My Answer:
There could be several reasons why Xdebug is not working in your PHP environment. Some common reasons include:
1. Xdebug is not properly installed or configured in your PHP environment. Make sure that Xdebug is installed and enabled in your PHP configuration file (php.ini).
2. Xdebug is conflicting with other PHP extensions or settings. Check for any conflicts with other extensions or settings that may be preventing Xdebug from working properly.
3. Xdebug is not compatible with your PHP version. Make sure that you are using a compatible version of Xdebug for your PHP version.
4. Xdebug is not properly configured in your IDE or debugging tool. Make sure that Xdebug is properly configured in your IDE or debugging tool to enable debugging features.
5. Xdebug is not enabled for the specific script or application you are trying to debug. Make sure that Xdebug is enabled for the specific script or application you are trying to debug.
If you have checked all of these possible reasons and Xdebug is still not working, you may need to troubleshoot further or seek help from a professional PHP developer or Xdebug expert.
Rate this post
3 of 5 based on 6215 votesComments