Wiki
Command unknown: diff136448656
 

LSWS PHP/LSAPI Build troubleshooting guide

Preamble

This document log error messages during the php build stage for LiteSpeed Web Server (LSWS) and their relevant fixes. The general PHP/LSAPI build procedures are described in PHP 4/5 with LSAPI Compile/Install How-To. As of this writing, the latest php 5.2.16 is out. The latest LSAPI is at version 5.5. We will use php 5.2.16 and LSAPI 5.5 as an example to build LSPHP.

Procedures

1. Pre-requisites

Make sure all the build tools are installed and ready: patch, gcc, glibc, libstdc++, gcc-c++, binutils, libtool, autoconf, make

CentOS:  yum install patch gcc glibc libstdc++ gcc-c++ binutils libtool autoconf make
CentOS (64bit):  yum install patch.x86_64 gcc.x86_64 glibc.x86_64 libstdc++.x86_64 gcc-c++.x86_64 \
       binutils.x86_64 libtool.x86_64 autoconf.x86_64 make.x86_64
Ubuntu (32bit or 64bit): apt-get install patch gcc glibc libstdc++ gcc-c++ binutils libtool autoconf make

2. Download PHP source and unpack it

# wget -N http://us2.php.net/get/php-5.2.16.tar.gz/from/us.php.net/mirror
# tar -zxf php-5.2.16.tar.gz

3. Download LSAPI source and unpack it

# cd php-5.2.16/sapi
# wget -N http://www.litespeedtech.com/packages/lsapi/php-litespeed-5.5.tgz
# tar -zxf php-litespeed-5.5.tgz

Note: LSAPI 5.5 is shipped with PHP source from PHP 5.3 onward. This step can be skipped if you build PHP 5.3 or above.

4. cd to php source directory and rebuild configure script

# cd ..
# touch ac*
# ./buildconf --force

Possible errors and their fixes

Note: OpenSUSE error fixes are generally the same as the CentOS fixes listed below except that “yum” should be replaced with “zypper”.

Error Message:

Forcing buildconf
./buildconf: line 41: make: command not found

Reason: Missing 'make' program in the build system.

Fix: Install 'make' program.

CentOS:  yum install make
CentOS (64bit):  yum install make.x86_64
Ubuntu (32bit or 64bit): apt-get install make

Error Message:

buildconf: autoconf not found.
      You need autoconf version 2.13 or newer installed
      to build PHP from CVS.
make: *** [buildmk.stamp] Error 1

or

Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

Cause: Missing 'autoconf' program in the build system.

Fix: Install 'autoconf' program.

CentOS: yum install autoconf(.x86_64)
Ubuntu (32bit or 64bit): apt-get install autoconf

Error Message:

Forcing buildconf
buildconf: checking installation...
buildconf: autoconf version 2.59 (ok)
buildconf: Your version of autoconf likely contains buggy cache code.
           Running vcsclean for you.
           To avoid this, install autoconf-2.13.
Can't figure out your VCS, not cleaning.

Cause: 'autoconf' program is buggy in the build system.

Fix: Install 'autoconf213' program.

CentOS: yum install autoconf213(.x86_64)
Ubuntu (32bit or 64bit): apt-get install autoconf2.13

export PHP_AUTOCONF=/usr/bin/autoconf-2.13
export PHP_AUTOHEADER=/usr/bin/autoheader-2.13

Configure/Compilation

4. Configure/Compile PHP with LSAPI (LSPHP)

