Known configure errors with php

1. Configure: error: Please reinstall the BZip2 distribution
# yum install bzip2-devel
2. Configure: error: DBA: Could not find necessary header file(s).
# yum install gdbm-devel
# yum install db4-devel
3. Configure: error: libjpeg.(a|so) not found.
# yum install libjpeg-devel
4. Configure: error: libpng.(a|so) not found.
# yum install libpng-devel
5. Configure: error: freetype.h not found.
# yum install freetype-devel
6. configure: error: Please reinstall the libcurl distribution
# yum install curl
# yum install curl-devel
7. Configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution
# yum install libxslt-devel >>>> fixed
8. xml2-config not found. Please check your libxml2 installation.
# yum install libxml2-devel
9. Kalau error Perl-URI
#rpm -i perl-URI-1.35-3.noarch.rpm
10. Configure: error: utf8_mime2text() has new signature
#yum install libc-client-devel
11. Configure: error: libXpm.(a|so) not found.
# yum install gd-devel
#up2date -i gd-devel
12. configure: error: Cannot find OpenSSL’s
# yum install openssl-deve
13. Checking for PCRE headers location… configure: error: Could not find pcre.h in /usr
# yum install pcre-devel
14. Configure: error: Unable to locate gmp.h
# yum install gmp-devel
15. configure: error: Cannot find pspell
# yum install aspell-devel
16. The ‘links’ package is required for this functionality.
# yum search links
# yum install elinks
17. Error : [warn] module php5_module is already loaded, skipping
# edit httpd.conf terus Uncomment : #LoadModule php5_module modules/
18. Configure: error: Did not find pcre-config script at /usr/local
# yum -y install pcre-devel
19. warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID e8562897
# rpm -import
ERROR: cannot restore segment prot after reloc: Permission denied
chcon -t texrel_shlib_t /etc/httpd/modules/
20. Configure: error: mcrypt.h not found. Please reinstall libmcrypt

Categories PHP

How to install and use two versions of PHP on the same Plesk for Linux server


php version – php-5.4.31

CentOS 6.5
Plesk Panel 12.0
Current php version 5.3

1. SSH to your Plesk server (or Apache Service Node for Parallels Plesk Automation) as root, download the PHP source, unpack it, and configure it:

# cd /usr/local/src
# mkdir php540
# cd php540
# wget
# tar xzvf php-5.4.0.tar.gz
# cd php-5.4.0
# ./configure '--with-libdir=lib64' '--cache-file=../config.cache' '--prefix=/usr/local/php540-cgi' '--with-config-file-path=/usr/local/php540-cgi/etc' '--disable-debug' '--with-pic' '--disable-rpath' '--enable-fastcgi' '--with-bz2' '--with-curl' '--with-freetype-dir=/usr/local/php540-cgi' '--with-png-dir=/usr/local/php540-cgi' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr/local/php540-cgi' '--with-openssl' '--with-pspell' '--with-pcre-regex' '--with-zlib' '--enable-exif' '--enable-ftp' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-wddx' '--with-kerberos' '--with-unixODBC=/usr' '--enable-shmop' '--enable-calendar' '--without-sqlite3' '--with-libxml-dir=/usr/local/php540-cgi' '--enable-pcntl' '--with-imap' '--with-imap-ssl' '--enable-mbstring' '--enable-mbregex' '--with-gd' '--enable-bcmath' '--with-xmlrpc' '--with-ldap' '--with-ldap-sasl' '--with-mysql=/usr' '--with-mysqli' '--with-snmp' '--enable-soap' '--with-xsl' '--enable-xmlreader' '--enable-xmlwriter' '--enable-pdo' '--with-pdo-mysql' '--with-pdo-pgsql' '--with-pear=/usr/local/php540-cgi/pear' '--with-mcrypt' '--enable-intl' '--without-pdo-sqlite' '--with-config-file-scan-dir=/usr/local/php540-cgi/php.d'

Note: You MUST USE THE PREFIX SWITCH in order for your new PHP to be installed inside a single directory. As you can see, the prefix here is /usr/local/php540-cgi/

Note: Above are the sample command line arguments you may encounter with errors regarding the absence of a package (e.g. mysql-devel). The default arguments are described in the documentation

Choosing a prefix is very important because it prevents your new PHP installation from interfering with the other PHP installations available on the server.

Compile and install PHP:

# make
# make install

Set up php.ini:

# cp php.ini-development /usr/local/php540-cgi/php.ini

