20+ common PHP compilation errors and fix – Unix

Compiling PHP is not an easy process by comparing with the installation of PHP using package managers like Yum or Apt-get. The main advantage of compiling PHP from its source code is the customization. That means you can customize your own PHP with custom modules. A lot of dependencies are required for the compilation of PHP from its source code. By using package manager the dependencies are automatically detected and install with the corresponding package. Here I am listing some common PHP compilation error and fix. This will helpful for compiling PHP on your server.

Php compilation on server means the building and installation of PHP from its source. You may get a lot of error while compiling the PHP, here I am listing some common PHP compilation errors and their fixes.

ERROR I :

checking for BZip2 support… yes
checking for BZip2 in default path… not found
configure: error: Please reinstall the BZip2 distribution

Solution:

yum install bzip2-devel

ERROR II :

checking for cURL support… yes
checking if we should use cURL for url streams… no
checking for cURL in default path… not found
configure: error: Please reinstall the libcurl distribution -
easy.h should be in /include/curl/

Solution:

yum install curl-devel

ERROR III :

checking for fabsf… yes
checking for floorf… yes
configure: error: jpeglib.h not found.

checking for fabsf… yes
checking for floorf… yes
checking for jpeg_read_header in -ljpeg… yes
configure: error: png.h not found.

Solution:

yum install libpng-devel

ERROR IV :

checking for curl_multi_strerror in -lcurl… yes
checking for QDBM support… no
checking for GDBM support… no
checking for NDBM support… no
configure: error: DBA: Could not find necessary header file(s).

Solution:

yum install db4-devel

ERROR V :

checking for png_write_image in -lpng… yes
If configure fails try –with-xpm-dir=

configure: error: freetype.h not found.

Solution:

Fix: Reconfigure your PHP with the following option.
–with-xpm-dir=/usr

ERROR VI :

checking for png_write_image in -lpng… yes
configure: error: libXpm.(a|so) not found.

Solution:

yum install libXpm-devel

ERROR VII :

checking for bind_textdomain_codeset in -lc… yes
checking for GNU MP support… yes
configure: error: Unable to locate gmp.h

Solution:

yum install gmp-devel

ERROR VIII :

checking for utf8_mime2text signature… new
checking for U8T_DECOMPOSE…
configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.

Solution:

yum install libc-client-devel

ERROR IX :

checking for LDAP support… yes, shared
checking for LDAP Cyrus SASL support… yes
configure: error: Cannot find ldap.h

Solution:

yum install openldap-devel

ERROR X :

checking for mysql_set_character_set in -lmysqlclient… yes
checking for mysql_stmt_next_result in -lmysqlclient… no
checking for Oracle Database OCI8 support… no
checking for unixODBC support… configure: error: ODBC header file ‘/usr/include/sqlext.h’ not found!

Solution:

yum install unixODBC-devel

ERROR XI :

checking for PostgreSQL support for PDO… yes, shared
checking for pg_config… not found
configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path

Solution:

yum install postgresql-devel

ERROR XII :

checking for sqlite 3 support for PDO… yes, shared
checking for PDO includes… (cached) /usr/local/src/php-5.3.7/ext
checking for sqlite3 files in default path… not found
configure: error: Please reinstall the sqlite3 distribution

Solution:

yum install sqlite-devel

ERROR XIII:

checking for utsname.domainname… yes
checking for PSPELL support… yes
configure: error: Cannot find pspell

Solution:

yum install aspell-devel

ERROR XIV :

checking whether to enable UCD SNMP hack… yes
checking for default_store.h… no

checking for kstat_read in -lkstat… no
checking for snmp_parse_oid in -lsnmp… no
checking for init_snmp in -lsnmp… no
configure: error: SNMP sanity check failed. Please check config.log for more information.

Solution:

yum install net-snmp-devel

ERROR XV :

checking whether to enable XMLWriter support… yes, shared
checking for xml2-config path… (cached) /usr/bin/xml2-config
checking whether libxml build works… (cached) yes
checking for XSL support… yes, shared
configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution

Solution:

yum install libxslt-devel

ERROR XVI :

configure: error: xml2-config not found. Please check your libxml2 installation.

Solution:

yum install libxml2-devel

ERROR XVII :

checking for PCRE headers location… configure: error: Could not find pcre.h in /usr

Solution:

yum install pcre-devel

ERROR XVIII :

libtool: link: cannot find the library `/usr/lib/libidn.la’ or unhandled argument `/usr/lib/libidn.la’
make: *** [sapi/cgi/php-cgi] Error 1

Solution:

cd /usr/src/
wget http://ftp.gnu.org/gnu/libidn/libidn-1.26.tar.gz
tar -zvxf libidn-1.26.tar.gz
cd libidn-1.26
./configure
make
make install
ln -s /usr/local/lib/libidn.la /usr/lib/libidn.la

ERROR XIX :

