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

This post is about FreeBSD, however the idea is about the same for other Unix systems.

While I tried to install memcached, the system complained with this message:

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

This problem is caused by missing couple variables at the shell level: PHP_AUTOCONF, PHP_AUTOHEADER. It is very easy to solve this problem:

1. First, make sure that Autoconf is installed in your system:

#pkg_info | grep autoconf
autoconf-2.68       Automatically configure source code on many Un*x platforms
autoconf-wrapper-20071109 Wrapper script for GNU autoconf

If autoconf is not available, install it from here:

cd /usr/ports/devel/autoconf268
make install clean

2. Now, we need to set couple variables. This step is very important because you can’t set the variable using sudo export x=y. First, switch to root

sudo su

3. Find out where is autoconf (The location in FreeBSD and Linux are different)

which autoconf

4. Set the autoconf, in my case, it is /usr/local/bin/autoconf

export PHP_AUTOCONF=/usr/local/bin/autoconf

5. Do the same thing for autoheader:

which autoheader
export PHP_AUTOHEADER=/usr/local/bin/autoheader

That’s it. Now try to install your software again and the error message should be gone.

–Derrick

Our sponsors:

4 comments

  1. Thanks for your post, but i’m still having trouble getting it to work, below is the message:
    Cannot find autoconf. Please check your autoconf installation and the
    $PHP_AUTOCONF environment variable. Then, rerun this script.

    I’ve checked the env vars and those match the correct path.

  2. I had this error trying to install php5-mysql on a recent upgrade to mysql 5.6.3.1 on FreeBSD8.2. I found that sym links autoconf and autoheader had not been provided in /usr/local/bin, so did

    # ln -s autoconf-2.68 /usr/local/bin/autoconf
    # ln -s autoheader-2.68 /usr/local/bin/autoheader

    worked fine after that:

    gluon# make install clean
    ===> php5-mysql-5.3.6_1 depends on file: /usr/local/bin/phpize – found
    ===> php5-mysql-5.3.6_1 depends on file: /usr/local/bin/autoconf-2.68 – found
    ===> PHPizing for php5-mysql-5.3.6_1
    Configuring for:
    PHP Api Version: 20090626
    Zend Module Api No: 20090626
    Zend Extension Api No: 220090626
    configure.in:3: warning: prefer named diversions
    configure.in:3: warning: prefer named diversions
    ===> Configuring for php5-mysql-5.3.6_1

Leave a Reply

Your email address will not be published. Required fields are marked *