#  './configure'  '--prefix=/lsphp5' '--with-litespeed' '--with-libdir=lib64' \
'--disable-debug' '--with-pic' '--disable-rpath' '--without-pear' '--with-bz2' '--with-exec-dir=/usr/bin' \
'--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-xpm-dir=/usr' '--enable-gd-native-ttf' '--without-gdbm' '--with-t1lib=/usr' \
'--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-pcre-regex=shared,/usr' \
'--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' \
'--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--with-kerberos' '--enable-ucd-snmp-hack' '--enable-shmop' \
'--enable-calendar' '--without-mime-magic' '--without-sqlite' '--with-libxml-dir=/usr' '--enable-xml' \
'--with-system-tzdata' '--enable-force-cgi-redirect' '--enable-pcntl' '--with-imap=shared' '--with-imap-ssl' \
'--enable-mbstring=shared' '--enable-mbregex' '--with-ncurses=shared' '--with-gd=shared' '--enable-bcmath=shared' \
'--enable-dba=shared' '--with-db4=/usr' '--with-xmlrpc=shared' '--with-ldap=shared' '--with-ldap-sasl' \
'--with-mysql=shared,/usr' '--with-mysqli=shared,/usr/bin/mysql_config' '--enable-dom=shared' '--with-pgsql=shared' \
'--enable-wddx=shared' '--with-snmp=shared,/usr' '--enable-soap=shared' '--with-xsl=shared,/usr' '--enable-xmlreader=shared' \
'--enable-xmlwriter=shared' '--with-curl=shared,/usr' '--enable-fastcgi' '--enable-pdo=shared' '--with-pdo-odbc=shared,unixODBC,/usr' \
'--with-pdo-mysql=shared,/usr' '--with-pdo-pgsql=shared,/usr' '--with-pdo-sqlite=shared,/usr' '--with-pdo-dblib=shared,/usr' \
'--enable-json=shared' '--enable-zip=shared' '--with-readline' '--with-ssh2' '--enable-dbase=shared' '--with-pspell=shared' \
'--with-mcrypt=shared,/usr' '--with-mhash=shared,/usr' '--with-tidy=shared,/usr' '--with-mssql=shared,/usr' '--enable-sysvmsg=shared' \
'--enable-sysvshm=shared' '--enable-sysvsem=shared' '--enable-posix=shared' '--with-unixODBC=shared,/usr'

Note:

  • for 64bit system, '–with-libdir=lib64' should be used in configure option
  • it saves quite a bit of time to get all needed packages installed in one shot instead of going through each error and fix them. For the example compile options above, just issue the following command to get all the needed packages installed.

CentOS 5:

yum install libxml2-devel openssl-devel bzip2-devel curl-devel  db4-devel  libjpeg-devel libpng-devel libXpm-devel \
freetype-devel  gmp-devel  libc-client-devel openldap-devel libmcrypt-devel libmhash-devel freetds-devel \
libz-devel mysql-devel ncurses-devel pcre-devel unixODBC-devel postgresql-devel sqlite-devel aspell-devel \
readline-devel recode-devel net-snmp-devel libtidy-devel libxslt-devel t1lib-devel

CentOS 5 x86_64:

yum install libxml2-devel.x86_64 openssl-devel.x86_64 bzip2-devel.x86_64 curl-devel.x86_64  db4-devel.x86_64 \
libjpeg-devel.x86_64 libpng-devel.x86_64 libXpm-devel.x86_64   freetype-devel.x86_64  gmp-devel.x86_64  \
libc-client-devel.x86_64 openldap-devel.x86_64 libmcrypt-devel.x86_64 libmhash-devel.x86_64 freetds-devel.x86_64 \
libz-devel.x86_64 mysql-devel.x86_64 ncurses-devel.x86_64 pcre-devel.x86_64 unixODBC-devel.x86_64 postgresql-devel.x86_64 \
sqlite-devel.x86_64 aspell-devel.x86_64 readline-devel.x86_64 recode-devel.x86_64 net-snmp-devel.x86_64 \
libtidy-devel.x86_64 libxslt-devel.x86_64 t1lib-devel.x86_64

Due to package name change, use followings for CentOS 6. You may need EPEL repository to get them all installed

CentOS 6:

yum install libxml2-devel openssl-devel bzip2-devel libcurl-devel  db4-devel  libjpeg-devel libpng-devel libXpm-devel \
freetype-devel  gmp-devel  libc-client-devel openldap-devel libmcrypt-devel mhash-devel freetds-devel \
zlib-devel mysql-devel ncurses-devel pcre-devel unixODBC-devel postgresql-devel sqlite-devel aspell-devel \
readline-devel recode-devel net-snmp-devel libtidy-devel libxslt-devel t1lib-devel

