问题描述
我刚刚从官方网站上安装了最新的PHP 5.6 XAMPP,并且需要启用Xdebug,我发现C:\xampp\php\ext
中存在文件php_xdebug.dll
,但是在[XDebug]
中没有配置全部在php.ini
中,我不知道如何使它工作.它应该默认安装并预先配置,我们只需要取消注释php.ini
中的xdebug配置,但事实并非如此.我什至尝试使用PECL
commmand pecl install xdebug
再次安装它,但出现以下错误:
I've just installed the latest XAMPP for PHP 5.6 from the official website, and I need to enable Xdebug, I find that the file php_xdebug.dll
exists in the C:\xampp\php\ext
, but there is no [XDebug]
config at all in the php.ini
and I have no idea how to make it work. It should be installed by default and pre-configured, we need just to uncomment the xdebug config in php.ini
but it's not the case. I even tried to install it again using PECL
commmand pecl install xdebug
but I get the following error :
pecl install xdebug
downloading xdebug-2.5.0.tgz ...
Starting to download xdebug-2.5.0.tgz (267,640 bytes)
.........done: 267,640 bytes
ERROR: failed to mkdir C:\php\pear\docs\xdebug\contrib
在PHPStorm中,当我选择通过在XAMPP目录中选择php.exe
添加解释器时,它也显示为Debugger : Not installed
.
And in PHPStorm when I choose to add the interpreter by selecting the php.exe
in the XAMPP directory, it says Debugger : Not installed
too.
我重新安装了XAMPP,但仍然存在相同的问题.预先感谢.
I re-installed XAMPP, but I still have the same problem.Thanks in advance.
推荐答案
有关更多详细信息,您可以找到逐步解释操作步骤的教程. php-debugging-with-xdebug-atom-and -xampp
For more details, you can find a tutorial that explains step by step procedurephp-debugging-with-xdebug-atom-and-xampp
按照本教程的内容,请按照以下步骤操作,就像魅力一样:
As per this tutorial please follow these steps its works like a charm:
安装Xdebug的步骤:
- 下载 xdebug-2.4.0.tgz
-
解压缩下载的文件
- Download xdebug-2.4.0.tgz
Unpack the downloaded file
# navigate to the downloaded file
$ cd ~/Downloads
$ tar -xvzf xdebug-2.4.0.tgz
$ cd xdebug-2.4.0
运行phpize
run phpize
$ phpize
# example output
Configuring for:
PHP Api Version: 20131106
Zend Module Api No: 20131226
Zend Extension Api No: 220131226
#Error possibilty
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
#In the above error case you need to install autoconf using below command(MAC) and rerun phpize
$ brew install autoconf
phpsize命令用于为以下环境准备构建环境:PHP扩展.
The phpsize command is used to prepare the build environment for aPHP extension.
通过运行对其进行配置:
Configure it by run:
$ ./configure
运行make
run make
$ make
成功安装将创建xdebug.so文件.
A successful install will have created xdebug.so file.
配置Xdebug的步骤:
成功安装将创建xdebug.so并将其放入PHP扩展目录.
A successful install will have created xdebug.so and put it into the PHP extensions directory.
-
您必须为此将该文件复制到XAMPP php扩展目录运行:-
You must copy this file to XAMPP php extension directory for thatrun:-
$ sudo cp modules/xdebug.so /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20160303
最后更新/Applications/XAMPP/xamppfiles/etc/php.ini
并添加以下几行
Finally update /Applications/XAMPP/xamppfiles/etc/php.ini
and addthe following lines to it
[Xdebug]
zend_extension = /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so
xdebug.remote_enable=1
xdebug.remote_connect_back=On
xdebug.remote_port="9000"
xdebug.profiler_enable=0
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_autostart=true
恭喜!你已经完成了!为了确认您已成功安装&配置XDebug,在Web浏览器中打开XAMPP phpinfo.php文件,例如, http://localhost/dashboard/phpinfo.php .
Congratz! You have completed!! To verify you successfully installed & configured XDebug, open the XAMPP phpinfo.php file in a web browser, for example, http://localhost/dashboard/phpinfo.php.
- 在PHPInfo详细信息中搜索XDebug部分.如果存在,则说明您已成功完成安装或
- 在另一个浏览器窗口或标签中,打开 https://xdebug.org/wizard.php 并在第一个窗口或选项卡中复制phpinfo.php页面内容,并将其粘贴到xdebug.org页面上的文本框中.然后提交进行分析,它将提供您的安装状态摘要.
- Search for XDebug section in PHPInfo details. If it exists, you successfully have done your installationOR
- In another browser window or tab, open https://xdebug.org/wizard.php and copy the phpinfo.php page content in the first window or tab and paste it into the textbox on the xdebug.org page. Then submit for analysis, it will give a summary of your installation status.
这篇关于XAMPP中的php.ini中缺少XDebug配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!