Mac ,phpstorm下xdebug扩展安装

安装xdebug

curl https://xdebug.org/files/xdebug-2.6.0.tgz -O xdebug-2.6.0.tgz

如果上面的命令执行失败可用,以下括号内命令执行

sudo wget https://www.xdebug.org/files/xdebug-2.6.0.tgz -O xdebug-2.6.0.tgz

或者

wget https://xdebug.org/files/xdebug-2.6.0.tgz;

解押文件

tar zxvf xdebug-2.6.0.tgz

cd xdebug-2.6.0

然后处理初始化phpize,不执行phpize ,make可能会执行失败

 /usr/local/php5-5.6.36-20180703-123509/bin/phpize

例如:

./configure --with-php-config=有效php-config地址 --enable-xdebug

例如:

查看php-config

whereis php-config

which php :这个是查看正在运行的 ,如果php不对,后面的安装也不对

(不需要管我使用的是哪个版本的xdebug,因为之前的版本不合适)

使用正常运行的PHP

./configure --enable-xdebug --with-php-config=/usr/local/php5-5.6.36-20180703-123509/bin/php-config

如果执行上面的语句报错

configure: error: Cannot find PHP-config. Please use --with-php-config=PATH

但实际路径存在,可以把xdebug卸载了,重新安装或者路径错误。

如果出现下面这句,这说明版本不对,需要重新下载xdebug,并满足PHP的版本

checking Check for supported PHP versions... configure: error: not supported. Need a PHP version >= 7.0.0 and < 7.3.0 (found 5.6.36)

执行完后

make

sudo make install

配置php.ini

消除影响json 输出的

error_reporting=E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE & ~E_WARNING

在php.ini中加入xdebug配置


[xdebug]
;zend_extension="刚刚的xdebug路径/xdebug.so" 在install  make后的输出代码中可找到此路径 
zend_extension="/usr/local/php5/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so"
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.idekey = PHPSTORM
xdebug.remote_handler = dbgp
xdebug.remote_host= localhost
xdebug.remote_connect_back = 1
;默认的9000已经被php-fpm占用了,切记换一个端口
xdebug.remote_port = 9002
xdebug.scream = 0
xdebug.show_local_vars = 1

zend_extension:

重启一下php-fpm和nginx,看一下php是不是都正常跑起来了.

在php项目中地址中访问 i.php文件,查看xdebug是否配置成功,如果没有则说明配置失败。

i.php文件没有可查看:https://mp.csdn.net/postedit/81112321

配置phpstorm

phpstorm  -》perferences -》languages&frameworks -》 PHP -》debug

project files 与service的地址应相同

以上信息配置完成后,可验证是否配置成功

启动phpstorm的调试debug

启动成功后,打断点,访问项目,看是否调试成功。

猜你喜欢

转载自blog.csdn.net/PT1993/article/details/81199218