centos 下安装xdebug以便netbeans调试PHP

来源:互联网 发布:怎么开通淘宝直通车 编辑:程序博客网 时间:2024/04/30 07:08

xdebug官方网站没有.tar.gz的文件,只有源码,那就只能源码安装了,下载源码之后

得到的文件夹里readme有这样一段话

You need to compile Xdebug separately from the rest of PHP.  Note, however,
that you need access to the scripts "phpize" and "php-config".  If your
system does not have "phpize" and "php-config", you will need to compile
and install PHP from a source tarball first, as these script are
by-products of the PHP compilation and installation processes. It is
important that the source version matches the installed version as there
are slight, but important, differences between PHP versions.

Once you have access to "phpize" and "php-config", do the following:

看来还必须源码安装php,从而得到phpize(扩展php模块用的工具)

下载php源码,解压缩.configure 的时候出现

./configure --prefix=/usr/local/php --with-apxs=/usr/local/apache --with-mysql
configure: error: xml2-config not found. Please check your libxml2 installation.

yum search xml2 并安装之,之后make&&make install

安装完毕进入xdebug目录执行folder/phpize

出现

Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

yum search autoconf

yum install之

之后在xdebug目录下phpize

之后 ./configure --enable-xdebug

make&& make install

安装完毕

在/usr/local/lib64/extensions/no-debug-non-zts-20090626下出现了一个xdebug.so

这个就是我想要的

之后,php就支持了xdebug

配置完成之后,往往会出现netbeans无法连接到xdebug的情况,我的php.ini 关于xdebug的配置如下

zend_extension ="/usr/local/lib64/extensions/no-debug-non-zts-20090626/xdebug.so"
[Xdebug]
xdebug.profiler_enable=off
xdebug.profiler_enable_trigger = off
xdebug.trace_output_dir="/usr/local/php5/xdebug/"
xdebug.profiler_output_dir="/usr/local/php5/xdebug/"
xdebug.remote_enable=on       
xdebug.remote_handler=dbgp
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000

这里注意端口,是9000,要和netbeans的php设置中的调试界面中的端口设置要一样,另外phpinfo()之后,可以看到有个IDE Key,这个和netbeans中php中调试中的会话ID一致,我的netbeans连接不上xdebug是因为我的端口号设错了,一般来说,完成这些步骤,应该就可以在netbeans中调试PHP了。


0 0
原创粉丝点击