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..
Thank you very much; you saved me on the bzip2 and curl errors!
Thanks Roger. 🙂
You skipped instructions after:
configure: error: jpeglib.h not found.
The answer is:
yum install libjpeg-devel
Quoting… in my case was libjpeg8-dev
Thanks Arun. I got stuck at mysql header and libxslt-devel
🙂
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).
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
Thanks for this update.
thanks..
–with-unixODBC=/usr
Super .. It really helped me in fixing compilation errors.. Very good article i can say .. Thanks much
Thanks for your feedback. I am glad to know this article is helpful to you. 🙂
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 😀
What a lovely article. Really very helpful. Keep doing such a wonderful work.
Thanks Vikash 🙂
This article saved me a bucket load of time – thanks so much!
Thanks for this feedback.
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
configure: error: Cannot find MySQL header files under /usr.
Note that the MySQL client library is not bundled anymore!
Fix: yum install mysql-devel
configure: error: snmp.h not found. Check your SNMP installation.
Fix: yum install net-snmp net-snmp-devel
This was very helpful, thank you so much.
Glad to hear that, Adeola!
Thanks for sharing this, excellent material! Help a lot
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
…
configure: error: freetype-config not found.
# yum install freetype-devel
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
configure: error: Could not find net-snmp-config binary. Please check your net-snmp installation.
# yum install net-snmp-devel
configure: error: Can not find recode.h
# yum install recode-devel -y
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
Awesome, this totally solved my problems!!!
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!
Nice to hear 🙂
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 )
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
Thank you!
Really saved a lot of trouble..
configure: error: png.h not found.
was the issue 🙂
thank you
You’re most welcome, Usman!
I installed openlitespeed your way. Thank you.
You’re most welcome!!
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++
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