简体   繁体   English

MAC OS El Capitan 10.11:安装XDEBUG

[英]MAC OS El Capitan 10.11: Install XDEBUG

I am searching the way to debug php scripts. 我正在寻找调试PHP脚本的方法。 In internet i found information that i can do that with MacGDBp + XDebug . 在互联网上我找到了可以用MacGDBp + XDebug做的信息。 When i'm trying install using PECL in Shell: 当我在Shell中使用PECL进行安装时:

sudo pecl install xdebug

The next error have been occured:

downloading xdebug-2.4.0.tgz ...

Starting to download xdebug-2.4.0.tgz (264,832 bytes)
.....................done: 264,832 bytes

76 source files, building
running: phpize
grep: /usr/include/php/main/php.h: No such file or directory

grep: /usr/include/php/Zend/zend_modules.h: No such file or directory

grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory

Configuring for:
PHP Api Version:

Zend Module Api No:

Zend Extension Api No:

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

Help me find the way to solve that problem. 帮我找到解决问题的方法。

XDebug is available by default. XDebug默认可用。 Just enable it by 只需启用它

1) sudo nano /etc/php.ini (or sudo cp /etc/php.ini.default /etc/php.ini first if the file doesn't yet exist) 1) sudo nano /etc/php.ini (如果该文件尚不存在,则首先是sudo cp /etc/php.ini.default /etc/php.ini

2) Add these lines at the end (verify the path with ls ls /usr/lib/php/extensions/ ) 2)在末尾添加这些行(使用ls ls /usr/lib/php/extensions/验证路径)

[Xdebug]
zend_extension="/usr/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so"

3) Restart apache using sudo apachectl restart 3)使用sudo apachectl restart重启apache

4) Verify by php -m | grep xdebug 4)通过php -m | grep xdebug验证 php -m | grep xdebug

Mike Chamberlain's excellent response almost got xdebug working with NetBeans using Mac OS Sierra 10.12. Mike Chamberlain的出色反应几乎让xdebug使用Mac OS Sierra 10.12与NetBeans合作。 Only two changes required: In step 2, after zend_extension="/usr/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so" also add xdebug.remote_enable=1 只需要进行两项更改:在步骤2中,在zend_extension =“/ usr / lib / php / extensions / no-debug-non-zts-20131226 / xdebug.so”之后还添加xdebug.remote_enable = 1

This was necessary because the precompiled .so file has xdebug remote access disabled. 这是必要的,因为预编译的.so文件禁用了xdebug远程访问。 NetBeans and other tools need it to be enabled. NetBeans和其他工具需要启用它。

For debugging using xdebug i used the following steps 对于使用xdebug进行调试,我使用了以下步骤

For installing php72 I installed using brew with the following command: 为了安装php72,我使用brew安装了以下命令:

brew install homebrew/php/php72-xdebug

I added the following command to the bottom of the php.ini file: 我将以下命令添加到php.ini文件的底部:

zend_extension=/usr/local/Cellar/php72-xdebug/2.6.0/xdebug.so

Note: if you need to search for a version of xdebug with brew use: 注意:如果您需要搜索使用brew的xdebug版本:

brew search xdebug

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM