Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I debug PHP Laravel on Visual Studio Code without use XAMPP or WAMP server

I'm using PHP 7.3.1 with Laravel 5.7.

How can I proceed to debug step by step without install a external server? Using Xdebug?

Just running with the command:

php artisan serve

All solution then I founded use WAMP.

like image 233
Paulo Avatar asked Oct 18 '25 08:10

Paulo


2 Answers

Setup xdebug extension in php.ini file as per your PHP version.

Check which version of xdebug support your PHP here : https://xdebug.org/wizard.php

Don't forget to change your xdebug extension path zend_extension.

Add xdebug extension into the browser also. For mozila click here.

[xdebug]
zend_extension = "C:\php\ext\php_xdebug-2.7.0-7.2-vc15.dll"
xdebug.remote_autostart = 1
;xdebug.profiler_append = 0
;xdebug.profiler_enable = 0
;xdebug.profiler_enable_trigger = 0
;xdebug.profiler_output_dir = "c:\xampp\tmp"
;xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.remote_enable = 1
;xdebug.remote_handler = "dbgp"
;xdebug.remote_host = "127.0.0.1"
;xdebug.remote_log = "c:\xampp\tmp\xdebug.txt"
;xdebug.remote_port = 9000
;xdebug.trace_output_dir = "c:\xampp\tmp"
;36000 = 10h
;xdebug.remote_cookie_expire_time = 36000
;xdebug.trace_output_dir = "C:\xampp\tmp"
like image 155
Mayank Dudakiya Avatar answered Oct 20 '25 23:10

Mayank Dudakiya


I'd try starting artisan with Xdebug like php -z /path/to/xdebug.so artisan serve.

And then use the PHP debug extension for Visual Studio code, to set breakpoints, inspect variables and all other debugging stuff.

like image 37
Paulo Phagula Avatar answered Oct 20 '25 21:10

Paulo Phagula



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!