我正在使用centos 7和apache服务器,用于VS Code中的远程调试目的,如何在Live GoDaddy VPS服务器中安装和配置xdebug?
PHP版本:5.6
如果您在具有webtactic和epel的centos7中具有php7,则可以使用以下命令安装xdebug
yum install php70w-pecl-xdebug.x86_64
如果您有epel和webtactic,但没有php7,则可以使用以下命令安装xdebug:
yum install php-xdebug
现在,xdebug在您的系统中已经可以配置xdebug了
open /etc/php.d/xdebug.ini in your favourite editor
add the following lines
#this line will be added automatically
zend_extension = /usr/local/lib/php/extensions/xxx/xdebug.so
#add the following
xdebug.remote_log="/tmp/xdebug.log"
xdebug.profiler_enable = 1
xdebug.remote_enable=on
xdebug.remote_port=9000
xdebug.remote_autostart=0
xdebug.remote_connect_back=on
xdebug.idekey=editor-xdebug
如果已安装并运行yum-utils,则可以找到所需文件的正确路径
repoquery --list php70w-pecl-xdebug
# the output is:
/etc/php-zts.d/xdebug.ini
/etc/php.d/xdebug.ini
/usr/bin/debugclient
/usr/lib64/php-zts/modules/xdebug.so
/usr/lib64/php/modules/xdebug.so
/usr/share/doc/php70w-pecl-xdebug-2.4.1
/usr/share/doc/php70w-pecl-xdebug-2.4.1/CREDITS
/usr/share/doc/php70w-pecl-xdebug-2.4.1/LICENSE
/usr/share/doc/php70w-pecl-xdebug-2.4.1/README.rst
/var/lib/pear/pkgxml/xdebug.xml
您现在需要重新启动httpd
service httpd restart
# or
systemctl restart httpd.service
Xdebug现在将启动并运行
如果您在启用SELinux enforement的情况下运行,则可以运行此命令以允许xdebug出:
setsebool -P httpd_can_network_connect 1
Eclipse
eclipse内,转到首选项> php>调试器将调试器更改为xdebug点击配置将“接受远程会话(JIT)”的下拉菜单更改为“任意”或“提示”点击确定Firefox
Xdebug Helper是我为firefox找到的最佳解决方案-只需从此处安装扩展,导航到要调试的站点,然后单击绿色的小bug,选择debug并重新加载页面即可在编辑器调试器中打开。在前面的步骤中,您可能需要添加添加到xdebug.ini的密钥。Chrome
Xdebug Helper是我为chrome找到的最好的解决方案-只需从此处安装扩展程序,导航到要调试的站点,然后单击绿色的小bug,选择debug并重新加载页面即可在编辑器调试器中打开。您可能需要在前面的步骤中添加添加到xdebug.ini的密钥。