安装了php,并存在phpize
下载xdebug
wget https://xdebug.org/files/xdebug-2.7.1.tgz
运行 phpize 发现问题:
phpize
Cannot find config.m4.
Make sure that you run '/usr/local/bin/phpize' in the top level source directory of the module
解决办法:
find / -name openssl
cd /usr/src/php/ext/openssl
cp ./config0.m4 ./config.m4
再运行phpize,OK了。
Configuring for:
PHP Api Version: 20180731
Zend Module Api No: 20180731
Zend Extension Api No: 320180731
解压并进入xdebug目录
tar zvxf xdebug-2.7.1.tgz
cd xdebug-2.7.1
编译并生成.so文件
phpize # 生成configure文件
./configure --enable-xdebug # 配置
make && make install # 编译并生成
复制 xdebug.so模块到指定目录
cd modules/
mkdir /usr/local/webserver/php/modules
cp xdebug.so /usr/local/webserver/php/modules
php配置文件(php.ini)添加如下内容
zend_extension= /usr/local/webserver/php/modules/xdebug.so
xdebug.profiler_enable=on#开启性能监控(一般在正式环境不建议开启)
xdebug.trace_output_dir="/usr/local/webserver/php/xdebug_trace"#程序执行顺序日志
xdebug.profiler_output_dir="/usr/local/webserver/php/xdebug_profiler"#程序执行性能日志
ls /usr/local/etc/php
conf.d php.ini-development php.ini-production
没有php.ini ? 答案在这儿。
bash-4.4# cd /usr/local/etc/php
bash-4.4# mv php.ini-development php.ini