我正在尝试使用Visual Studio代码,Xdebug和XAMPP来调试我的PHP脚本 . 到目前为止我做的事情:
-
使用PHP 7.2.6下载最新的XAMPP版本
-
使用Xdebug向导执行所有步骤:https://xdebug.org/wizard.php
-
在Chrome中添加了Xdebug扩展程序 .
-
在php.ini中添加了以下行:
zend_extension = /opt/lampp/lib/php/extensions/no-debug-non-zts-20170718/xdebug.so
[XDebug]
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
- 在VS代码中添加了以下设置:
{
"window.zoomLevel": 0,
"window.openFilesInNewWindow": "off",
"files.autoSave": "afterDelay",
"window.restoreFullscreen": true,
"editor.renderIndentGuides": true,
"editor.mouseWheelZoom": true,
"php.validate.enable": true,
"php.validate.executablePath": "opt\\lampp\\bin\\php-7.2.6",
"php.validate.run": "onType",
}
=> VS代码中的错误:
自opt \ lampp \ bin \ php-7.2后无法验证 . 不是一个有效的PHP可执行文件 . 使用设置'php.validate.executablePath'配置PHP可执行文件 .
请告诉我们如何解决此错误或以其他任何方式执行此操作 .
1 回答
尝试使用旧版本的Xampp,例如7.0.2-1,然后按照https://xdebug.org/wizard.php提供的说明进行操作,特别要记得使用Xampp安装提供的
phpize
和php-config
:/opt/lampp/bin/phpize
而不是phpize
./configure --with-php-config=/opt/lampp/bin/php-config
而不是./configure
然后,在VS Code中,安装PHP Debug并按照其说明操作(步骤4) .
其他配置不是必需的 .