I'm having issues setting up my PHP development environment on OS X after installing OS X 10.9 Mavericks.
Here is the command I am using to install.
sudo pecl install xdebug
downloading xdebug-2.2.3.tgz ...
Starting to download xdebug-2.2.3.tgz (250,543 bytes)
.....................................................done: 250,543 bytes
66 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.
ERROR: `phpize' failed
Anyone have a solution or a workaround?
Don't know about using
pecl
. Getting Xdebug after an OS X install is pretty straightforward withoutpecl
. You've got two easy options:Use the version already available at:
Build your own:
Make sure you have the Xcode CLI tools:
xcode-select --install
will prompt you to install the CLI tools. With the CLI tools installed, there should be stuff inside/usr/include/php
.Go to http://xdebug.org/download.php and download the source tarball for the version of Xdebug you want. For example: http://xdebug.org/files/xdebug-2.2.3.tgz.
Extract the tarball and
cd
into the directory it created. Inside that directory you'll see aREADME
. From here it's:Your built
xdebug.so
is now atmodules/xdebug.so
. Thephpize
is critical to do with XCode CLI tools installed, becausephpize
sets up the build parameters for your version of PHP.With your
xdebug.so
in hand from (1) or (2) above, you can add this block to thephp.ini
being used by yourphp
orphp-fpm
:There are two issues here. The first is that you need to install Xcode command line tools with the command:
This will mean that the files previously not found in
/usr/include/php/
will be available.The next step is to install
autoconf
in the same way as Ares shows in his answer.I would
cd
into your download folder firstnow you can run the
pecl install
commandFor the issue phpize error,try this will solve your problem: sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include /usr/include
If you are using Mac Yosemite 10.10 and none of the above answers solved the problem. Do the following:
Open a terminal
Execute
find /usr/lib/php/extensions -name "xdebug.so"
to know the path to the debug library.sudo nano /etc/php.ini
to open and edit the php.ini fileIn php.ini add the following lines at the end
(When finished, type
control+o
to save andcontrol+x
to close the file)(Don't forget to replace the value in zend_extension for whatever you got from the first terminal command)
sudo apachectl restart
to load the new configurationFor anyone who is facing this issue I had to build autoconf from source. I followed this answer from another StackOverflow question.
https://stackoverflow.com/a/12333230/2272004
The fast copy-paste way
This command do the following :
Compatible with Sierra, El Capitan & Yosemite with the bundeled apache, but untested with MAMP & XAMPP.
Before launching the command, make sure Xcode command line tools are installed :
xcode-select --install