CentOS 6 x86_64:

yum install libxml2-devel.x86_64 openssl-devel.x86_64 bzip2-devel.x86_64 libcurl-devel.x86_64  db4-devel.x86_64 \
libjpeg-devel.x86_64 libpng-devel.x86_64 libXpm-devel.x86_64   freetype-devel.x86_64  gmp-devel.x86_64  \
libc-client-devel.x86_64 openldap-devel.x86_64 libmcrypt-devel.x86_64 mhash-devel.x86_64 freetds-devel.x86_64 \
zlib-devel.x86_64 mysql-devel.x86_64 ncurses-devel.x86_64 pcre-devel.x86_64 unixODBC-devel.x86_64 postgresql-devel.x86_64 \
sqlite-devel.x86_64 aspell-devel.x86_64 readline-devel.x86_64 recode-devel.x86_64 net-snmp-devel.x86_64 \
libtidy-devel.x86_64 libxslt-devel.x86_64 t1lib-devel.x86_64

Ubuntu:

apt-get install libxml2-dev libssl-dev libbz2-dev libcurl3-dev libdb4.4-dev libjpeg-dev libpng-dev libXpm-dev \
libfreetype6-dev libt1-dev libgmp3-dev libc-client-dev libldap2-dev libmcrypt-dev libmhash-dev freetds-dev libz-dev \
libmysqlclient15-dev ncurses-dev libpcre3-dev unixODBC-dev postgresql-server-dev-8.3 libsqlite-dev libaspell-dev \
libreadline5-dev librecode-dev libsnmp-dev libtidy-dev libxslt-dev libt1-dev

OpenSUSE:

zypper install libxml2-devel openssl-devel bzip2-devel libcurl-devel  db4-devel  libjpeg-devel libpng-devel libXpm-devel \
freetype-devel  gmp-devel  libc-client-devel openldap-devel libmcrypt-devel mhash-devel freetds-devel \
zlib-devel mysql-devel ncurses-devel pcre-devel unixODBC-devel postgresql-devel sqlite-devel aspell-devel \
readline-devel recode-devel net-snmp-devel libtidy-devel libxslt-devel t1lib-devel

OpenSUSE x86_64:

zypper install libxml2-devel.x86_64 openssl-devel.x86_64 bzip2-devel.x86_64 libcurl-devel.x86_64  db4-devel.x86_64 \
libjpeg-devel.x86_64 libpng-devel.x86_64 libXpm-devel.x86_64   freetype-devel.x86_64  gmp-devel.x86_64  \
libc-client-devel.x86_64 openldap-devel.x86_64 libmcrypt-devel.x86_64 mhash-devel.x86_64 freetds-devel.x86_64 \
zlib-devel.x86_64 mysql-devel.x86_64 ncurses-devel.x86_64 pcre-devel.x86_64 unixODBC-devel.x86_64 postgresql-devel.x86_64 \
sqlite-devel.x86_64 aspell-devel.x86_64 readline-devel.x86_64 recode-devel.x86_64 net-snmp-devel.x86_64 \
libtidy-devel.x86_64 libxslt-devel.x86_64 t1lib-devel.x86_64

Possible errors and their fixes

Error Message:

Can not patch Suhosin 

Cause: Program 'patch' is missing on the building server.

Fix: Install 'patch' program

CentOS: yum install patch
CentOS(64bit): yum install patch.x86_64
Ubuntu: apt-get install patch 

Error Message:

Can not make

Cause: Program 'make' is missing on the building server.

Fix: Install 'make' program

CentOS: yum install make
CentOS(64bit): yum install make.x86_64
Ubuntu: apt-get install make

Error Message:

Could not find xml2-config

Cause: configure option '–with-libxml-dir=/usr' used BUT package libxml2-devel is missing.

