Reputation: 275
I am searching the way to debug php scripts. In internet i found information that i can do that with MacGDBp + XDebug. When i'm trying install using PECL in Shell:
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.
Upvotes: 3
Views: 3399
Reputation: 826
For debugging using xdebug i used the following steps
For installing php72 I installed using brew with the following command:
brew install homebrew/php/php72-xdebug
I added the following command to the bottom of the php.ini file:
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 search xdebug
Upvotes: 0
Reputation: 9979
XDebug is available by default. 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)
2) Add these lines at the end (verify the path with 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
4) Verify by php -m | grep xdebug
Upvotes: 9
Reputation: 21
Mike Chamberlain's excellent response almost got xdebug working with NetBeans using Mac OS Sierra 10.12. 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
This was necessary because the precompiled .so file has xdebug remote access disabled. NetBeans and other tools need it to be enabled.
Upvotes: 2