PHP之安装xdebug

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/backkom_jiu/article/details/78517594

安装xdebug

php要使用断点调试,一般要安装xdebug,下面是一些安装整理

1、检测php

在一个页面,打开phpinfo()的网页信息,并通过检测网页源代码,完整复制粘贴;

上网搜索xdebug,进入官网,点击download,点击custom installation instructions.

将复制的代码粘贴上,进行检测

2、安装xdebug

示例如下:(参考官方文档)

#2.1 下载包
Download xdebug-2.5.4.tgz
#2.2 解压
tar -xvzf xdebug-2.5.4.tgz
 cd xdebug-2.5.4
#2.3 检测
 phpize

As part of its output it should show:

Configuring for:
...
Zend Module Api No:      20160303
Zend Extension Api No:   320160303
##If it does not, you are using the wrong phpize. Please follow this FAQ entry and skip the next step.(上官网看)
#2.4 编译 
./configure
make
#2.5 配置
cp modules/xdebug.so /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303

##Update /usr/local/php/etc/php.ini and change the line
##在php的配置文件里加入扩展
zend_extension = /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so
#2.6 重启
Restart the webserver

3、问题解决

我在编译的时候发现报错如下:

configure: error: Cannot find PHP-config. Please use --with-php-config=PATH
#一般出现这个错误说明你执行 ./configure 时  --with-php-config 这个参数配置路径错误导致的。

解决方法

./configure --with-php-config=/usr/local/php/bin/php-config
#上面的 /usr/local/php/ 是你的 php 安装路径 ,路径完整填写是php-config的路径 
#如何查询路径,可以使用which和whereis

猜你喜欢

转载自blog.csdn.net/backkom_jiu/article/details/78517594