You can edit the php.ini file to set PHP options. If you prefer having php.ini in another location, run the configure utility with the option –with-config-file-path=/some/path in step #1.

Register the new PHP version:

In Parallels Plesk Panel

    /usr/local/psa/bin/php_handler --add -displayname  -path  -phpini  -type  -id 


-displayname is the PHP version name that will be shown in the Plesk UI. We recommend you include the version number in the displayname. For example, you could name the version “5.3.3-custom”.

-path is the location of the PHP CGI binary file. You can find this in the output of the command make install in the line Installing PHP CGI binary. For example, if you see the line Installing PHP CGI binary: /usr/local/bin/, the location you need to specify is /usr/local/bin/php-cgi. Learn more at the Official PHP web Site.

-phpini is the location of the php.ini file, for example, /some/path/php.ini .

-type is the type of the PHP handler associated with this version. Learn more about PHP handlers in the section: PHP Handlers.

Important: You can set either the CGI or FastCGI PHP handler. mod_php is not supported.
-id (optional) is the identifier you will use when referring to this PHP version (for example, when adjusting or removing it).

Compile errors.


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


# yum install libxml2-devel


#configure: error: Cannot find OpenSSL's 


# yum install openssl-devel


# configure: error: Please reinstall the BZip2 distribution


# yum install bzip2-devel


# configure: error: jpeglib.h not found.


# yum install libjpeg-devel


# configure: error: png.h not found.


# yum install libpng-devel


# Configure: error: freetype.h not found.


# yum install freetype-devel


# Configure: error: Unable to locate gmp.h


# yum install gmp-devel


# 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 

Error: Multilib version problems found. This often means that the root
cause is something else and multilib version checking is just
pointing out that there is a problem. Eg.:

1. You have an upgrade for libc-client which is missing some
dependency that another package requires. Yum is trying to
solve this by installing an older version of libc-client of the
different architecture. If you exclude the bad architecture
yum will tell you what the root cause is (which package
requires what). You can try redoing the upgrade with
–exclude libc-client.otherarch … this should give you an error
message showing the root cause of the problem.

2. You have multiple architectures of libc-client installed, but
yum can only see an upgrade for one of those arcitectures.
If you don’t want/need both architectures anymore then you
can remove the one with the missing update and everything
will work.

3. You have duplicate versions of libc-client installed already.
You can use “yum check” to get yum show these errors.

…you can also use –setopt=protected_multilib=false to remove
this checking, however this is almost never the correct thing to
do as something else is very likely to go wrong (often causing
much more problems).

Protected multilib versions: libc-client-2007e-11.el6.i686 !=
You could try using –skip-broken to work around the problem
You could try running: rpm -Va –nofiles –nodigest

I searched and the fix was to enable the atomic repo that was installed but disabled.

nano /etc/yum.repos.d/atomic
enabled = 1
# 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: mcrypt.h not found. Please reinstall libmcrypt.
# yum install libmcrypt libmcrypt-devel

Then I got another:

Error: Package: (atomic)
Requires: libmcrypt =
Installed: libmcrypt-2.5.8-9.el6.x86_64 (@epel)
libmcrypt = 2.5.8-9.el6
Available: (atomic)
libmcrypt =
You could try using –skip-broken to work around the problem
You could try running: rpm -Va –nofiles –nodigest

I disabled atomic repo and then got:

Error: Package: libmcrypt-devel-2.5.7-1.2.el6.rf.x86_64 (rpmforge)
Requires: libmcrypt = 2.5.7-1.2.el6.rf
Installed: libmcrypt-2.5.8-9.el6.x86_64 (@epel)
libmcrypt = 2.5.8-9.el6
Available: libmcrypt-2.5.7-1.2.el6.rf.x86_64 (rpmforge)
libmcrypt = 2.5.7-1.2.el6.rf
You could try using –skip-broken to work around the problem
You could try running: rpm -Va –nofiles –nodigest

I disabled rpmforge repo enabled the epel repo.

# configure: error: Cannot find MySQL header files under /usr.
# yum install mysql-devel
# configure: error: ODBC header file '/usr/include/sqlext.h' not found!
# yum install unixODBC-devel
# configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path
# yum install postgresql-devel
# configure: error: Cannot find pspell
#yum install aspell-devel
# configure: error: Could not find net-snmp-config binary. Please check your net-snmp installation.
# yum install net-snmp-devel
# error: xslt-config not found
# yum install libxslt-devel

