20+ common PHP compilation errors and fix – Unix

PHP compilation errors.

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 customisation. That means you can customise your own PHP with custom modules.

There’re a lot of dependencies 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.

There’re chances to get a lot of error while compiling the PHP. See some common PHP compilation errors and their fixes.


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


yum install bzip2-devel


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/


yum install curl-devel


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.


yum install libpng-devel


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).


yum install db4-devel


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

configure: error: freetype.h not found.


Fix: Reconfigure your PHP with the following option.


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


yum install libXpm-devel


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


yum install gmp-devel


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.


yum install libc-client-devel


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


yum install openldap-devel


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!


yum install unixODBC-devel


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


yum install postgresql-devel


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


yum install sqlite-devel


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


yum install aspell-devel


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.


yum install net-snmp-devel


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


yum install libxslt-devel


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


yum install libxml2-devel


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


yum install pcre-devel


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


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
make install
ln -s /usr/local/lib/libidn.la /usr/lib/libidn.la


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


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 install


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


yum install t1lib-devel.x86_64


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


yum install libmcrypt-devel.x86_64


configure: error: Cannot find libtidy


yum install libtidy libtidy-devel

That’s it 🙂

How to enable allow_url_fopen, allow_url_include on a shared server using custom php.ini

You can simply enable/disable the php functions allow_url_include and allow_url_fopen by editing the php configuration file.

These functions may disabled in the php configuration file of some shared hosting server. You can simply manage these function by creating a custom php.ini file under your public folder. READ MORE..

Post navigation

Arunlal A

Senior System Developer at Zeta. Linux lover. Traveller. Let's connect! Whether you're a seasoned DevOps pro or just starting your journey, I'm always eager to engage with like-minded individuals. Follow my blog for regular updates, connect on social media, and let's embark on this DevOps adventure together! Happy coding and deploying!

41 thoughts on “20+ common PHP compilation errors and fix – Unix

  1. You skipped instructions after:

    configure: error: jpeglib.h not found.

    The answer is:

    yum install libjpeg-devel

      1. 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).

  2. 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”

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


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

  4. 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 😀

  5. 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”


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

    Fix: yum install mysql-devel

  7. 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

  8. 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

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

  10. 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

  11. 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!

  12. 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

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

  13. checking how to run the C++ preprocessor… /lib/cpp
    configure: error: in `/root/php-src’:
    configure: error: C++ preprocessor “/lib/cpp” fails sanity check
    See `config.log’ for more details


    yum install gcc-c++

  14. This article was very helpful. Thank you.

    I have found the following error and solution.

    checking for libedit readline replacement… yes
    configure: error: Please reinstall libedit – I cannot find readline.h

    yum install libedit-devel

Leave a Reply

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