使用PHP Xdebug与MAMP的PHP CLI二进制
我正在使用MAMP的PHP CLI二进制(即/applications/mamp/bin/php/php7.2.10/bin/php)从终端执行脚本。如何使用Xdebug来通过我执行以这种方式执行的脚本?
到目前为止,我已经读过: 让xdebug与MAMP和Mac一起工作 其中提到了如何启用Xdebug,但仅通过从Web服务器调用脚本来提及。
这是: 安装用于php cli的xdebug 不幸的是,这是在带有XAMPP的Xdebug上,很难推断到MAMP。
是否没有一种简单的方式:
$ phpdebugger phpfile.php
(( 而不是
$ php phpfile.php
)
,哪个将开始使用文件的调试会话?
如果Xdebug不适合此,是否还有其他程序可以执行此操作?
I am using the PHP CLI binary of MAMP (ie. /Applications/MAMP/bin/php/php7.2.10/bin/php) to execute scripts from the Terminal. How can I use Xdebug to step thru a script that I execute this way?
So far I have read:
https://joshbuchea.com/mac-enable-xdebug-in-mamp/
Getting Xdebug Working with MAMP and Mac
which mentions how to enable xdebug but only through calling the script from a web server.
And this:
Installing Xdebug for PHP CLI
Which is on Xdebug with XAMPP which I unfortunately find difficult to extrapolate to MAMP.
Is there not a simple way like:
$ phpdebugger phpfile.php
(
Instead of
$ php phpfile.php
)
Which will just start the debugging session with the file?
If xdebug is not suitable for this, is there another program to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以设置
-dxdebug.start_with_request = yes
:或,SET
xdebug.start_with_request = yes
inphp.ini
(使用)代码> php -ini 找出哪个文件)。或,您可以使用触发环境变量:
You can either set
-dxdebug.start_with_request=yes
:Or, set
xdebug.start_with_request=yes
inphp.ini
(usephp --ini
to find out which file that is).Or, you can use the trigger environment variable:
我不使用MAMP,但是我用来调试PHP CLI是
,显然,在您的代码中添加断点。
I do not use MAMP but what I use to debug PHP CLI is
and obviously, add breakpoints to your code.