PHP error for fastcgi

Thank you for using PHP.

config.status: creating php5.spec
config.status: creating main/build-defs.h
config.status: creating scripts/phpize
config.status: creating scripts/man1/phpize.1
config.status: creating scripts/php-config
config.status: creating scripts/man1/php-config.1
config.status: creating sapi/cli/php.1
config.status: creating sapi/cgi/php-cgi.1
config.status: creating ext/phar/phar.1
config.status: creating ext/phar/phar.phar.1
config.status: creating main/php_config.h
config.status: executing default commands
configure: WARNING: unrecognized options: --enable-fastcgi

From –

If this is enabled, the CGI module will be built with support for FastCGI also. Available since PHP 4.3.0
As of PHP 5.3.0 this argument no longer exists and is enabled by –enable-cgi instead.

So, I changed the option:

# --enable-fastcgi


# --enable-cgi

New configure string:

 ./configure '--with-libdir=lib64' '--cache-file=../config.cache' '--prefix=/usr/local/php540-cgi' '--with-config-file-path=/usr/local/php540-cgi/etc' '--disable-debug' '--with-pic' '--disable-rpath' '--enable-cgi' '--with-bz2' '--with-curl' '--with-freetype-dir=/usr/local/php540-cgi' '--with-png-dir=/usr/local/php540-cgi' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr/local/php540-cgi' '--with-openssl' '--with-pspell' '--with-pcre-regex' '--with-zlib' '--enable-exif' '--enable-ftp' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-wddx' '--with-kerberos' '--with-unixODBC=/usr' '--enable-shmop' '--enable-calendar' '--without-sqlite3' '--with-libxml-dir=/usr/local/php540-cgi' '--enable-pcntl' '--with-imap' '--with-imap-ssl' '--enable-mbstring' '--enable-mbregex' '--with-gd' '--enable-bcmath' '--with-xmlrpc' '--with-ldap' '--with-ldap-sasl' '--with-mysql=/usr' '--with-mysqli' '--with-snmp' '--enable-soap' '--with-xsl' '--enable-xmlreader' '--enable-xmlwriter' '--enable-pdo' '--with-pdo-mysql' '--with-pdo-pgsql' '--with-pear=/usr/local/php540-cgi/pear' '--with-mcrypt' '--enable-intl' '--without-pdo-sqlite' '--with-config-file-scan-dir=/usr/local/php540-cgi/php.d'

And, no errors

License:                                                           |
| This software is subject to the PHP License, available in this     |
| distribution in the file LICENSE.  By continuing this installation |
| process, you are bound by the terms of this license agreement.     |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point.                            |

Thank you for using PHP.

Error with "make"
# make
/usr/bin/ld: cannot find -lltdl
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1

You need to install the Tools needed for development using the GNU Libtool Dynamic Module Loader

yum install libtool-ltdl-devel

Then ran –

# make clean

# make

Generating phar.php
Generating phar.phar
PEAR package PHP_Archive not installed: generated phar will require PHP's phar extension be enabled.

Build complete.
Don't forget to run 'make test'.

# make test

Bug #43073 (TrueType bounding box is wrong for angle<>0) freetype < 2.4.10 [ext/gd/tests/bug43073.phpt]
gmp_gcdext() basic tests [ext/gmp/tests/022.phpt]
Bug #64124 IPv6 malformed [ext/snmp/tests/bug64124.phpt]
Bug #64159: Truncated snmpget [ext/snmp/tests/bug64159.phpt]
IPv6 support [ext/snmp/tests/ipv6.phpt]
OO API: getErrno & getError methods [ext/snmp/tests/snmp-object-errno-errstr.phpt]
OO API [ext/snmp/tests/snmp-object.phpt]
Function snmp2_get [ext/snmp/tests/snmp2_get.phpt]
Function snmp2_getnext [ext/snmp/tests/snmp2_getnext.phpt]
Function snmp2_real_walk [ext/snmp/tests/snmp2_real_walk.phpt]
Function snmp2_set (without MIBs loading) [ext/snmp/tests/snmp2_set-nomib.phpt]
Function snmp2_set [ext/snmp/tests/snmp2_set.phpt]
Function snmp2_walk [ext/snmp/tests/snmp2_walk.phpt]
SNMPv3 Support (errors) [ext/snmp/tests/snmp3-error.phpt]
SNMPv3 Support [ext/snmp/tests/snmp3.phpt]
Function snmp_getvalue [ext/snmp/tests/snmp_getvalue.phpt]
Function snmpget [ext/snmp/tests/snmpget.phpt]
Function snmpgetnext [ext/snmp/tests/snmpgetnext.phpt]
Function snmprealwalk [ext/snmp/tests/snmprealwalk.phpt]
Function snmpset (without MIBs loading) [ext/snmp/tests/snmpset-nomib.phpt]
Function snmpset [ext/snmp/tests/snmpset.phpt]
Function snmpwalk [ext/snmp/tests/snmpwalk.phpt]
Bug #32001 (xml_parse*() goes into infinite loop when autodetection in effect), using UTF-* [ext/xml/tests/bug32001.phpt]

