Multiple PHP-versions ISP Config 3 + Centos 7
yum install *sdt-devel libdb-devel qdbm-devel libdb-sql-devel libdb4-devel libdbi-devel libjpeg-turbo-devel libvpx-devel libpng-devel libXpm-devel recode-devel net-snmp-devel
yum install systemd-devel enchant-devel aspell-devel
yum install -y gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libpng libpng-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses curl openssl-devel gdbm-devel db4-devel libXpm-devel libX11-devel gd-devel gmp-devel readline-devel libxslt-devel expat-devel xmlrpc-c xmlrpc-c-devel httpd-devel libxml2-dev openssl openssl-devel bzip2-devel libcurl-devel libjpeg-devel libpng-devel freetype-devel gmp-devel firebird-devel libedit-devel
yum install libxml2-devel openssl-devel libcurl-devel libicu-devel mysql-devel postgresql-devel libtidy-devel libxslt-devel
libc-client-devel libmcrypt-devel mhash-devel pcre-devel t1lib-devel
-
/opt/php-7.3.20/bin/pecl -C ./pear.conf update-channels /opt/php-7.3.20/bin/pear install PEAR-1.9.5 /opt/php-7.3.20/bin/pear install PHP_Archive-0.12.0 /opt/php-7.3.20/bin/pear install pear/Console_GetoptPlus /opt/php-7.3.20/bin/pear install channel://pear.php.net/Console_GetoptPlus-1.0.0RC1 /opt/php-7.3.20/bin/pear install channel://pear.php.net/PEAR_Frontend_Gtk-0.4.0 /opt/php-7.3.20/bin/pear install channel://pear.php.net/PEAR_Frontend_Web-0.7.5 /opt/php-7.3.20/bin/pear install pear/PEAR#gtk2installer /opt/php-7.3.20/bin/pear install pear/XML_Parser pear/System_Command /opt/php-7.3.20/bin/pear install channel://pear.php.net/XML_Parser2-0.1.0
Cmake 3.14 +
LibZIP + LibSODIUM
cd /opt
wget https://github.com/Kitware/CMake/releases/download/v3.14.0-rc4/cmake-3.1...tar xzvf cmake-3.14.0-rc4-Linux-x86_64.tar.gz- wget https://github.com/Kitware/CMake/releases/download/v3.14.0-rc4/cmake-3.1...
- chmod +x cmake-3.14.0-rc4-Linux-x86_64.sh
- bash cmake-3.14.0-rc4-Linux-x86_64.sh
- ln -s /opt/cmake-3.14.0-rc4-Linux-x86_64/bin/* /usr/bin
- cmake --version
- yum -y install
cmake3openssl-devel bzip2-devel zlib-devel --enablerepo=epel - yum install perl gcc gcc-c++
- cd /usr/local/src
- wget https://libzip.org/download/libzip-1.5.1.tar.gz
- tar zxvf libzip*
- cd libzip*
- mkdir build
- cd build
- cmake ..
- make
- make test
- make install
- LibSodium
cd /opt
wget https://download.libsodium.org/libsodium/releases/LATEST.tar.gz
tar xzvf LATEST.tar.gz
cd libsodium-stable
./configure
make && make check
make install
Installing PHP-versions
mkdir /opt/php-7.3.20
mkdir /usr/local/src/php7-build
cd /usr/local/src/php7-build
wget http://hk2.php.net/get/php-7.3.20.tar.gz/from/this/mirror -O php-7.3.20.tar.gz
tar xzvf php-7.3.20.tar.gz
cd php-7.3.20
./configure --prefix=/opt/php-7.3.20 --with-libdir=lib64 --disable-rpath --with-libxml-dir=/usr --with-libzip --with-openssl --with-kerberos --with-pcre-regex --with-zlib --enable-bcmath --with-bz2 --enable-calendar --with-curl --enable-exif --enable-ftp --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-zlib-dir --with-freetype-dir --with-gettext --with-mhash --with-imap --with-imap-ssl --with-mcrypt --enable-intl
--enable-mbstring --with-mysqli=/usr/bin/mysql_config --enable-opcache --enable-pcntl --with-pdo-mysql --with-pdo-pgsql --with-pgsql --enable-soap --with-tidy
--enable-sockets --enable-sysvsem --enable-sysvshm --with-xmlrpc --with-xsl --enable-inline-optimization --enable-mbregex --with-fpm-user=apache --with-fpm-group=apache --enable-fpm --enable-cgi
- cp /usr/local/src/php7-build/php-7.3.20/php.ini-production /opt/php-7.3.20/php.ini
cp /opt/php-7.3.20/etc/php-fpm.conf.default /opt/php-7.3.20/etc/php-fpm.conf
cp /opt/php-7.3.20/etc/php-fpm.d/www.conf.default /opt/php-7.3.20/etc/php-fpm.d/www.conf
- nano /opt/php-7.3.20/etc/php-fpm.conf
uncomment line pid = run/php-fpm.pid - nano /opt/php-7.3.20/etc/php-fpm.d/www.conf
listen = 127.0.0.1:8998 - nano /etc/init.d/php-7.3.20-fpm
#! /bin/sh
### BEGIN INIT INFO
# Provides: php-7.3.20-fpm
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts php-7.3.20-fpm
# Description: starts the PHP FastCGI Process Manager daemon
### END INIT INFO
php_fpm_BIN=/opt/php-7.3.20/sbin/php-fpm
php_fpm_CONF=/opt/php-7.3.20/etc/php-fpm.conf
php_fpm_PID=/opt/php-7.3.20/var/run/php-fpm.pid
php_opts="--fpm-config $php_fpm_CONF"
wait_for_pid () {
try=0
while test $try -lt 35 ; do
case "$1" in
'created')
if [ -f "$2" ] ; then
try=''
break
fi
;;
'removed')
if [ ! -f "$2" ] ; then
try=''
break
fi
;;
esac
echo -n .
try=`expr $try + 1`
sleep 1
done
}
case "$1" in
start)
echo -n "Starting php-fpm "
$php_fpm_BIN $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
;;
stop)
echo -n "Gracefully shutting down php-fpm "
if [ ! -r $php_fpm_PID ] ; then
echo "warning, no pid file found - php-fpm is not running ?"
exit 1
fi
kill -QUIT `cat $php_fpm_PID`
wait_for_pid removed $php_fpm_PID
if [ -n "$try" ] ; then
echo " failed. Use force-exit"
exit 1
else
echo " done"
echo " done"
fi
;;
force-quit)
echo -n "Terminating php-fpm "
if [ ! -r $php_fpm_PID ] ; then
echo "warning, no pid file found - php-fpm is not running ?"
exit 1
fi
kill -TERM `cat $php_fpm_PID`
wait_for_pid removed $php_fpm_PID
if [ -n "$try" ] ; then
echo " failed"
exit 1
else
echo " done"
fi
;;
restart)
$0 stop
$0 start
;;
reload)
echo -n "Reload service php-fpm "
if [ ! -r $php_fpm_PID ] ; then
echo "warning, no pid file found - php-fpm is not running ?"
exit 1
fi
kill -USR2 `cat $php_fpm_PID`
echo " done"
;;
*)
echo "Usage: $0 {start|stop|force-quit|restart|reload}"
exit 1
;;
esac
chmod 755 /etc/init.d/php-7.3.20-fpm
chkconfig --levels 235 php-7.3.20
service php-7.3.20-fpm start
- cd /usr/local/src/php7-build
- wget https://pecl.php.net/get/apcu-5.1.17.tgz
- tar xzvf apcu-5.1.17.tgz
cd apcu-5.1.17 - /opt/php-7.3.20/bin/phpize
./configure --enable-apcu --with-php-config=/opt/php-7.3.20/bin/php-config
make
make test
/opt/php-7.3.20/bin/php -i | grep extension_dir
- cp modules/apcu.so /opt/php-7.3.20/lib/php/extensions/no-debug-non-zts-20180731
- service php-7.3.20-fpm restart
- service httpd restart
service php-7.3.20-fpm restart
nano /opt/php-7.3.20/lib/php.ini
? - THERE IS NECESSARY TO CREATE COMPLETE NEW FILE - mkdir /usr/local/src/php7-build/php-xdebug
cd /usr/local/src/php7-build/php-xdebug
wget https://xdebug.org/files/xdebug-2.7.0.tgz
tar xzvf xdebug-2.7.0.tgz
cd xdebug-2.7.0 - /opt/php-7.3.20/bin/phpize
./configure --with-php-config=/opt/php-7.3.20/bin/php-config &&make
make test - cp modules/xdebug.so /opt/php-7.3.20/lib/php/extensions/no-debug-non-zts-20180731
service php-7.3.20-fpm restart
service httpd restart
nano /var/www/cgi-bin/php73.fcgi#!/bin/bash
PHPRC=" /opt/php-7.3.20/lib/php.ini"
PHP_CGI3=/opt/php-7.3.20/bin/php-cgi
PHP_FCGI_CHILDREN=8
PHP_FCGI_MAX_REQUESTS=3000
export PHPRC
export PHP_FCGI_CHILDREN
export PHP_FCGI_MAX_REQUESTS
exec $PHP_CGI3 - service php-7.3.20-fpm restart
service httpd restart
chown apache:apache /var/www/cgi-bin/php73.fcgi
chmod +x /var/www/cgi-bin/php73.fcgi - cd /usr/local/src/php7-build
-
wget http://www.memcached.org/files/memcached-1.5.12.tar.gz
tar xzvf memcached-1.5.12.tar.gz
cd memcached-1.5.12 - cd /usr/local/src/php7-build
wget -O memcached.tar.gz https://pecl.php.net/get/memcached
tar xzvf memcached.tar.gz
cd memcached-3.1.3/
/opt/php-7.3.20/bin/phpize - ./configure --with-php-config=/opt/php-7.3.20/bin/php-config
make
make test
PHP-5.6.40 - mkdir /opt/php-5.6.40
mkdir /usr/local/src/php5-build
cd /usr/local/src/php5-build
wget hk1.php.net/get/php-5.6.40.tar.gz/from/this/mirror -O php-5.6.40.tar.gz
tar xzvf php-5.6.40.tar.gz
cd php-5.6.40- ./configure --help
- ./configure --prefix=/opt/php-5.6.40 --with-pdo-pgsql --with-zlib-dir --with-freetype-dir --enable-mbstring --with-libxml-dir=/usr --enable-exif --enable-soap --enable-calendar --with-curl --with-mcrypt --with-zlib --with-gd --with-pgsql --disable-rpath --enable-inline-optimization --with-bz2 --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --with-mhash --enable-zip --with-pcre-regex --with-mysql --with-pdo-mysql --with-mysqli --with-png-dir=/usr --enable-gd-native-ttf --with-openssl --with-fpm-user=apache --with-fpm-group=apache --with-libdir=lib64 --enable-ftp --with-imap --with-imap-ssl --with-kerberos --with-gettext --with-gd --with-jpeg-dir=/usr/lib/ --enable-fpm
- make
- make test
- make install
- cp /usr/local/src/php5-build/php-5.6.40/php.ini-production /opt/php-5.6.40/lib/php.ini
- find / -name "*php-fpm.conf*"
- cp /opt/php-5.6.40/etc/php-fpm.conf.default /opt/php-5.6.40/etc/php-fpm.conf
- nano /opt/php-5.6.40/etc/php-fpm.conf
.............
pid = run/php-fpm.pid
................
user = apache
group = apache
..............
listen = 127.0.0.1:8997
.............
include=/opt/php-5.6.40/etc/pool.d/*.conf - mkdir /opt/php-5.6.40/etc/pool.d
- nano /etc/init.d/php-5.6.40-fpm
#! /bin/sh
### BEGIN INIT INFO
# Provides: php-5.6.40-fpm
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts php-5.6.40-fpm
# Description: starts the PHP FastCGI Process Manager daemon
### END INIT INFO
php_fpm_BIN=/opt/php-5.6.40/sbin/php-fpm
php_fpm_CONF=/opt/php-5.6.40/etc/php-fpm.conf
php_fpm_PID=/opt/php-5.6.40/var/run/php-fpm.pid
php_opts="--fpm-config $php_fpm_CONF"
wait_for_pid () {
try=0
while test $try -lt 35 ; do
case "$1" in
'created')
if [ -f "$2" ] ; then
try=''
break
fi
;;
'removed')
if [ ! -f "$2" ] ; then
try=''
break
fi
;;
esac
echo -n .
try=`expr $try + 1`
sleep 1
done
}
case "$1" in
start)
echo -n "Starting php-fpm "
$php_fpm_BIN $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
;;
stop)
echo -n "Gracefully shutting down php-fpm "
if [ ! -r $php_fpm_PID ] ; then
echo "warning, no pid file found - php-fpm is not running ?"
exit 1
fi
kill -QUIT `cat $php_fpm_PID`
wait_for_pid removed $php_fpm_PID
if [ -n "$try" ] ; then
echo " failed. Use force-exit"
exit 1
else
echo " done"
echo " done"
fi
;;
force-quit)
echo -n "Terminating php-fpm "
if [ ! -r $php_fpm_PID ] ; then
echo "warning, no pid file found - php-fpm is not running ?"
exit 1
fi
kill -TERM `cat $php_fpm_PID`
wait_for_pid removed $php_fpm_PID
if [ -n "$try" ] ; then
echo " failed"
exit 1
else
echo " done"
fi
;;
restart)
$0 stop
$0 start
;;
reload)
echo -n "Reload service php-fpm "
if [ ! -r $php_fpm_PID ] ; then
echo "warning, no pid file found - php-fpm is not running ?"
exit 1
fi
kill -USR2 `cat $php_fpm_PID`
echo " done"
;;
*)
echo "Usage: $0 {start|stop|force-quit|restart|reload}"
exit 1
;;
esac
- chmod 755 /etc/init.d/php-5.6.40-fpm
- chkconfig --levels 235 php-5.6.40-fpm on
- /etc/init.d/php-5.6.40-fpm start
- yum install php-pear
- cd /opt/php-5.6.40/etc
-
pecl -C ./pear.conf update-channels
/opt/php-5.6.40/bin/pecl -C ./pear.conf update-channels - pecl -C ./pear.conf install apc
Accept all default valuesmake: *** [apc_cache.lo] Error 1
ERROR: `make' failed
- /opt/php-5.6.40/bin/pecl install memcache
Installing '/opt/php-5.6.40/lib/php/extensions/no-debug-non-zts-20131226/memcache.so'
install ok: channel://pecl.php.net/memcache-2.2.7
configuration option "php_ini" is not set to php.ini location
You should add "extension=memcache.so" to php.ini - /opt/php-5.6.40/bin/pecl install apcu
pecl/apcu requires PHP (version >= 7.0.0-dev), installed version is 5.6.40/opt/php-5.6.40/bin/pecl install apcu-4.0.11
-
pecl -C ./pear.conf install memcache yum install libmemcached-devel- /opt/php-5.6.40/bin/pecl install memcached
pecl/memcached requires PHP (version >= 7.0.0), installed version is 5.6.40
pecl/memcached can optionally use PHP extension "igbinary" (version >= 2.0)
pecl/memcached can optionally use PHP extension "msgpack" (version >= 2.0) - find / -name "*ioncube_loader_lin_5.6*"
- cp /usr/lib64/php/modules/ioncube/ioncube_loader_lin_5.6.so /opt/php-5.6.40/lib/php/extensions/no-debug-non-zts-20131226/ioncube.so
- nano /opt/php-5.6.40/lib/php.ini
zend_extension=/opt/php-5.6.40/lib/php/extensions/no-debug-non-zts-20131226/ioncube.so
zend_extension=/opt/php-5.6.40/lib/php/extensions/no-debug-non-zts-20131226/opcache.so - /etc/init.d/php-5.6.40-fpm reload
- php -v
- cd /opt/php-5.6.40/bin
- ./php --version
- ln -s /opt/php-5.6.40/bin/php /usr/local/bin/php-56
- php-56 -v
- nano /var/www/cgi-bin/php56.fcgi
#!/bin/bash
PHPRC=" /opt/php-5.6.40/lib/php.ini"
PHP_CGI=/opt/php-5.6.40/bin/php-cgi
PHP_FCGI_CHILDREN=8
PHP_FCGI_MAX_REQUESTS=3000
export PHPRC
export PHP_FCGI_CHILDREN
export PHP_FCGI_MAX_REQUESTS
exec $PHP_CGI
- chown apache:apache /var/www/cgi-bin/php56.fcgi
- chmod +x /var/www/cgi-bin/php56.fcgi
wget https://pecl.php.net/get/memcache-2.2.0.tgztar xzvf memcache-2.2.0.tgzcd memcache-2.2.0/opt/php-5.6.40/bin/phpize./configure --enable-memcache --with-php-config=/opt/php-5.6.40/bin/php-configmake && make installnano /opt/php-5.6.40/lib/php.ini
- mkdir /usr/local/src/php5-build/php-xdebug
- cd /usr/local/src/php5-build/php-xdebug
- wget http://xdebug.org/files/xdebug-2.5.5.tgz
- tar -xvzf xdebug-2.5.5.tgz
- cd xdebug-2.5.5
- /opt/php-5.6.40/bin/phpize
- ./configure --with-php-config=/opt/php-5.6.40/bin/php-config && make
- make test
- /opt/php-5.6.40/bin/php -i | grep extension_dir
- cp modules/xdebug.so /opt/php-5.6.40/lib/php/extensions/no-debug-non-zts-20131226/
- nano /opt/php-5.6.40/lib/php.ini
;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;
extension=/opt/php-5.6.40/lib/php/extensions/no-debug-non-zts-20131226/memcache.so
zend_extension=/opt/php-5.6.40/lib/php/extensions/no-debug-non-zts-20131226/ioncube.so
zend_extension=/opt/php-5.6.40/lib/php/extensions/no-debug-non-zts-20131226/opcache.so
zend_extension=/opt/php-5.6.40/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so
PHP-7.2.32 - mkdir /opt/php-7.2.32
- mkdir /usr/local/src/php7-build
- cd /usr/local/src/php7-build
- wget hk1.php.net/get/php-7.2.32.tar.gz/from/this/mirror -O php-7.2.32.tar.gz
- tar xzvf php-7.2.32.tar.gz
- cd php-7.2.32
./configure --prefix=/opt/php-7.2.32 --with-libdir=lib64 --disable-rpath --with-libxml-dir=/usr --with-openssl --with-kerberos --with-pcre-regex --with-zlib --enable-bcmath --with-bz2 --enable-calendar --with-curl --with-enchant --enable-exif --enable-ftp --with-gd --with-openssl-dir --with-jpeg-dir=/usr --with-png-dir=/usr --with-zlib-dir --with-freetype-dir --with-gettext --with-mhash --with-imap --with-imap-ssl --enable-mbstring --with-mysqli=/usr/bin/mysql_config --enable-opcache --enable-pcntl --with-pdo-mysql --with-pdo-pgsql --with-pgsql --with-pspell --enable-soap --enable-sockets --enable-sysvsem --enable-sysvshm --with-xmlrpc --with-xsl --enable-zip --enable-inline-optimization --enable-mbregex --with-valgrind --with-fpm-user=apache --with-fpm-group=apache --enable-fpm --enable-cgi
- make
- {make test}
make install
/opt/php-7.2.32/bin/pear install PHP_Archive-0.12.0
/opt/php-7.2.32/bin/pear install channel://pear.php.net/Console_GetoptPlus-1.0.0RC1
- cp /usr/local/src/php7-build/php-7.2.32/php.ini-production /opt/php-7.2.32/lib/php.ini
- cp /opt/php-7.2.32/etc/php-fpm.conf.default /opt/php-7.2.32/etc/php-fpm.conf
- cp /opt/php-7.2.32/etc/php-fpm.d/www.conf.default /opt/php-7.2.32/etc/php-fpm.d/www.conf
- nano /opt/php-7.2.32/etc/php-fpm.conf
[...]
pid = run/php-fpm.pid
[...] - nano /opt/php-7.2.32/etc/php-fpm.d/www.conf
[...]
listen = 127.0.0.1:8970
[...]
- nano /etc/init.d/php-7.2.32-fpm
#! /bin/sh
### BEGIN INIT INFO
# Provides: php-7.2.32-fpm
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts php-7.2.32-fpm
# Description: starts the PHP FastCGI Process Manager daemon
### END INIT INFO
php_fpm_BIN=/opt/php-7.2.32/sbin/php-fpm
php_fpm_CONF=/opt/php-7.2.32/etc/php-fpm.conf
php_fpm_PID=/opt/php-7.2.32/var/run/php-fpm.pid
php_opts="--fpm-config $php_fpm_CONF"
wait_for_pid () {
try=0
while test $try -lt 35 ; do
case "$1" in
'created')
if [ -f "$2" ] ; then
try=''
break
fi
;;
'removed')
if [ ! -f "$2" ] ; then
try=''
break
fi
;;
esac
echo -n .
try=`expr $try + 1`
sleep 1
done
}
case "$1" in
start)
echo -n "Starting php-fpm "
$php_fpm_BIN $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
;;
stop)
echo -n "Gracefully shutting down php-fpm "
if [ ! -r $php_fpm_PID ] ; then
echo "warning, no pid file found - php-fpm is not running ?"
exit 1
fi
kill -QUIT `cat $php_fpm_PID`
wait_for_pid removed $php_fpm_PID
if [ -n "$try" ] ; then
echo " failed. Use force-exit"
exit 1
else
echo " done"
echo " done"
fi
;;
force-quit)
echo -n "Terminating php-fpm "
if [ ! -r $php_fpm_PID ] ; then
echo "warning, no pid file found - php-fpm is not running ?"
exit 1
fi
kill -TERM `cat $php_fpm_PID`
wait_for_pid removed $php_fpm_PID
if [ -n "$try" ] ; then
echo " failed"
exit 1
else
echo " done"
fi
;;
restart)
$0 stop
$0 start
;;
reload)
echo -n "Reload service php-fpm "
if [ ! -r $php_fpm_PID ] ; then
echo "warning, no pid file found - php-fpm is not running ?"
exit 1
fi
kill -USR2 `cat $php_fpm_PID`
echo " done"
;;
*)
echo "Usage: $0 {start|stop|force-quit|restart|reload}"
exit 1
;;
esac - chmod 755 /etc/init.d/php-7.2.32-fpm
- chkconfig --levels 235 php-7.2.32
- service php-7.2.32-fpm start
- cd /usr/local/src/php7-build
- wget https://pecl.php.net/get/apcu-5.1.17.tgz
- tar xzvf apcu-5.1.17.tgz
- cd apcu-5.1.17
- /opt/php-7.2.32/bin/phpize
- ./configure --enable-apcu --with-php-config=/opt/php-7.2.32/bin/php-config
- make
- make test
- make install
- /opt/php-7.2.32/bin/php -i | grep extension_dir
cp modules/apcu.so /opt/php-7.2.32/lib/php/extensions/no-debug-non-zts-20170718/- service php-7.2.32-fpm restart
- service httpd restart
- find / -name "*ioncube_loader_lin_7.2*"
- cp /usr/lib64/php/modules/ioncube/ioncube_loader_lin_7.2.so /opt/php-7.2.32/lib/php/extensions/no-debug-non-zts-20170718/ioncube.so
- /opt/php-7.2.32/bin/pecl install xdebug
- nano /opt/php-7.2.32/lib/php.ini
[...]
extension=apcu.so
apc.enabled=1
apc.shm_size=128M
apc.ttl=0
apc.gc_ttl=600
apc.enable_cli=1
apc.mmap_file_mask=/tmp/apc.XXXXXX
;apc.mmap_file_mask=/dev/zero
;apc.shm_segments = 5
zend_extension = ioncube.so
zend_extension = opcache.so
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
opcache.enable_cli=1
zend_extension = /opt/php-7.2.32/lib/php/extensions/no-debug-non-zts-20170718/xdebug.so -
[opcache] opcache.enable=1 opcache.memory_consumption=1024 opcache.interned_strings_buffer=256 opcache.max_accelerated_files=100000 opcache.validate_timestamps=1 opcache.revalidate_freq=5 opcache.save_comments=1 opcache.use_cwd=1 opcache.enable_file_override=0 opcache.enable_cli=0 opcache.max_wasted_percentage=10 opcache.interned_strings_buffer=256 opcache.fast_shutdown=1 opcache.huge_code_pages=0 opcache.optimization_level=-1 opcache.log_verbosity_level=2
- service php-7.2.32-fpm restart
- service httpd restart
- /opt/php-7.2.32/bin/php -i | grep apcu
mkdir /usr/local/src/php7-build/php-xdebugcd /usr/local/src/php7-build/php-xdebugwget http://xdebug.org/files/xdebug-2.6.0.tgztar xzf xdebug-2.6.0.tgzcd xdebug-2.6.0/opt/php-7.2.32/bin/phpize./configure --with-php-config=/opt/php-7.2.32/bin/php-config && make/opt/php-7.2.32/bin/php -i | grep extension_dircp modules/xdebug.so /opt/php-7.2.32/lib/php/extensions/no-debug-non-zts-20170718- nano /opt/php-7.2.32/lib/php.ini
- service php-7.2.32-fpm restart
- service httpd restart
- nano /var/www/cgi-bin/php72.fcgi
#!/bin/bash
PHPRC=" /opt/php-7.2.32/lib/php.ini"
PHP_CGI2=/opt/php-7.2.32/bin/php-cgi
PHP_FCGI_CHILDREN=8
PHP_FCGI_MAX_REQUESTS=3000
export PHPRC
export PHP_FCGI_CHILDREN
export PHP_FCGI_MAX_REQUESTS
exec $PHP_CGI2
chown apache:apache /var/www/cgi-bin/php72.fcgi
chmod +x /var/www/cgi-bin/php72.fcgi
Memcached extension
/opt/php-7.2.32/bin/pecl install memcached
updatedb
locate memcached.ini
nano /opt/php-7.2.32/lib/php/doc/memcached/memcached.ini
Copy records to php.ini
extension=memcached.so
[memcached]
; Use session locking
; valid values: On, Off
; the default is On
;memcached.sess_locking = On
; The minimum time, in milliseconds, to wait between session lock attempts.
; This value is double on each lock retry until memcached.sess_lock_wait_max
; is reached, after which any further retries will take sess_lock_wait_max seconds.
; Default is 150.
;memcached.sess_lock_wait_min = 150;
; The maximum time, in milliseconds, to wait between session lock attempts.
; Default is 150.
;memcached.sess_lock_wait_max = 150;
; The number of times to retry locking the session lock, not including the first attempt.
; Default is 5.
;memcached.sess_lock_retries = 5;
; The time, in seconds, before a lock should release itself.
; Setting to 0 results in the default behaviour, which is to
; use PHP's max_execution_time.
;memcached.sess_lock_expire = 0;
; memcached session key prefix
; valid values are strings less than 219 bytes long
; the default value is "memc.sess.key."
;memcached.sess_prefix = "memc.sess.key."
; Whether or not to re-use the memcached connections corresponding to the value(s)
; of session.save_path after the execution of the script ends.
; Don't use this if certain settings (e.g. SASL settings, sess_binary_protocol) would
; be overridden between requests.
; Default is Off.
;memcached.sess_persistent = Off
; memcached session consistent hash mode
; if set to On, consistent hashing (libketama) is used
; for session handling.
; When consistent hashing is used, one can add or remove cache
; node(s) without messing up too much with existing keys
; default is On
;memcached.sess_consistent_hash = On
; memcached session consistent hash type
; if set to 'ketama', consistent hashing (libketama) is used
; for session handling (default for php-memcached 3.x)
; if set to 'ketama_weighted', weighted consistent hashing (libketama) is used
; for session handling (default for php-memcached 2.x)
;memcached.sess_consistent_hash_type = "ketama"
; Allow failed memcached server to automatically be removed.
; Default is Off. (In previous versions, this setting was called memcached.sess_remove_failed)
;memcached.sess_remove_failed_servers = Off
; Set this value to enable the server be removed after
; configured number of continuous times connection failure.
;memcached.sess_server_failure_limit = 0
; Write data to a number of additional memcached servers
; This is "poor man's HA" as libmemcached calls it.
; If this value is positive and sess_remove_failed is enabled
; when a memcached server fails the session will continue to be available
; from a replica. However, if the failed memcache server
; becomes available again it will read the session from there
; which could have old data or no data at all
;memcached.sess_number_of_replicas = 0
; Use the memcached binary protocol for memcached sessions (Instead of the text protocol)
; libmemcached replicas work only if binary mode is enabled.
; However, certain proxies (such as twemproxy) will work only if the binary protocol is disabled.
; In older versions of php-memcached, this setting was Off and was called memcached.sess_binary.
; Default is On with libmemcached 1.0.18 or newer.
; Default is Off with older version.
;memcached.sess_binary_protocol = On
; memcached session replica read randomize
;memcached.sess_randomize_replica_read = Off
; memcached connect timeout value
; In non-blocking mode this changes the value of the timeout
; during socket connection in milliseconds. Specifying -1 means an infinite timeout.
;memcached.sess_connect_timeout = 1000
; Session SASL username
; Both username and password need to be set for SASL to be enabled
; In addition to this memcached.use_sasl needs to be on
;memcached.sess_sasl_username = NULL
; Session SASL password
;memcached.sess_sasl_password = NULL
; Set the compression type
; valid values are: fastlz, zlib
; the default is fastlz
;memcached.compression_type = "fastlz"
; Compression factor
; Store compressed value only if the compression
; factor (saving) exceeds the set limit.
;
; store compressed if:
; plain_len > comp_len * factor
;
; the default value is 1.3 (23% space saving)
;memcached.compression_factor = "1.3"
; The compression threshold
;
; Do not compress serialized values below this threshold.
; the default is 2000 bytes
;memcached.compression_threshold = 2000
; Set the default serializer for new memcached objects.
; valid values are: php, igbinary, json, json_array, msgpack
;
; json - standard php JSON encoding. This serializer
; is fast and compact but only works on UTF-8
; encoded data and does not fully implement
; serializing. See the JSON extension.
; json_array - as json, but decodes into arrays
; php - the standard php serializer
; igbinary - a binary serializer
; msgpack - a cross-language binary serializer
;
; The default is igbinary if available, then msgpack if available, then php otherwise.
;memcached.serializer = "igbinary"
; The amount of retries for failed store commands.
; This mechanism allows transparent fail-over to secondary servers when
; set/increment/decrement/setMulti operations fail on the desired server in a multi-server
; environment.
; the default is 2
;memcached.store_retry_count = 2
; Sets the default for consistent hashing for new connections.
; (To configure consistent hashing for session connections,
; use memcached.sess_consistent_hash instead)
;
; If set to On, consistent hashing (libketama) is used
; for session handling.
; When consistent hashing is used, one can add or remove cache
; node(s) without messing up too much with existing keys
; default is Off
;memcached.default_consistent_hash = Off
; Sets the default memcached protocol for new connections.
; (To configure the memcached protocol for connections used by sessions,
; use memcached.sess_binary_protocol instead)
;
; If set to On, the memcached binary protocol is used by default.
; If set to Off, the memcached text protocol is used.
; Default is Off
;memcached.default_binary_protocol = Off
; Sets the default memcached connection timeout for new connections.
; (To configure the memcached connection timeout for sessions,
; use memcached.sess_connect_timeout instead)
; In non-blocking mode this changes the value of the timeout.
; during socket connection in milliseconds. Specifying -1 means an infinite timeout.
; Specifying 0 means using the memcached library's default connection timeout.
; Default is 0.
;memcached.default_connect_timeout = 0
grep 'date.timezone' /opt/php-7.2.32/lib/php.ini
sed -i "s|;date.timezone =|date.timezone = 'Asia\/Seoul'|" /opt/php-7.2.32/lib/php.ini
grep 'date.timezone' /opt/php-7.2.32/lib/php.ini
PHP-5.4.45
./configure --htmldir=/html-docs --with-libdir=lib64 --enable-rpath --enable-re2c-cgoto --enable-cli --enable-fpm --with-fpm-user=apache --with-fpm-group=apache --with-fpm-systemd --enable-cgi --with-layout=GNU --bindir=/bin --sbindir=/sbin --libexecdir=/lib64 --datadir=/share --sysconfdir=/etc --sharedstatedir=/com --localstatedir=/var --libdir=/lib64 --includedir=/include --infodir=/share/info --mandir=/share/man --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --cache-file=../config.cache --disable-debug --with-layout=GNU --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --enable-short-tags --enable-libgcc --enable-dtrace --enable-libxml --with-libxml-dir=/usr --with-openssl --with-kerberos --with-pcre-regex --with-zlib --enable-bcmath --with-bz2 --enable-calendar --enable-ctype --with-curl --enable-dba --enable-inifile --enable-flatfile --enable-dom --with-libxml-dir --with-enchant=shared,/usr --enable-exif --with-pcre-dir --enable-ftp --with-openssl-dir --with-gd --with-vpx-dir=/usr --with-jpeg-dir=/usr --with-png-dir=/usr --with-zlib-dir --with-freetype-dir=/usr --with-t1lib --enable-gd-native-ttf --with-gettext --with-mhash --enable-hash --with-imap --with-kerberos --with-imap-ssl --with-interbase=/usr/interbase --enable-intl --with-icu-dir=/usr --enable-json --with-ldap --with-ldap-sasl --enable-mbstring --disable-pcntl --disable-pdo --enable-phar=shared --enable-posix --with-zlib-dir --with-pspell=shared --with-libedit --with-readline --enable-session --enable-shmop --enable-simplexml --with-libxml-dir --with-snmp --with-openssl-dir --enable-soap --with-libxml-dir --disable-sockets --enable-sysvmsg=shared --enable-sysvsem=shared --enable-sysvshm=shared --with-tidy --enable-tokenizer --enable-wddx --with-libxml-dir --enable-xml --with-libxml-dir --enable-xmlreader --with-libxml-dir --with-xmlrpc --with-libxml-dir --with-xsl --enable-zip --with-zlib-dir --with-pcre-dir --enable-mysqlnd --enable-mysqlnd-compression-support --with-zlib-dir --with-pear --with-zend-vm=GOTO --enable-inline-optimization
Installing shared extensions: /lib64/20100525-debug/
Installing PHP CLI binary: /bin/
Installing PHP CLI man page: /share/man/man1/
Installing PHP FPM binary: /sbin/
Installing PHP FPM config: /etc/
Installing PHP FPM man page: /share/man/man8/
Installing PHP FPM status page: /share/fpm/
Installing PHP CGI binary: /bin/
Installing PHP CGI man page: /share/man/man1/
Installing build environment: /lib64/build/
Installing header files: /include/php/
Installing helper programs: /bin/
program: phpize
program: php-config
Installing man pages: /share/man/man1/
page: phpize.1
page: php-config.1
Installing PEAR environment: /share/pear/
[PEAR] Archive_Tar - installed: 1.3.12
[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: /etc/pear.conf
You may want to add: /share/pear to your php.ini include_path
/tmp/php-5.4.45/build/shtool install -c ext/phar/phar.phar /bin
ln -s -f /bin/phar.phar /bin/phar
- PHP-8.1.14
- mkdir /opt/php-8.1.14
- mkdir /usr/local/src/php8-build
- cd /usr/local/src/php8-build
- wget https://www.php.net/distributions/php-8.1.14.tar.bz2
tar jxf php-8.1.14.tar.bz2
wget hk1.php.net/get/php-8.1.14.tar.gz/from/this/mirror -O php-8.1.14.tar.gztar xzvf php-8.1.14.tar.gz- cd php-8.1.14
./configure --prefix=/opt/php-8.1.14 --with-libdir=lib64 --disable-rpath \
--with-openssl --with-kerberos --with-zlib --enable-bcmath --with-bz2 --enable-calendar \
--with-zip --enable-gd --with-webp --with-jpeg --with-enchant --with-freetype \
--with-curl --enable-exif --enable-ftp --with-zlib-dir --with-gettext \
--with-mhash --with-imap --with-imap-ssl \
--enable-intl --enable-mbstring --with-mysqli=/usr/bin/mysql_config --enable-opcache --enable-pcntl --with-pdo-mysql --with-pdo-pgsql --with-pgsql --enable-soap --with-tidy --enable-sockets --enable-sysvsem --enable-sysvshm --with-xsl --enable-mbregex --with-fpm-user=apache --with-fpm-group=apache --enable-fpm --enable-cgi PKG_CONFIG_PATH=/usr/local/src/libzip-1.7.3/build
- make
- {make test}
make install
Installing shared extensions: /opt/php-8.1.14/lib/php/extensions/no-debug-non-zts-20210902/Installing PHP CLI binary: /opt/php-8.1.14/bin/
Installing PHP CLI man page: /opt/php-8.1.14/php/man/man1/
Installing PHP FPM binary: /opt/php-8.1.14/sbin/
Installing PHP FPM defconfig: /opt/php-8.1.14/etc/
Installing PHP FPM man page: /opt/php-8.1.14/php/man/man8/
Installing PHP FPM status page: /opt/php-8.1.14/php/php/fpm/
Installing phpdbg binary: /opt/php-8.1.14/bin/
Installing phpdbg man page: /opt/php-8.1.14/php/man/man1/
Installing PHP CGI binary: /opt/php-8.1.14/bin/
Installing PHP CGI man page: /opt/php-8.1.14/php/man/man1/
Installing build environment: /opt/php-8.1.14/lib/php/build/
Installing header files: /opt/php-8.1.14/include/php/
Installing helper programs: /opt/php-8.1.14/bin/
- cp /usr/local/src/php8-build/php-8.1.14/php.ini-production /opt/php-8.1.14/lib/php.ini
- cp /opt/php-8.1.14/etc/php-fpm.conf.default /opt/php-8.1.14/etc/php-fpm.conf
- cp /opt/php-8.1.14/etc/php-fpm.d/www.conf.default /opt/php-8.1.14/etc/php-fpm.d/www.conf
mkdir /opt/php-8.1.14/etc/pool.d
- nano /opt/php-8.1.14/etc/php-fpm.conf
[...]
pid = run/php-fpm.pid
[...] - nano /opt/php-8.1.14/etc/php-fpm.d/www.conf
[...]
listen = 127.0.0.1:8991
[...]
- nano /etc/init.d/php-8.1.14-fpm
#! /bin/sh
### BEGIN INIT INFO
# Provides: php-8.1.14-fpm
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts php-8.1.14-fpm
# Description: starts the PHP FastCGI Process Manager daemon
### END INIT INFO
php_fpm_BIN=/opt/php-8.1.14/sbin/php-fpm
php_fpm_CONF=/opt/php-8.1.14/etc/php-fpm.conf
php_fpm_PID=/opt/php-8.1.14/var/run/php-fpm.pid
php_opts="--fpm-config $php_fpm_CONF"
wait_for_pid () {
try=0
while test $try -lt 35 ; do
case "$1" in
'created')
if [ -f "$2" ] ; then
try=''
break
fi
;;
'removed')
if [ ! -f "$2" ] ; then
try=''
break
fi
;;
esac
echo -n .
try=`expr $try + 1`
sleep 1
done
}
case "$1" in
start)
echo -n "Starting php-fpm "
$php_fpm_BIN $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
;;
stop)
echo -n "Gracefully shutting down php-fpm "
if [ ! -r $php_fpm_PID ] ; then
echo "warning, no pid file found - php-fpm is not running ?"
exit 1
fi
kill -QUIT `cat $php_fpm_PID`
wait_for_pid removed $php_fpm_PID
if [ -n "$try" ] ; then
echo " failed. Use force-exit"
exit 1
else
echo " done"
echo " done"
fi
;;
force-quit)
echo -n "Terminating php-fpm "
if [ ! -r $php_fpm_PID ] ; then
echo "warning, no pid file found - php-fpm is not running ?"
exit 1
fi
kill -TERM `cat $php_fpm_PID`
wait_for_pid removed $php_fpm_PID
if [ -n "$try" ] ; then
echo " failed"
exit 1
else
echo " done"
fi
;;
restart)
$0 stop
$0 start
;;
reload)
echo -n "Reload service php-fpm "
if [ ! -r $php_fpm_PID ] ; then
echo "warning, no pid file found - php-fpm is not running ?"
exit 1
fi
kill -USR2 `cat $php_fpm_PID`
echo " done"
;;
*)
echo "Usage: $0 {start|stop|force-quit|restart|reload}"
exit 1
;;
esac - chmod 755 /etc/init.d/php-8.1.14-fpm
- chkconfig --levels 235 php-8.1.14
service php-8.1.14-fpm start
- nano /opt/php-8.1.14/lib/php.ini
[...]
extension=imagick
extension=memcache
extension=apcu.so
apc.enabled=1
apc.shm_size=128M
apc.ttl=0
apc.gc_ttl=600
apc.enable_cli=1
apc.mmap_file_mask=/tmp/apc.XXXXXX
;apc.mmap_file_mask=/dev/zero
;apc.shm_segments = 5
zend_extension = opcache.so
opcache.memory_consumption=256
opcache.interned_strings_buffer=32
opcache.max_accelerated_files=10000
opcache.revalidate_freq=30
opcache.fast_shutdown=1
opcache.enable_cli=1
-
[opcache] opcache.enable=1 opcache.memory_consumption=1024 opcache.interned_strings_buffer=256 opcache.max_accelerated_files=100000 opcache.validate_timestamps=1 opcache.revalidate_freq=5 opcache.save_comments=1 opcache.use_cwd=1 opcache.enable_file_override=0 opcache.enable_cli=0 opcache.max_wasted_percentage=10 opcache.interned_strings_buffer=256 opcache.fast_shutdown=1 opcache.huge_code_pages=0 opcache.optimization_level=-1 opcache.log_verbosity_level=2
nano /var/www/cgi-bin/php81.fcgi
#!/bin/bash
PHPRC=" /opt/php-8.1.14/lib/php.ini"
PHP_CGI2=/opt/php-8.1.14/bin/php-cgi
PHP_FCGI_CHILDREN=0
PHP_FCGI_MAX_REQUESTS=3000
export PHPRC
export PHP_FCGI_CHILDREN
export PHP_FCGI_MAX_REQUESTS
exec $PHP_CGI2
chown apache:apache /var/www/cgi-bin/php81.fcgi
chmod +x /var/www/cgi-bin/php81.fcgi
- service php-8.1.14-fpm restart
- service httpd restart
Additional modules/extensions
APCu
cd /usr/local/src/php8-build
wget https://pecl.php.net/get/apcu-5.1.22.tgz
tar xzvf apcu-5.1.22.tgz
cd apcu-5.1.22
/opt/php-8.1.14/bin/phpize
./configure --enable-apcu --with-php-config=/opt/php-8.1.14/bin/php-config
make
make install
/opt/php-8.1.14/bin/php -i | grep extension_dir
/opt/php-8.1.14/bin/php -i | grep "apc"
ImageMagick
yum install ImageMagick ImageMagick-devel
cd /usr/local/src/php8-build
wget https://pecl.php.net/get/imagick-3.7.0.tgz
tar xzvf imagick-3.7.0.tgz
cd imagick-3.7.0
/opt/php-8.1.14/bin/phpize
./configure --with-php-config=/opt/php-8.1.14/bin/php-config
make
make install
/opt/php-8.1.14/bin/php -i | grep "magick"
Memcache extension
cd /usr/local/src/php8-build
wget https://pecl.php.net/get/memcache-8.0.tgz
tar xzvf memcache-8.0.tgz
cd memcache-8.0
/opt/php-8.1.14/bin/phpize
./configure --with-php-config=/opt/php-8.1.14/bin/php-config
make
make install
/opt/php-8.1.14/bin/php -i | grep "memcache"
grep 'date.timezone' /opt/php-8.1.14/lib/php.ini
sed -i "s|;date.timezone =|date.timezone = 'Asia\/Seoul'|" /opt/php-8.1.14/lib/php.ini
grep 'date.timezone' /opt/php-8.1.14/lib/php.ini