wamp - xdebug 配置未保存
wamp - xdebug configuration is not getting saved
这是我在 php.ini
中的 xdebug 配置
[xdebug]
zend_extension="C:\wamp64\bin\php\php5.6.35\zend_ext\php_xdebug-2.5.5-5.6-vc11-x86_64.dll"
xdebug.remote_log = C:\wamp64\logs\xdebug.log
xdebug.idekey = PHPSTORM
xdebug.remote_port = 9000
xdebug.remote_handler="dbgp"
xdebug.remote_autostart = on
xdebug.remote_start = on
xdebug.remote_enable = on
xdebug.remote_connect_back = on
它在文件的最底部。
如您所见,我已将 xdebug.idekey
设置为 PHPSTORM
,但 phpinfo()
显示该值未设置,我做错了什么?
我也通过PhpStorm设置了idekey,但是为什么在最下面的phpinfo()里面有no value
入口呢?顶一个被填满了?!
编辑 来自评论和@Black 的回答,这就是答案:
WAMP 使用 3 PHP.ini 个文件:
- Apache 的文件:
wamp\bin\apache\apache[version]\bin\php.ini
- PHP 的文件:
wamp\bin\php\php[version]\php.ini
- 第三个文件:
wamp\bin\php\php[version]\phpForApache.ini
前两个文件很有用,apache 的文件用于 HTTP 调用,PHP 的一个用于 CGI/CLI。第三个用于当您的 WAMP 有 2 PHP 版本时,WAMP 使用它来保存当前配置,然后为新版本创建一个新的 PHP.ini 文件。这发生在 PHP 的版本切换期间。
在 Xdebug 的情况下,确实是 apache 的文件很重要。当 phpinfo 不显示任何修改时,这是一个常见问题。
如果你在这两个文件之间有相同的配置,你也可以建立一个从PHP的文件到apache文件的符号链接。这会省去很多麻烦。
不幸的尝试
根据您的要求,您可能需要用不同的东西配置您的服务器。
您尝试使用 Xdebug 作为远程,那么您的 IDEKEY 应该被设置为名为的环境变量:DBGP_IDEKEY
这是文档:
xdebug.idekey
Type: string, Default value: complex Controls which IDE Key Xdebug
should pass on to the DBGp debugger handler. The default is based on
environment settings. First the environment setting DBGP_IDEKEY is
consulted, then USER and as last USERNAME. The default is set to the
first environment variable that is found. If none could be found the
setting has as default ''. If this setting is set, it always overrides
the environment variables.
您可能对我用斜体文本指出的情况感到担心
如评论中所链接,请查看完整内容 documentation
我记得 WAMP 使用 Xdebug 作为线程安全扩展,你应该试试
替换
zend_extension="C:\wamp64\bin\php\php5.6.35\zend_ext\php_xdebug-2.5.5-5.6-vc11-x86_64.dll"
来自
zend_extension_ts="C:\wamp64\bin\php\php5.6.35\zend_ext\php_xdebug-2.5.5-5.6-vc11-x86_64.dll"
并检查您是否下载了正确版本的 Xdebug(线程安全)
然后重启wamp,看看有没有什么变化。
编辑: 你的 PHP.ini 有问题,你没有修改正确的。我用这个成功了:
; XDEBUG Extension zend_extension = "C:\wamp\bin\php\php7.0.4\zend_ext\php_xdebug-2.4.0-7.0-vc14-x86_64.dll" ;
[xdebug]
xdebug.remote_enable=1
xdebug.idekey = "PHPSTORM"
xdebug.remote_autostart= on
xdebug.remote_connect_back= 1
xdebug.remote_host="127.0.0.1"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
xdebug.remote_mode=req
xdebug.profiler_enable = 0
xdebug.profiler_output_dir = "c:/wamp/tmp/"
xdebug.collect_params = On
xdebug.show_local_vars = On`
未保存的原因是在 wamp
上您必须将配置存储在 C:\wamp64\bin\apache\apache_VERSION\bin\php.ini
而不是 C:\wamp64\bin\php\php_VERSION\php.ini
。
我使用 Notepad++ 在整个 wamp/bin/php
文件夹中搜索了字符串 xdebug
,这就是我找到它的方式。
这是我在 php.ini
中的 xdebug 配置[xdebug]
zend_extension="C:\wamp64\bin\php\php5.6.35\zend_ext\php_xdebug-2.5.5-5.6-vc11-x86_64.dll"
xdebug.remote_log = C:\wamp64\logs\xdebug.log
xdebug.idekey = PHPSTORM
xdebug.remote_port = 9000
xdebug.remote_handler="dbgp"
xdebug.remote_autostart = on
xdebug.remote_start = on
xdebug.remote_enable = on
xdebug.remote_connect_back = on
它在文件的最底部。
如您所见,我已将 xdebug.idekey
设置为 PHPSTORM
,但 phpinfo()
显示该值未设置,我做错了什么?
我也通过PhpStorm设置了idekey,但是为什么在最下面的phpinfo()里面有no value
入口呢?顶一个被填满了?!
编辑 来自评论和@Black 的回答,这就是答案:
WAMP 使用 3 PHP.ini 个文件:
- Apache 的文件:
wamp\bin\apache\apache[version]\bin\php.ini
- PHP 的文件:
wamp\bin\php\php[version]\php.ini
- 第三个文件:
wamp\bin\php\php[version]\phpForApache.ini
前两个文件很有用,apache 的文件用于 HTTP 调用,PHP 的一个用于 CGI/CLI。第三个用于当您的 WAMP 有 2 PHP 版本时,WAMP 使用它来保存当前配置,然后为新版本创建一个新的 PHP.ini 文件。这发生在 PHP 的版本切换期间。
在 Xdebug 的情况下,确实是 apache 的文件很重要。当 phpinfo 不显示任何修改时,这是一个常见问题。
如果你在这两个文件之间有相同的配置,你也可以建立一个从PHP的文件到apache文件的符号链接。这会省去很多麻烦。
不幸的尝试 根据您的要求,您可能需要用不同的东西配置您的服务器。
您尝试使用 Xdebug 作为远程,那么您的 IDEKEY 应该被设置为名为的环境变量:DBGP_IDEKEY
这是文档:
xdebug.idekey
Type: string, Default value: complex Controls which IDE Key Xdebug should pass on to the DBGp debugger handler. The default is based on environment settings. First the environment setting DBGP_IDEKEY is consulted, then USER and as last USERNAME. The default is set to the first environment variable that is found. If none could be found the setting has as default ''. If this setting is set, it always overrides the environment variables.
您可能对我用斜体文本指出的情况感到担心
如评论中所链接,请查看完整内容 documentation
我记得 WAMP 使用 Xdebug 作为线程安全扩展,你应该试试 替换
zend_extension="C:\wamp64\bin\php\php5.6.35\zend_ext\php_xdebug-2.5.5-5.6-vc11-x86_64.dll"
来自
zend_extension_ts="C:\wamp64\bin\php\php5.6.35\zend_ext\php_xdebug-2.5.5-5.6-vc11-x86_64.dll"
并检查您是否下载了正确版本的 Xdebug(线程安全)
然后重启wamp,看看有没有什么变化。
编辑: 你的 PHP.ini 有问题,你没有修改正确的。我用这个成功了:
; XDEBUG Extension zend_extension = "C:\wamp\bin\php\php7.0.4\zend_ext\php_xdebug-2.4.0-7.0-vc14-x86_64.dll" ;
[xdebug]
xdebug.remote_enable=1
xdebug.idekey = "PHPSTORM"
xdebug.remote_autostart= on
xdebug.remote_connect_back= 1
xdebug.remote_host="127.0.0.1"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
xdebug.remote_mode=req
xdebug.profiler_enable = 0
xdebug.profiler_output_dir = "c:/wamp/tmp/"
xdebug.collect_params = On
xdebug.show_local_vars = On`
未保存的原因是在 wamp
上您必须将配置存储在 C:\wamp64\bin\apache\apache_VERSION\bin\php.ini
而不是 C:\wamp64\bin\php\php_VERSION\php.ini
。
我使用 Notepad++ 在整个 wamp/bin/php
文件夹中搜索了字符串 xdebug
,这就是我找到它的方式。