libtool: link: `/usr/lib/libxml2.la’ is not a valid libtool archive
make: *** [ext/xsl/xsl.la] Error 1

Solution:

cd /usr/src/
wget ftp://xmlsoft.org/libxml2/libxml2-2.7.3.tar.gz
tar -zvxf libxml2-2.7.3.tar.gz
cd libxml2-2.7.3
./configure –prefix=/usr
make
make install

ERROR XX :

configure: error: Your t1lib distribution is not installed correctly. Please reinstall it.

Solution:

yum install t1lib-devel.x86_64

ERROR XXI:

configure: error: mcrypt.h not found. Please reinstall libmcrypt.

Solution:

yum install libmcrypt-devel.x86_64

ERROR XXII :

configure: error: Cannot find libtidy

Solution:

yum install libtidy libtidy-devel

That’s it 🙂

Arunlal Ashok

Linux Server Administrator. I'm dealing with Linux servers since 2012. I started this blog to share and discuss my ideas with the world. Check My Profile!! in uPwork (oDesk) and let me know if you need any assistance. Thanks!!

You may also like...

39 Responses

  1. Roger says:

    Thank you very much; you saved me on the bzip2 and curl errors!

  2. Eugene van der Merwe says:

    You skipped instructions after:

    configure: error: jpeglib.h not found.

    The answer is:

    yum install libjpeg-devel

  3. Rahul Monde says:

    Thanks Arun. I got stuck at mysql header and libxslt-devel

      • Miguel says:

        Thank you so much, you saved me from lots of trouble I’m having while I’m trying to compile PHP from source on Debian, it seems that your tutorial was meant for CentOS users. But I was wondering if I could share with you the problems I had with your error VI and how I found the solution (I got stuck for many many hours trying to get by this one only, lots of libXpm.so|a not found or freetype.h not found while playing with –with-xpm-dir and –with-vpx-dir options). Due to the fact that I’m compiling on Debian the name of the packages change a little bit. Maybe you could add those solutions onto your tutorial. (2 symbolic links created and two packages installed made me get by this).

  4. Rob Bates says:

    Thanks for this, saved me a lot of head banging against a wall, however I’m stuck at this point

    # yum install unixODBC-devel
    Package unixODBC-devel-2.2.14-12.el6_3.x86_64 already installed and latest version
    Nothing to do

    # ./configure…

    checking for unixODBC support… configure: error: ODBC header file ‘/usr/local/include/sqlext.h’ not found!

    # find / -name “sqlext.h”
    /usr/include/sqlext.h

    And as I typed this I realised the problem so I set

    –with-unixODBC=/usr

  5. PERI VENKATA RAMANA says:

    Super .. It really helped me in fixing compilation errors.. Very good article i can say .. Thanks much

  6. koosah says:

    Say
    + average of 5 mins for 19 yum installations
    + average of 15 minutes downloading and compiling other source files for those 2
    = 125minutes
    ~= 2 HOURS!

    Congrats! You saved 2 hours of many many people including me 😀

  7. Vikash Dhiman says:

    What a lovely article. Really very helpful. Keep doing such a wonderful work.

  8. Josh O' says:

    This article saved me a bucket load of time – thanks so much!

  9. Matt says:

    Hi Arun,

    I have built php many times before, but am having issues with making php 5.6 my Centos 7 machine, and get this error:

    “In file included from /home/Matt/php-5.6.2/ext/zip/lib/zip_add.c:37:0:
    /home/Matt/php-5.6.2/ext/zip/lib/zipint.h:118:2: error: #error unsupported size of off_t
    #error unsupported size of off_t”

    -Matt

  10. Leo says:

    configure: error: Cannot find MySQL header files under /usr.
    Note that the MySQL client library is not bundled anymore!

    Fix: yum install mysql-devel

  11. Leo says:

    configure: error: snmp.h not found. Check your SNMP installation.

    Fix: yum install net-snmp net-snmp-devel

  12. Adeola says:

    This was very helpful, thank you so much.

  13. Luís Felipe says:

    Thanks for sharing this, excellent material! Help a lot

  14. Taras says:

    I’ve solved the following ./configure error:
    checking for T1lib support… no
    checking whether to enable truetype string function in GD… yes
    checking whether to enable JIS-mapped Japanese font support in GD… no
    checking for fabsf… yes
    checking for floorf… yes
    configure: error: jpeglib.h not found.

    By installing:
    # yum install libjpeg-devel

  15. Taras says:


    configure: error: freetype-config not found.
    # yum install freetype-devel

  16. Taras says:

    configure: error: Unable to detect ICU prefix or no failed. Please verify ICU install prefix and make sure icu-config works.

    # yum install libicu-devel

  17. Taras says:

    configure: error: Could not find net-snmp-config binary. Please check your net-snmp installation.
    # yum install net-snmp-devel

  18. faina09 says:

    configure: error: Can not find recode.h

    # yum install recode-devel -y

  19. Firas says:

    am facing this error and not sure how to solve it 🙁

    checking for recode support… yes
    checking for recode_format_table in -lrecode… no
    configure: error: I cannot link librecode (-L/usr/lib -lrecode). Is it installed?

    i have installed the package through yum both recode and recode-devel but same issue keeps coming
    any help is much appreciated

  20. jmattke says:

    Awesome, this totally solved my problems!!!

  21. Karen says:

    This list was a lifesaver! I got about a dozen errors, but they were all on this page somewhere (a few were in the comments), and all the solutions were spot-on!

  22. Cornélio José Wiedemann says:

    oieeeeeee
    muito tksss gatuuu

    otimo post
    perfeito article

    cara, demais mesmo
    eu e o sasa lemos todo ele
    o sargento nego drama, jair, jose e o jalmar
    curtindo muito e fizeram a dançinha do romano

    hehe
    Att,
    Tio Nélio Do Rincão ( TI & DBA )

  23. Ira says:

    error: cannot find mm library

    #wget http://pkgs.fedoraproject.org/repo/pkgs/mm/mm-1.4.2.tar.gz/bdb34c6c14071364c8f69062d2e8c82b/mm-1.4.2.tar.gz

    tar -zxvf mm-1.4.2.tar.gz

    ./configure

    make

    make install

  24. Usman Nasir says:

    Really saved a lot of trouble..

    configure: error: png.h not found.

    was the issue 🙂

    thank you

  25. rokettube says:

    I installed openlitespeed your way. Thank you.

Leave a Reply

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