Fix: Install 'libxml2-devel' package

CentOS: yum install libxml2-devel
CentOS(64bit): yum install libxml2-devel.x86_64
Ubuntu: apt-get install libxml2-devel

Error Message:

Could not find evp.h

Cause: configure option '–with-openssl' used BUT package openssl-devel(.x86_64) is missing .

Fix:

CentOS: yum install openssl-devel
CentOS(64bit): yum install openssl-devel.x86_64 
Ubuntu: apt-get install libssl-dev

Error Message:

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

Cause: configure option '–with-bz2' used BUT bzip2-devel(.x86_64) is missing.

Fix:

     
CentOS: yum install bzip2-devel
CentOS(64bit): yum install bzip2-devel.x86_64 
Ubuntu: apt-get install libbz2-dev

Error Message:

checking for cURL support... yes, shared
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 <curl-dir>/include/curl/
   **ERROR** Could not configure PHP build

Cause: configure option '–with-curl=shared,/usr' used but curl-devel(.x86_64) package is missing

Fix:

CentOS: yum install curl-devel
CentOS(64bit): yum install curl-devel.x86_64 
CentOS 6: yum install libcurl-devel
CentOS 6(64bit): yum install libcurl-devel.x86_64
Ubuntu: apt-get install libcurl3-dev

Error:

configure: error: DBA: Could not find necessary header file(s).
   **ERROR** Could not configure PHP build

Cause: configure with option '–enable-dba=shared' '–with-db4=/usr' one of DB library packages (DB4) is missing

Fix:

CentOS: yum install db4-devel
CentOS(64bit): yum install db4-devel.x86_64 
Ubuntu: apt-get install libdb4.4-dev

Error Message:

If configure fails try --with-jpeg-dir=<DIR>
  configure: error: libpng.(a|so) not found.
  **ERROR** Could not configure PHP build

Cause: configure with option '–with-jpeg-dir=/usr' but libjpeg-devel(.x86_64) package is missing

Fix:

CentOS: yum install libjpeg-devel
CentOS(64bit): yum install libjpeg-devel.x86_64 
Ubuntu: apt-get install libjpeg-dev

Error Message:

configure: error: libpng.(a|so) not found.
**ERROR** Could not configure PHP build

Cause: configure with option '–with-png-dir=/usr' but libpng-devel(.x86_64) package is missing

Fix:

CentOS: yum install libpng-devel
CentOS(64bit): yum install libpng-devel.x86_64
Ubuntu: apt-get install libpng-dev

Error Message:

configure: error: libXpm.(a|so) not found.
**ERROR** Could not configure PHP build

Cause: configure with '–with-xpm-dir=/usr' but libXpm-devel(.x86_64) package is missing

Fix:

CentOS: yum install libXpm-devel
CentOS(64bit): yum install libXpm-devel.x86_64 
Ubuntu: apt-get install libXpm-dev

Error Message:

configure: error: freetype.h not found.
**ERROR** Could not configure PHP build

Cause: configure with '–with-freetype-dir=/usr' but freetype-devel(.x86_64) package is missing

Fix:

CentOS: yum install  freetype-devel
CentOS(64bit): yum install  freetype-devel.x86_64 
Ubuntu: apt-get install libfreetype6-dev

Error Message:

configure: error: Your t1lib distribution is not installed correctly. Please reinstall it.
**ERROR** Could not configure PHP build

Cause: configure with '–with-t1lib=/usr' but t1lib-devel(.x86_64) package is missing

Fix:

CentOS: yum install  t1lib-devel
CentOS(64bit): yum install  t1lib-devel.x86_64 
Ubuntu: apt-get install libt1-dev

Error Messages:

configure: error: Unable to locate gmp.h
**ERROR** Could not configure PHP build

Cause: configure with '–with-gmp' but gmp-devel(.x86_64) package is missing

Fix:

CentOS: yum install   gmp-devel
CentOS(64bit): yum install   gmp-devel.x86_64
Ubuntu: apt-get install libgmp3-dev