zend multibyte (2) [ext/mbstring/tests/zend_multibyte-02.phpt] (warn: XFAIL section but test passes)
zend multibyte (6) [ext/mbstring/tests/zend_multibyte-06.phpt] (warn: XFAIL section but test passes)

You may have found a problem in PHP.
This report can be automatically sent to the PHP QA team at and
This gives us a better understanding of PHP's behavior.
If you don't want to send the report immediately you can choose
option "s" to save it.  You can then email it to later.
Do you want to send this report now? [Yns]:

# make install

[root@austin php-5.4.31]# make install
Installing PHP CLI binary:        /usr/local/php540-cgi/bin/
Installing PHP CLI man page:      /usr/local/php540-cgi/php/man/man1/
Installing PHP CGI binary:        /usr/local/php540-cgi/bin/
Installing PHP CGI man page:      /usr/local/php540-cgi/php/man/man1/
Installing build environment:     /usr/local/php540-cgi/lib/php/build/
Installing header files:          /usr/local/php540-cgi/include/php/
Installing helper programs:       /usr/local/php540-cgi/bin/
  program: phpize
  program: php-config
Installing man pages:             /usr/local/php540-cgi/php/man/man1/
  page: phpize.1
  page: php-config.1
Installing PEAR environment:      /usr/local/php540-cgi/pear/
[PEAR] Archive_Tar    - installed: 1.3.11
[PEAR] Console_Getopt - installed: 1.3.1
[PEAR] Structures_Graph- installed: 1.0.4
[PEAR] XML_Util       - installed: 1.2.3
[PEAR] PEAR           - installed: 1.9.5
Wrote PEAR system config file at: /usr/local/php540-cgi/etc/pear.conf
You may want to add: /usr/local/php540-cgi/pear to your php.ini include_path
/usr/local/src/php540/php-5.4.31/build/shtool install -c ext/phar/phar.phar /usr/local/php540-cgi/bin
ln -s -f /usr/local/php540-cgi/bin/phar.phar /usr/local/php540-cgi/bin/phar
Installing PDO headers:          /usr/local/php540-cgi/include/php/ext/pdo/

# cp php.ini-development /usr/local/php540-cgi/etc/php.ini
# /usr/local/psa/bin/php_handler --add -displayname 5.4.31-custom -path /usr/local/php540-cgi/bin/ -phpini /usr/local/php540-cgi/etc/php.ini -type fastcgi -id php-5.4.31
ini -type fastcgi -id php-5.4.31
[2014-08-15 21:38:16] ERR [util_exec] proc_close() failed
Unable to register the PHP handler: can not get version from /usr/local/php540-cgi/bin/

Changed the path to – /usr/local/php540-cgi/bin/php-cgi

/usr/local/psa/bin/php_handler --add -displayname 5.4.31-custom -path /usr/local/php540-cgi/bin/php-cgi -phpini /usr/local/php540-cgi/etc/php.ini -type fastcgi -id 5.4.31-custom
The new PHP handler with the id "5.4.31-custom" was successfully registered.

The – login to plesk and thenew php is regsitered and can be selected.


There is also a great article for Plesk and the REMI Repo install.


PHP Session write error

php Sessions write error suddenly on website

Step 1

 cd /var/lib/php/
[root@austin php]# ls -la
total 12
drwxr-xr-x  3 root root 4096 Apr  9 19:54 .
drwxr-xr-x 37 root root 4096 Apr 24 23:41 ..
drwx-wx-wt  2 apache apache 4096 Aug  5 20:01 session

Change the permissions and ownership

chmod 1733 /var/lib/php/session
chown root:root /var/lib/php/session

Step 2

Check the yum update log for php updates as this is usually the cause of the permissions change.

