Setup Xdebug for Laravel on Windows - php

Now I am learning Laravel, but the problem is: when trying to debug blade.php code it does not work, dont hit the breakpoin
Do you know how to make Xdebug work with Laravel?
OS:
Windows 8.1
Code editor:
Visual Studio code
Route of the laravel project:
C:\Users\SleekBook\Proyectos\SistemaEquino
PHP path:
C:\Users\SleekBook\scoop\apps\php\7.2.5\php.ini
PHP.ini configuration:
zend_extension = "C:\Users\SleekBook\scoop\apps\php\7.2.5\php_xdebug-2.6.0-7.2-vc15-x86_64.dll"
[XDebug]
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_connect_back = 1
xdebug.show_local_vars = 1
xdebug.remote_host = 127.0.0.1
xdebug.remote_port = 9000
The server local its online
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9000
}

Related

How could I let Xdebug steping over the code

I have been working with Laravel version 7 with php7.4 and suddenly my Xdebug is not steping over the lines but before is working fine and I don't change or touch any configuration file.
vscode configuraion
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9003,
"stopOnEntry":false
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9000
}
]
php.ini
[XDEBUG]
xdebug.mode=debug
;my-updates
xdebug.remote_autostart=1
xdebug.default_enable=1
xdebug.remote_port=9003
xdebug.remote_host=127.0.0.1
xdebug.remote_connect_back=1
xdebug.remote_enable=1
xdebug.idekey=PHPSTORM
;end
zend_extension = C:\xampp\php\ext\php_xdebug-3.0.1-7.4-vc15-x86_64.dll
and extension
PHP Debug felixfbecker.php-debug v1.14.9
so when I set breakpoint on a line its cache but is not step over the lines also I set many breakpoints and press button debug called continue also is jump to this function
public function prepareResponse($request, $response)
{
return static::toResponse($request, $response);
}

PHP 7.3 Listen for Xdebug does not work in VSCode with WAMP

I want to debug the php file using Chrome by Listen for XDebug
the debugger can't catch the break point and nothing shows on the browser
while Launch currently open script works fine
Below are my vs json and php.ini files. My WAMP server uses the port 8081 and file I want to debug is located at E:\Softwares\Installed\wampServer\www\store
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000,
"pathMappings": {
"wamp/www/": "E:/Softwares/Installed/"
}
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9000
}
]
}
php.ini
[xdebug]
xdebug.remote_autostart = On
xdebug.remote_enable = On
zend_extension="E:/Softwares/Installed/wampServer/bin/php/php7.3.21/zend_ext/php_xdebug-2.9.6-7.3-vc15-x86_64.dll"
xdebug.profiler_enable = off
xdebug.profiler_enable_trigger = Off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir ="E:/Softwares/Installed/wampServer/tmp"
xdebug.show_local_vars=0

Cannot setup Xdebug in VSCode on XAMPP on Linux Mint

Here is my setup:
php.ini in xampp in found: /opt/lampp/etc/php.ini
[XDebug]
zend_extension=/usr/lib/php/20180731/xdebug.so
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
This is what the phpinfo() looks like:
I am not able to step through the code or even set a breakpoint using the recommended PHP Debug plugin.
This is the default launch.json for VSCode.
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000
},
{
"name": "Launch currently open script",
"type": "PHP",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9000
}
]
}
I saw in your phpInfo() ss that the port for xdebug is set to 9003 while your launch.json is listening to port 9000. Maybe this is the problem?

XDebug not working in VScode for php debugging

PHP debugging in vscode using xdebug and xampp is not working even after all configurations.
here is my php.ini file config:
zend_extension = D:\Xampp\php\ext\php_xdebug-3.0.0-7.3-vc15-x86_64.dll
[XDebug]
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
this is json file
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}"
}
]
}
xDebug 3 has changed several default values, so be sure your code is ready to work with new ones.
Here is my configuration set, which allowed me to use PHP breakpoints as always:
.vscode\launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9000
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9000
}
]
}
php.ini (lines manually inserted in the end of a file)
[xdebug]
zend_extension = "php_xdebug-3.0.4.dll"
xdebug.mode = debug
xdebug.discover_client_host = 1
xdebug.start_with_request = yes
xdebug.client_port = 9000
Note: above zend_extension option would try to find your xdebug library in a .../modules/php/PHP_%your_php_version%/ext/ folder
I just got satisfaction with XDebug 3.
I found a good response here :https://github.com/felixfbecker/vscode-php-debug/issues/411 by jason-nabooki.
I do the same :
Json file :
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9003,
"stopOnEntry": true,
"log": true,
"pathMappings": {"/var/wwww/ammac":"${workspaceRoot}"}
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9003
PHP.ini :
xdebug.mode= debug
xdebug.start_with_request = yes
xdebug.discover_client_host = true
To use the debugger (I didn't find immediatly due to my precedent use of Eclipse !),
first : click on the green triangle near "Listen for XDebug
second : refresh the web page in Firefox (or other)
For me it works i got the variables. Not yet test the breakpoints.
Remark : no need of the XDEbug helper in Firefox (surprise!)
In VSCode, I went to Settings -> Features -> Debug -> Allow Breakpoints Everywhere.
I check marked "Allow Breakpoints Everywhere" and I was able to debug again.
Struggled with this myself. Apparently XDebug 3.x doesn't work as outlined above. I found that even the equates under [XDebug] are no longer compatible. Download XDebug 2.x (I think 2.98 is the latest in the 2.x series). After I switched to 2.x, I'm no longer having any issue (so far).
https://xdebug.org/wizard - This tool helped me to find the reason why debuger didn't work.
Your are using xdebug version 3:
zend_extension = ... php_xdebug-3....
but in configuration you listen port 9000:
"port": 9000
The default Xdebug port changed between Xdebug v2 to v3 from 9000 to 9003.
Just change "port": 9000 => "port": 9003

VS Code not stopping at breakpoint with PHP XDebug

i'm working in Laravel application, i'm trying to use XDEBUG with WAMP Server and Visual Studio code, when i run "Listen for XDEBUG" in VS code it dosen't stop at break point but the page still in charge it's like the debug is working but not stopping in breakpoint.
I already have added XDEBUG's extension in Chrome
Here's my Lanch.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": 8000
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9000
}
]
}
And in my php.ini i have this at the end :
[xdebug]
zend_extension="c:/wamp64/bin/php/php7.2.25/zend_ext/php_xdebug-2.8.0-7.2-vc15-x86_64.dll"
xdebug.remote_enable =1
xdebug.profiler_enable =1
xdebug.profiler_enable_trigger =1
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir ="c:/wamp64/tmp"
xdebug.show_local_vars=0
xdebug.default_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_port=8000

Categories