Error Message:

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.

Cause: configure with '–with-imap=shared' '–with-imap-ssl' but libc-client-devel(.x86_64) package is missing

Fix:

CentOS: yum install   libc-client-devel
CentOS(64bit): yum install   libc-client-devel.x86_64
Ubuntu: apt-get install libc-client-dev

Error Message:

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

Cause: configure with '–with-ldap=shared' '–with-ldap-sasl' but openldap-devel(.x86_64) package is missing

Fix:

CentOS: yum install   openldap-devel
CentOS(64bit): yum install   openldap-devel.x86_64
Ubuntu: apt-get install libldap2-dev

Error Message:

checking for mcrypt support... yes, shared
configure: error: mcrypt.h not found. Please reinstall libmcrypt.

Cause: configure with '–with-mcrypt=shared,/usr' but libmcrypt-devel(.x86_64) package is missing

Fix:

CentOS: yum install   libmcrypt-devel
CentOS(64bit): yum install   libmcrypt-devel.x86_64
Ubuntu: apt-get install libmcrypt-dev

Error Message:

checking for mhash support... yes, shared
configure: error: Please reinstall libmhash - I cannot find mhash.h

Cause: configure with '–with-mhash=shared,/usr' but libmhash-devel(.x86_64) package is missing

Fix:

CentOS: yum install   libmhash-devel
CentOS(64bit): yum install   libmhash-devel.x86_64
CentOS 6: yum install   mhash-devel
CentOS 6(64bit): yum install   mhash-devel.x86_64
Ubuntu: apt-get install libmhash-dev

Error Message:

checking for MSSQL support via FreeTDS... yes, shared
configure: error: Directory /usr is not a FreeTDS installation directory

Cause: configure with option '–with-freetype-dir=/usr' but freetds-devel(.x86_64) package is missing

Fix:

CentOS: yum install   freetds-devel
CentOS(64bit): yum install   freetds-devel.x86_64
Ubuntu: apt-get install freetds-dev

Error Message:

configure: error: Cannot find libz.
**ERROR** Could not configure PHP build

Cause: configure with '–with-zlib' but libz-devel(.x86_64) package is missing

Fix:

CentOS: yum install   libz-devel
CentOS(64bit): yum install   libz-devel.x86_64
CentOS 6: yum install   zlib-devel
CentOS 6(64bit): yum install   zlib-devel.x86_64
Ubuntu: apt-get install libz-dev

Error Message:

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

Cause: configure with '–with-mysql=shared,/usr' but mysql-devel(.x86_64) package is missing

Fix:

CentOS: yum install   mysql-devel
CentOS(64bit): yum install   mysql-devel.x86_64
Ubuntu: apt-get install libmysqlclient15-dev

Error Message:

checking for ncurses support... yes, shared
not found
configure: error: Please reinstall the ncurses distribution

Cause: configure with '–with-ncurses=shared' but ncurses-devel(.x86_64) package is missing

Fix:

CentOS: yum install   ncurses-devel
CentOS(64bit): yum install   ncurses-devel.x86_64
Ubuntu: apt-get install ncurses-dev

Error Message:

checking for pcre support... yes, shared
not found
configure: error: pcre.h not found

Cause: configure with '–with-pcre=shared,/usr' but pcre-devel(.x86_64) package is missing

Fix:

CentOS: yum install   pcre-devel
CentOS(64bit): yum install   pcre-devel.x86_64
Ubuntu: apt-get install libpcre3-dev

Error Message:

checking for Oracle (OCI8) support... no
checking for unixODBC support... configure: error: ODBC header file '/usr/include/sqlext.h' not found!

Cause: configure with '–with-unixODBC=shared,/usr' but unixODBC-devel(.x86_64) package is missing

Fix:

CentOS: yum install   unixODBC-devel
CentOS(64bit): yum install   unixODBC-devel.x86_64
Ubuntu: apt-get install unixODBC-dev

Error Message:

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