[root@austin log]# grep php /var/log/yum.log
Apr 09 19:54:09 Installed: php-5.3.3-27.el6_5.x86_64

This will give you the date and time of the last php update!

Atomic repo php Upgrade error

Servers popping up that are having php failures or issues with php_admin_value or php_admin_flag when apache restarts. This is occurring on servers running PHP 5.3.26. It appears when this update was pushed out, mod_php is no longer being loaded by default.

The symptoms are outlined here:

You should be able to add the following to the top of php.conf file to resolve the issue:

<IfModule prefork.c>
  LoadModule php5_module modules/
<IfModule worker.c>
  LoadModule php5_module modules/


If you come across a managed server that has the atomic repo enabled and has updated to PHP 5.4.x it more than likely killed their sites.

If this is the case and they were on a newer version of 5.3.x from atomic I’ve got the couple of one liners that I used to remove all the install PHP packages and then install the webtatic repo (which installed disabled) and then to install a base set of php modules from their repo.

This command will figure out what php-5.4.x packages are installed from atomic. Just to verify that you won’t be killing off anything other than the offending atomic packages.

rpm -qa | grep php | grep 5.4

This one-liner will remove all packages that match the above criteria even if they refer to multiple packages or are listed more than once.

for i in `rpm -qa | grep php | grep 5.4` ; do rpm -ev --allmatches --nodeps $i; done

Once they are all removed install the webtatic repo

rpm -Uvh

Then you can install the basic set of packages for php 5.3

yum --enablerepo=webtatic install php php-devel php-mysql php-imap php-xml php-pdo php-gd php-soap

PHP Spam Scripts

PHP Spam Scripts

I finally decided this topic deserves its own page.
To find the script sending spam

Ver -11.0

cat /var/www/vhosts/ | grep POST > /tmp/post.log

Ver 11.5+

cat /var/www/vhosts/system/ | grep POST > /tmp/post.log

WHM cPanel

cat /usr/local/apache/domlogs/ | grep POST > /tmp/post.log

View the results

cat /etm/post.log - - [02/Jan/2014:10:51:41 -0500] "POST /tmp/sys09725841.php HTTP/1.1" 200 181 "-" "-" - - [02/Jan/2014:10:52:54 -0500] "POST /tmp/sys09725841.php HTTP/1.1" 200 181 "-" "-" - - [02/Jan/2014:10:54:13 -0500] "POST /tmp/sys09725841.php HTTP/1.1" 200 181 "-" "-" - - [02/Jan/2014:10:55:18 -0500] "POST /tmp/sys09725841.php HTTP/1.1" 200 181 "-" "-" - - [02/Jan/2014:10:56:32 -0500] "POST /tmp/sys09725841.php HTTP/1.1" 200 181 "-" "-"


This file often appears in /tmp/sysNNNNNNNN.php file
1. /tmp is 777
2. the sysNNNNNNNN.php is usually accompanied by a .zip file
3. .php and .zip are owned by apache

Mcrypt Installation

Note: If you have plesk panel – check the website for the version of php running. If it is a different version than the standard php installation, create a phpinfo page to check if mcrypt is installed for that php version as a simple “php-m” will just report the standard OS php information.

The first step requires downloading some RPM files that contain the additional YUM repository definitions. The instructions below point to the 64-bit versions that work with our Cloud Server instances.
Centos 5.x

sudo rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm

Centos 6.x

sudo rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm

CentOS 7

# sudo yum install epel-release


The command is as follows to download epel release for CentOS and RHEL 7.x using wget command:

cd /tmp

To install epel-release-7-5.noarch.rpm, type:

# sudo yum install epel-release-latest-7.noarch.rpm

list repos:

# sudo yum repolist

Once installed you should see some additional repo definitions under the /etc/yum.repos.d directory.

$ ls -1 /etc/yum.repos.d/epel* /etc/yum.repos.d/remi.repo

Enable the remi repository

The remi repository provides a variety of up-to-date packages that are useful or are a requirement for many popular web-based services. That means it generally is not a bad idea to enable the remi repositories by default.

First, open the /etc/yum.repos.d/remi.repo repository file using a text editor of your choice:

# sudo vim /etc/yum.repos.d/remi.repo

Edit the [remi] portion of the file so that the enabled option is set to 1. This will enable the remi repository.

name=Les RPM de remi pour Enterprise Linux $releasever - $basearch

You will now have a larger array of yum repositories from which to install.

Now run:

# yum install php-mcrypt

# service httpd restart