1

I'm doing a simple laravel project and I have some code to debug but I can't make the debugging on VSCode work.

I'm on Ubuntu 19.10. I'm using VSCode insiders and Firefox with the XDebug extension. I followed the guide on xdebug.org/wizard but it didn't work.

Here is my xdebug configuration in my php.ini

[xdebug]
zend_extension=/usr/lib/php/20180731/xdebug.so
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.remote_connect_back=1
xdebug.idekey = VSCODE
xdebug.remote_port=9000

Here is my launch.json

"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000

And my php -v

$ php -v
PHP 7.3.11-0ubuntu0.19.10.1 (cli) (built: Oct 24 2019 11:38:49) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.11, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.11-0ubuntu0.19.10.1, Copyright (c) 1999-2018, by Zend Technologies
    with Xdebug v2.8.0, Copyright (c) 2002-2019, by Derick Rethans

I expect to be able to debug my laravel code but when I put a breakpoint in my code, it doesn't work. I am able to catch breakpoints that are in regular php files though.

1 Answer 1

0

I figured it out. I was using the command

php artisan serv

and accessing my server through 127.0.0.1:8000 and that was causing the isue.

You need to put the project in the /var/www/html/ folder and then access it through 127.0.0.1/yourApp/public/

You might need to add the files storage and bootstrap/cache to the webserver user: How to fix Error: laravel.log could not be opened?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.