Skip to content

Instantly share code, notes, and snippets.

@anunay
Last active July 16, 2021 10:52
Show Gist options
  • Star 23 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save anunay/7698181 to your computer and use it in GitHub Desktop.
Save anunay/7698181 to your computer and use it in GitHub Desktop.
Installing AutoConf and Fixing Phpize on OSX 10.9
Installing AutoConf and Fixing Phpize on OSX 10.9
@anunay
Copy link
Author

anunay commented Nov 28, 2013

Installing AutoConf and Fixing Phpize on OSX 10.9

When setting up my development environment on my new Mac (running OSX 10.8) I noticed autoconf was missing. Autoconf is used by phpize to compile php extensions like xdebug and is something I use on a reasonably frequent basis.

The error I got when trying to run php on the xdebug extension was:

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

ERROR: `phpize’ failed

When running previous versions of OSX autoconf has either been included (<10.6) or available by installing xcode and the development command line tools. However after installing the latest version of xcode (4.3) I found autoconf absent from there as well!

The solution I came up with was to compile autoconf from source and set the environment variable which points to autoconf required by phpize.

Download autoconf
curl http://ftp.gnu.org/gnu/autoconf/autoconf-latest.tar.gz > autoconf.tar.gz

Untar the autoconf archive
tar -xvzf autoconf.tar.gz

Configure and make – note the folder un-archived may have a different name.
cd autoconf-2.69
./configure
sudo make && sudo make install

This installs autoconf to ‘/usr/local/bin/autoconf’. In order to get phpize to work set the PHP_AUTOCONF environment variable to point to the newly installed autoconf.

export PHP_AUTOCONF=/usr/local/bin/autoconf

Running phpize when attempting to compile a php extension should now work.

@danieljordi
Copy link

thanks for this. might want to rename your topic from phpsize to phpize.

@fruityfred
Copy link

Thank you very much!

@kaiye
Copy link

kaiye commented Mar 19, 2015

thanks , it helped me install php redis extension for ampps ~

@elazafranjusticiero
Copy link

thanksss!!!

@bsgreenb
Copy link

Most helpful result I found

@irishIwasDrinking
Copy link

Nice, worked great.

@seromenho
Copy link

Thank you!

@jerrylau91
Copy link

Thanks so much! Help a lot when I install my php redis extension.

@doertydoerk
Copy link

Thanks, mate. Very helpful!

Copy link

ghost commented Jan 7, 2016

-bash: autoconf.tar.gz: Permission denied :(

@JavierCabezas
Copy link

This really helped me out, thanks!

@philhamble
Copy link

Brilliant - worked for me on El Capitan. Thanks.

@moo-im-a-cow
Copy link

quicker way of doing this: (using homebrew)
brew install autoconf
if you dont have homebrew, i strongly recomend getting it from http://brew.sh/

@nandakumardevadas
Copy link

Great. Life saver.

@Press4Ward
Copy link

I'm new to this field and this was definitely helpful to me. Thanks so much!!!

@shirakaba
Copy link

Note: even if you are using brew install autoconf, you will still need to manually export the $PHP_AUTOCONF environment variable, using: export PHP_AUTOCONF=/usr/local/bin/autoconf.

@ztz12
Copy link

ztz12 commented Jul 9, 2019

thank you very match

@anunay
Copy link
Author

anunay commented Jul 9, 2019

thanks for this. might want to rename your topic from phpsize to phpize.

Good catch, I did that :)

@StefanXiepj
Copy link

Cool, thank you very much, most helpful result i foud.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment