Contents
- Top 27 common PHP compilation error and solutions
-
Top 27 common PHP compilation error and solutions
- 1. Error bzip
- 2. Error ‘cURL’
- 3. Error ‘png.h’
- 4. Error ‘db4’
- 5. Error ‘xpm’
- 6. Error ‘libXpm’
- 7. Error ‘gmp’
- 8. Error ‘libc’
- 9. Error ‘ldap’
- 10. Error ‘unixODBC’
- 11. Error ‘postgresql’
- 12. Error ‘sqlite’
- 13. Error ‘aspell’
- 14. Error ‘net-snmp’
- 15. Error ‘libxslt-devel’
- 16. Error ‘libxml’
- 17. Error ‘pcre-devel’
- 18. Error ‘libidn’
- 19. Error ‘libxml2.la’
- 20. Error ‘t1lib’
- 21. Error ‘mcrypt.h:
- 22. Error ‘libtidy’
- 23. Error ‘jpeglib.h’
- 24. Error ‘mysql-devel’
- 25. Error ‘libicu’
- 26. Error ‘recode.h’
- 27. Error ‘mm’
-
Top 27 common PHP compilation error and solutions
Top 27 common PHP compilation error and solutions
With the article you are prepared to read, I will present the content ‘27 common PHP compilation error and solutions‘ to handle them.
Installing php by compiling source PHP is not easy like installing with ‘yum‘ repo. The advantage of compilation is you can customize PHP version with different modules that you need or do not need. On the other hand that also make PHP is compatible with more systematic.
I will list below 27 common errors arise when compiling PHP source and processing solutions by installing the appropriate library package. I hope you will find ways to handle errors that you encounter in this article.
If you are so lazy to find the solution to handle your issue when PHP compilation in many times, you can use this command to install almost necessary php librarys.
Note:
– Only install the packages on CentOS / Fedora / RHEL because packages name will be different if you install on Ubuntu / Debian.
Installing almost necessary library for PHP compilation :
# yum groupinstall "Development Tools" -y # yum install -y libcurl* libstdc++44-devel bzip2-devel bzip2 curl-devel curl libpng-devel libpng readline-devel db4-devel freetype-devel libXpm-devel gmp-devel libc-client-devel openldap-devel unixODBC-devel postgresql-devel sqlite-devel aspell-devel net-snmp-devel net-snmp libxslt-devel libxml2-devel pcre-devel t1lib-devel.x86_64 libmcrypt-devel.x86_64 libtidy libtidy-devel libjpeg-devel libjpeg8-dev mysql-devel libicu-devel recode-devel zlib zlib-devel openssl openssl-devel pcre pcre-devel
Top 27 common PHP compilation error and solutions
1. Error bzip
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 bzip2
2. Error ‘cURL’
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 curl
3. Error ‘png.h’
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 libpng
4. Error ‘db4’
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
5. Error ‘xpm’
checking for png_write_image in -lpng… yes If configure fails try –with-xpm-dir= configure: error: freetype.h not found.
Solution:
– Re-configure compiling PHP with option : –with-xpm-dir=/usr
– Install ‘freetype’ lib.
# yum install freetype-devel
6. Error ‘libXpm’
checking for png_write_image in -lpng… yes configure: error: libXpm.(a|so) not found.
Solution:
# yum install libXpm-devel
7. Error ‘gmp’
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
8. Error ‘libc’
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
9. Error ‘ldap’
checking for LDAP support… yes, shared checking for LDAP Cyrus SASL support… yes configure: error: Cannot find ldap.h
Solution:
# yum install openldap-devel
10. Error ‘unixODBC’
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
11. Error ‘postgresql’
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
12. Error ‘sqlite’
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
13. Error ‘aspell’
checking for utsname.domainname… yes checking for PSPELL support… yes configure: error: Cannot find pspell
Solution:
# yum install aspell-devel
14. Error ‘net-snmp’
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 net-snmp
15. Error ‘libxslt-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
Solution:
# yum install libxslt-devel
16. Error ‘libxml’
configure: error: xml2-config not found. Please check your libxml2 installation.
Solution:
# yum install libxml2-devel
17. Error ‘pcre-devel’
checking for PCRE headers location… configure: error: Could not find pcre.h in /usr
Solution:
# yum install pcre-devel
18. Error ‘libidn’
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:
– Download and install ‘libidn’.
# cd /usr/src/ # wget http://ftp.gnu.org/gnu/libidn/libidn-1.33.tar.gz # tar -zvxf libidn-1.33.tar.gz # cd libidn-1.33 # ./configure # make # make install # ln -s /usr/local/lib/libidn.la /usr/lib/libidn.la
19. Error ‘libxml2.la’
libtool: link: `/usr/lib/libxml2.la’ is not a valid libtool archive make: *** [ext/xsl/xsl.la] Error 1
Solution:
– Download and install ‘libxml’.
# cd /usr/src/ # wget ftp://xmlsoft.org/libxml2/libxml2-2.9.4.tar.gz # tar -zvxf libxml2-2.9.4.tar.gz # cd libxml2-2.9.4 # ./configure –prefix=/usr # make # make install
20. Error ‘t1lib’
configure: error: Your t1lib distribution is not installed correctly. Please reinstall it.
Solution:
# yum install t1lib-devel.x86_64
21. Error ‘mcrypt.h:
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
Solution:
# yum install libmcrypt-devel.x86_64
22. Error ‘libtidy’
configure: error: Cannot find libtidy
Solution:
# yum install libtidy libtidy-devel
23. Error ‘jpeglib.h’
checking for fabsf… yes checking for floorf… yes configure: error: jpeglib.h not found.
Solution:
# yum install libjpeg-devel libjpeg8-dev
24. Error ‘mysql-devel’
configure: error: Cannot find MySQL header files under /usr. Note that the MySQL client library is not bundled anymore!
Solution:
# yum install mysql-devel
25. Error ‘libicu’
configure: error: Unable to detect ICU prefix or no failed. Please verify ICU install prefix and make sure icu-config works.
Solution:
# yum install libicu-devel
26. Error ‘recode.h’
configure: error: Can not find recode.h
Solution:
# yum install recode-devel
27. Error ‘mm’
error: cannot find mm library
Solution:
# 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
Very simple to follow and find your solution to deal with your issue when compiling PHP. Comment if you have any questions ?