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.

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 🙂

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”
    /usr/include/sqlext.h

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

    –with-unixODBC=/usr

  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”

    -Matt

  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

    hehe
    Att,
    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

    Fix:

    yum install gcc-c++

  14. This article was very helpful. Thank you.

    I have found the following error and solution.

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

    Solution:
    yum install libedit-devel

Leave a Reply

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