我们首先安装pecl与pear,这是php的插件程序,有助于我们对xdebug的安装,

然后我们安装xdebug,我们要选择合适我们php配置的xebug,我们打开匹配地址 :https://xdebug.org/wizard.php

我们要将php -i的全部信息放入此网站中获取合适的xdebug。

然后配置php.ini

向文件末尾添加:

1
2
3
4
5
6
7
[xdebug]
zend_extension = /usr/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so //这是配置xdebug
xdebug.remote_enable = On  //是否运行远程终端,必须开启
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "localhost"
xdebug.remote_port = 9001 //这个端口号要和phpstorm中的保持一致,示例的端口是9001
xdebug.idekey = PHPSTROM  //调试器关键字