Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP Xdebug on OS X 10.9 Mavericks

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?

like image 728
greyfox Avatar asked Oct 25 '13 01:10

greyfox


1 Answers

The fast copy-paste way

sudo sh -c 'echo zend_extension=$(find /usr/lib/php/extensions -name "xdebug.so") >> $(php -qr "echo php_ini_loaded_file();") && apachectl restart' 

This command do the following :

  • Finds the native Xdebug extension that comes with Xcode
  • Asks php which config file is loaded
  • Adds the Xdebug extension path in the config file
  • Restarts apache.

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

like image 193
Creaforge Avatar answered Oct 03 '22 19:10

Creaforge