PHP 5.2.17 + FPM on CentOS 7
| From: | Bruno Martins | Date: | Tue, 06 Oct 2015 14:28:01 +0000 |
| Subject: | PHP 5.2.17 + FPM on CentOS 7 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-325163@lists.php.net to get a copy of this message | ||
Hello everyone,
I manage a virtual machine running CentOS Linux release 7.1.1503 (Core) with PHP version 5.4.16 on
it. Everything is working fine and this PHP installation is provided by default repositories.
Now I was trying to add support for PHP 5.2.17 for backwards compatibility with some old
applications and I am having some problems.
Script used to install PHP, patch it and PHP-FPM was the following:
#!/bin/bash
export v="5.2.17";
yum install -y wget patch gcc libtool libmcrypt-devel libxml2-devel flex bison make pcre-devel
zlib-devel openssl-devel gd-devel libtool-ltdl-devel mysql-devel
cd /usr/local/src/
wget -c http://museum.php.net/php5/php-$v.tar.gz
wget -c http://php-fpm.org/downloads/php-$v-fpm-0.5.14.diff.gz
tar -xvf php-$v.tar.bz2
gzip -cd php-$v-fpm-0.5.14.diff.gz | patch -d php-$v -p1
cd php-$v
./configure --prefix=/opt/php-5.2.17 --enable-fastcgi --enable-fpm --enable-cli \
--with-mcrypt \
--with-zlib \
--enable-mbstring \
--with-openssl \
--with-mysql \
--with-mysql-sock \
--with-gd \
--with-jpeg-dir=/usr/lib64 \
--enable-gd-native-ttf \
--without-sqlite \
--disable-pdo \
--with-libdir=lib64 \
--with-xpm-dir=/usr/lib64 \
--enable-gd-jis-conv \
--with-freetype-dir=/usr/include/freetype2 \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--enable-shared
make all install
strip /opt/php-5.2.17/bin/php-cgi
I have also did the following, because as I could comprehend we need an init script for it:
cp /usr/local/src/php-5.2.17/sapi/cgi/fpm/init.d/php-fpm.in /etc/init.d/php-5.2.17-fpm
However, when I start it, it just gives me the following error and fails:
[root@wiseispconfig01 ~]# /etc/init.d/php-5.2.17-fpm start
Starting php_fpm Usage: /opt/php-5.2.17/sbin/php-fpm {start|stop|quit|restart|reload|logrotate}
Failed
This init script has the following lines on it:
#! /bin/sh
php_fpm_BIN=/opt/php-5.2.17/sbin/php-fpm
php_fpm_CONF=/opt/php-5.2.17/etc/php-fpm.conf
php_fpm_PID=/var/run/php-5.2.17-fpm.pid
php_opts="--fpm-config $php_fpm_CONF"
and:
case "$1" in
start)
echo -n "Starting php_fpm "
$php_fpm_BIN --fpm $php_opts
if [ "$?" != 0 ] ; then
echo " failed"
exit 1
fi
wait_for_pid created $php_fpm_PID
if [ -n "$try" ] ; then
echo " failed"
exit 1
else
echo " done"
fi
;;
Examining the output, I can see deduce it's executing the following binary and its arguments:
/opt/php-5.2.17/sbin/php-fpm --fpm --fpm-config /opt/php-5.2.17/etc/php-fpm..conf
However, this are not the expected parameters.
Also, if I just run the following command, it will also fail:
[root@wiseispconfig01 ~]# /opt/php-5.2.17/sbin/php-fpm start
Starting php_fpm Error in argument 1, char 1: no argument for option -
Usage: php-cgi [-q] [-h] [-s] [-v] [-i] [-f <file>]
php-cgi <file> [args...]
-a Run interactively
-C Do not chdir to the script's directory
-c <path>|<file> Look for php.ini file in this directory
-n No php.ini file will be used
-d foo[=bar] Define INI entry foo with value 'bar'
-e Generate extended information for debugger/profiler
-f <file> Parse <file>. Implies `-q'
-h This help
-i PHP information
-l Syntax check only (lint)
-m Show compiled in modules
-q Quiet-mode. Suppress HTTP Header output.
-s Display colour syntax highlighted source.
-v Version number
-w Display source with stripped comments and whitespace.
-z <file> Load Zend extension <file>.
.............................^C
Can you please help me understand what have I missed?
If not, could you please indicate the necessary steps in order to have my environment working for
this particular PHP version?
Thanks a lot for your cooperation.
Best regards,
Bruno Martins