"Xdebug is an extension for PHP, and provides a range of features to improve the PHP development experience. Step Debugging A way to step through your code in your IDE or editor while the script is executing."
Source: https://xdebug.org/
Install following the instructions from https://xdebug.org/docs/install
php.ini settings that worked for me:
zend_extension=xdebug-2.9.4-7.2-vc15-x86_64
[xdebug]
xdebug.remote_enable = 1
xdebug.remote_autostart = 0
xdebug.remote_host = 127.0.0.1
xdebug.remote_port = 9072
xdebug.idekey = "PHPSTORM"
xdebug.profiler_enable = 0
Enabling PHP xdebug is fairly simple, just add arguments to your PHP call
> php -d -dxdebug.remote_enable=1 -dxdebug.remote_autostart=1 -dxdebug.idekey=PHPSTORM your/script.php
The option -d can set/override php.ini values
-d foo[=bar] Define INI entry foo with value 'bar'
Reference: https://www.php.net/manual/en/features.commandline.options.php
If you are using cmder, which bundles the conemu console
you can add the alias to your users_aliases.cmd
C:\Portable\cmder\config\user_aliases.cmd
xphp7=C:/laragon/bin/php/php-7.2.28-Win32-VC15-x64/php -d -dxdebug.remote_enable=1 -dxdebug.remote_autostart=1 -dxdebug.idekey=PHPSTORM $*
php7=C:/laragon/bin/php/php-7.2.28-Win32-VC15-x64/php $*
And use as
> xphp7 slimapp/cli.php arg1 arg2=test
Reference: Slim PHP CLI
No comments:
Post a Comment