Cause: configure with '–with-pdo-pgsql=shared,/usr' but postgresql-devel(.x86_64) package is missing

Fix:

CentOS: yum install   postgresql-devel
CentOS(64bit): yum install   postgresql-devel.x86_64
Ubuntu: apt-get install postgresql-server-dev-8.3 (aptitude search postgresql | grep dev)

Error Message:

checking for sqlite3 files in default path... not found
configure: error: Please reinstall the sqlite3 distribution

Cause: configure with '–with-pdo-sqlite=shared,/usr' but sqlite-devel(.x86_64) package is missing

Fix:

CentOS: yum install   sqlite-devel
CentOS(64bit): yum install   sqlite-devel.x86_64
Ubuntu: apt-get install libsqlite-dev 

Error Message:

checking for PSPELL support... yes, shared
configure: error: Cannot find pspell

Cause: configure with '–with-pspell=shared' but aspell-devel(.x86_64) package is missing

Fix:

CentOS: yum install   aspell-devel
CentOS(64bit): yum install   aspell-devel.x86_64
Ubuntu: apt-get install libaspell-dev 

Error Message:

checking for readline support... yes
configure: error: Please reinstall readline - I cannot find readline.h

Cause: configure with '–with-readline' but readline-devel(.x86_64) package is missing

Fix:

CentOS: yum install   readline-devel
CentOS(64bit): yum install   readline-devel.x86_64
Ubuntu: apt-get install libreadline5-dev

Error Message:

checking for recode support... yes, shared
configure: error: Can not find recode.h anywhere under /usr /usr/local /usr /opt.

Cause: configure with '–with-recode=shared,/usr' but recode-devel(.x86_64) package is missing

Fix:

CentOS: yum install   recode-devel
CentOS(64bit): yum install   recode-devel.x86_64
Ubuntu: apt-get install librecode-dev 

Error Message:

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

Cause: configure with '–with-snmp=shared,/usr' but net-snmp-devel(.x86_64) package is missing

Fix:

CentOS: yum install   net-snmp-devel
CentOS(64bit): yum install   net-snmp-devel.x86_64
Ubuntu: apt-get install libsnmp-dev

Error Message:

checking for TIDY support... yes, shared
configure: error: Cannot find libtidy

Cause: configure with '–with-tidy=shared,/usr' but libtidy-devel(.x86_64) package is missing

Fix:

CentOS: yum install   libtidy-devel
CentOS(64bit): yum install   libtidy-devel.x86_64
Ubuntu: apt-get install libtidy-dev

Error Message:

checking for XSL support... yes, shared
configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution

Cause: configure with '–with-xsl=shared,/usr' but libxslt-devel(.x86_64) package is missing

Fix:

CentOS: yum install   libxslt-devel
CentOS(64bit): yum install   libxslt-devel.x86_64
Ubuntu: apt-get install  libxslt-dev 

Error Message:

configure: error: recode extension can not be configured together with: imap mysql

Cause: For php 5.2.9 or later, this is because php-5.2.8-recode.patch isn't applied to php package.

Fix: edit file php_source_root/ext/recode/config9.m4, remove the following lines:

  test "$PHP_IMAP"  != "no" && recode_conflict="$recode_conflict imap"
  test "$PHP_MYSQL" != "no" && recode_conflict="$recode_conflict mysql"

Error Message:

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

Cause: configure with '–with-libedit', however, libedit-devel package is missing

Fix:

CentOS: yum install libedit-devel
CentOS64: yum install libedit-devel.x86_64
Ubuntu: apt-get install libedit-dev

Error Message:

/usr/bin/ld: cannot find -lltdl

Cause: system is missing libltdl.so

Fix:

CentOS: yum install libtool-ltdl-devel
CentOS64: yum install libtool-ltdl-devel.x86_64
Ubuntu: apt-get install libtool-ltdl-dev
 
litespeed_wiki/php/lsapi/troubleshoot.txt · Last modified: 2014/01/08 16:23 by Michael