Last active
September 28, 2020 14:15
-
-
Save latuminggi/e9d66395e3d4ac673c62a5fc755d3c1d to your computer and use it in GitHub Desktop.
COMPILE PHP 7.2 UBUNTU 14.04 LTS extending fastnetserv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### COMPILE PHP 7.2 UBUNTU 14.04 LTS ### | |
### https://www.fastnetserv.com/how-to-install-php-7-2-on-ubuntu-14-04-ispconfig-3-1 | |
# installing dependencies | |
apt-get install build-essential nano libfcgi-dev libfcgi0ldbl libjpeg-turbo8-dbg libmcrypt-dev libssl-dev libc-client2007e \ | |
libc-client2007e-dev libxml2-dev libbz2-dev libcurl4-openssl-dev libjpeg-dev libpng12-dev libfreetype6-dev \ | |
libkrb5-dev libpq-dev libxml2-dev libxslt1-dev \ | |
libaspell-dev libpspell-dev libreadline-dev libtidy-dev libgmp-dev libssh2-1-dev unixodbc-dev && \ | |
ln -s /usr/lib/libc-client.a /usr/lib/x86_64-linux-gnu/libc-client.a | |
# installing imap | |
cd /tmp && \ | |
wget https://github.com/uw-imap/imap/archive/master.zip -O imap.zip && \ | |
unzip imap.zip && \ | |
cd /tmp/imap-master && \ | |
make lnp EXTRACFLAGS=-fPIC EXTRAAUTHENTICATORS=gss | |
mkdir lib && \ | |
mkdir include && \ | |
cp c-client/*.c lib/ && \ | |
cp c-client/*.h include/ && \ | |
cp c-client/c-client.a lib/libc-client.a | |
# compiling php | |
mkdir -p /opt/php-7.2 && \ | |
mkdir -p /usr/local/src/php7-build && \ | |
cd /usr/local/src/php7-build && \ | |
wget http://de2.php.net/get/php-7.2.33.tar.bz2/from/this/mirror -O php-7.2.33.tar.bz2 && \ | |
tar jxf php-7.2.33.tar.bz2 && \ | |
cd php-7.2.33 | |
./configure --prefix=/opt/php-7.2 --with-pdo-pgsql --with-zlib-dir --with-freetype-dir --enable-mbstring --with-libxml-dir=/usr --enable-soap --enable-calendar --with-curl --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 --enable-exif --enable-bcmath --with-mhash --enable-zip --with-pcre-regex --with-pdo-mysql --with-mysqli --with-mysql-sock=/var/run/mysqld/mysqld.sock --with-jpeg-dir=/usr --with-png-dir=/usr --with-openssl --with-fpm-user=www-data --with-fpm-group=www-data --with-libdir=/lib/x86_64-linux-gnu --enable-ftp --with-kerberos --with-gettext --with-xmlrpc --with-xsl --enable-opcache --enable-fpm --enable-intl --with-pdo-oci --enable-dba --with-gmp --with-imap-ssl=/tmp/imap-master --with-ldap --with-ldap-sasl --with-mhash --with-pspell --with-readline --enable-shmop --with-tidy --enable-wddx --with-pdo-odbc=unixODBC,/usr | |
make && \ | |
make test && \ | |
make install | |
## start copying configs to the right places. | |
## p.s once already execute & running should NOT be redo ! | |
cp /usr/local/src/php7-build/php-7.2.33/php.ini-production /opt/php-7.2/lib/php.ini && \ | |
cp /opt/php-7.2/etc/php-fpm.conf.default /opt/php-7.2/etc/php-fpm.conf && \ | |
cp /opt/php-7.2/etc/php-fpm.d/www.conf.default /opt/php-7.2/etc/php-fpm.d/www.conf | |
nano /opt/php-7.2/etc/php-fpm.conf | |
## add/change following | |
pid = run/php-7.2-fpm.pid | |
nano /opt/php-7.2/etc/php-fpm.d/www.conf | |
## add/change following | |
listen = 127.0.0.1:9072 | |
sed -i 's/;date.timezone =/date.timezone = "Asia\/Jakarta"/g' /opt/php-7.2/lib/php.ini && \ | |
sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /opt/php-7.2/lib/php.ini | |
cd /etc/init.d/ && \ | |
wget https://gist.githubusercontent.com/latuminggi/e9d66395e3d4ac673c62a5fc755d3c1d/raw/d5c653f816e393e5380c28f972143860cff28b8a/php-7.2-fpm && \ | |
chmod 755 /etc/init.d/php-7.2-fpm && \ | |
update-rc.d php-7.2-fpm defaults | |
## end of configs | |
### php extensions ### | |
# ls -al /opt/php-7.2/lib/php/extensions/no-debug-non-zts-20170718/ | |
# using pecl | |
cd /opt/php-7.2/etc | |
../bin/pecl -C ./pear.conf update-channels | |
../bin/pecl -C ./pear.conf install memcached | |
# installing apcu ==== | |
cd /usr/local/src/php7-build && \ | |
wget https://pecl.php.net/get/apcu-5.1.18.tgz && \ | |
tar xvf apcu-5.1.18.tgz && \ | |
cd apcu-5.1.18 && \ | |
/opt/php-7.2/bin/phpize && \ | |
./configure --with-php-config=/opt/php-7.2/bin/php-config && \ | |
make && \ | |
make test && \ | |
make install | |
# installing apcu_bc ==== | |
cd /usr/local/src/php7-build && \ | |
wget https://pecl.php.net/get/apcu_bc-1.0.5.tgz && \ | |
tar xvf apcu_bc-1.0.5.tgz && \ | |
cd apcu_bc-1.0.5 && \ | |
/opt/php-7.2/bin/phpize && \ | |
./configure --with-php-config=/opt/php-7.2/bin/php-config && \ | |
make && \ | |
make test && \ | |
make install | |
# installing igbinary ==== | |
cd /usr/local/src/php7-build && \ | |
wget https://pecl.php.net/get/igbinary-3.1.5.tgz && \ | |
tar xvf igbinary-3.1.5.tgz && \ | |
cd igbinary-3.1.5 && \ | |
/opt/php-7.2/bin/phpize && \ | |
./configure --with-php-config=/opt/php-7.2/bin/php-config && \ | |
make && \ | |
make test && \ | |
make install | |
# installing imagick ==== | |
cd /usr/local/src && \ | |
wget https://github.com/ImageMagick/ImageMagick/archive/7.0.10-30.tar.gz -O ImageMagick-7.0.10-30.tar.gz && \ | |
tar xvf ImageMagick-7.0.10-30.tar.gz && \ | |
cd ImageMagick-7.0.10-30 && \ | |
./configure && \ | |
make && \ | |
make install | |
cd /usr/local/src/php7-build && \ | |
wget https://pecl.php.net/get/imagick-3.4.4.tgz && \ | |
tar xvf imagick-3.4.4.tgz && \ | |
cd imagick-3.4.4 && \ | |
/opt/php-7.2/bin/phpize && \ | |
./configure --with-php-config=/opt/php-7.2/bin/php-config && \ | |
make && \ | |
make test && \ | |
make install | |
# installing mcrypt ==== | |
cd /usr/local/src/php7-build && \ | |
wget https://pecl.php.net/get/mcrypt-1.0.3.tgz && \ | |
tar xvf mcrypt-1.0.3.tgz && \ | |
cd mcrypt-1.0.3 && \ | |
/opt/php-7.2/bin/phpize && \ | |
./configure --with-php-config=/opt/php-7.2/bin/php-config && \ | |
make && \ | |
make test && \ | |
make install | |
# installing memcache ==== | |
cd /usr/local/src/php7-build && \ | |
wget https://pecl.php.net/get/memcache-4.0.5.2.tgz && \ | |
tar xvf memcache-4.0.5.2.tgz && \ | |
cd memcache-4.0.5.2 && \ | |
/opt/php-7.2/bin/phpize && \ | |
./configure --with-php-config=/opt/php-7.2/bin/php-config && \ | |
make && \ | |
make test && \ | |
make install | |
# installing memcached ==== | |
cd /usr/local/src/php7-build && \ | |
wget https://pecl.php.net/get/memcached-3.1.5.tgz && \ | |
tar xvf memcached-3.1.5.tgz && \ | |
cd memcached-3.1.5 && \ | |
/opt/php-7.2/bin/phpize && \ | |
./configure --with-php-config=/opt/php-7.2/bin/php-config && \ | |
make && \ | |
make test && \ | |
make install | |
# installing redis ==== | |
cd /usr/local/src/php7-build && \ | |
wget https://pecl.php.net/get/redis-5.3.1.tgz && \ | |
tar xvf redis-5.3.1.tgz && \ | |
cd redis-5.3.1 && \ | |
/opt/php-7.2/bin/phpize && \ | |
./configure --with-php-config=/opt/php-7.2/bin/php-config && \ | |
make && \ | |
make test && \ | |
make install | |
# installing mongodb ==== | |
cd /usr/local/src/php7-build && \ | |
wget https://pecl.php.net/get/mongodb-1.8.0.tgz && \ | |
tar xvf mongodb-1.8.0.tgz && \ | |
cd mongodb-1.8.0 && \ | |
/opt/php-7.2/bin/phpize && \ | |
./configure --with-php-config=/opt/php-7.2/bin/php-config && \ | |
make && \ | |
make test && \ | |
make install | |
# installing ssh2 ==== | |
cd /usr/local/src/php7-build && \ | |
wget https://pecl.php.net/get/ssh2-1.2.tgz && \ | |
tar xvf ssh2-1.2.tgz && \ | |
cd ssh2-1.2 && \ | |
/opt/php-7.2/bin/phpize && \ | |
./configure --with-php-config=/opt/php-7.2/bin/php-config && \ | |
make && \ | |
make test && \ | |
make install | |
# installing uploadprogress ==== | |
cd /usr/local/src/php7-build && \ | |
wget https://pecl.php.net/get/uploadprogress-1.1.3.tgz && \ | |
tar xvf uploadprogress-1.1.3.tgz && \ | |
cd uploadprogress-1.1.3 && \ | |
/opt/php-7.2/bin/phpize && \ | |
./configure --with-php-config=/opt/php-7.2/bin/php-config && \ | |
make && \ | |
make test && \ | |
make install | |
# installing msgpack ==== | |
cd /usr/local/src/php7-build && \ | |
wget https://pecl.php.net/get/msgpack-2.1.1.tgz && \ | |
tar xvf msgpack-2.1.1.tgz && \ | |
cd msgpack-2.1.1 && \ | |
/opt/php-7.2/bin/phpize && \ | |
./configure --with-php-config=/opt/php-7.2/bin/php-config && \ | |
make && \ | |
make test && \ | |
make install | |
# installing sqlsrv ==== | |
cd /usr/local/src/php7-build && \ | |
wget https://pecl.php.net/get/sqlsrv-5.8.1.tgz && \ | |
tar xvf sqlsrv-5.8.1.tgz && \ | |
cd sqlsrv-5.8.1 && \ | |
/opt/php-7.2/bin/phpize && \ | |
./configure --with-php-config=/opt/php-7.2/bin/php-config && \ | |
make && \ | |
make test && \ | |
make install | |
# installing pdo_sqlsrv ===== | |
cd /usr/local/src/php7-build && \ | |
wget https://pecl.php.net/get/pdo_sqlsrv-5.8.1.tgz && \ | |
tar xvf pdo_sqlsrv-5.8.1.tgz && \ | |
cd pdo_sqlsrv-5.8.1 && \ | |
/opt/php-7.2/bin/phpize && \ | |
./configure --with-php-config=/opt/php-7.2/bin/php-config && \ | |
make && \ | |
make test && \ | |
make install | |
# installing oci8 ==== | |
cd /usr/local/src/php7-build && \ | |
wget https://pecl.php.net/get/oci8-2.2.0.tgz && \ | |
tar xvf oci8-2.2.0.tgz && \ | |
cd oci8-2.2.0 && \ | |
/opt/php-7.2/bin/phpize && \ | |
./configure --with-php-config=/opt/php-7.2/bin/php-config --with-oci8=instantclient,/opt/oracle/instantclient/ && \ | |
make && \ | |
make test && \ | |
make install | |
# add installed ext(s) | |
echo extension=apcu.so >> /opt/php-7.2/lib/php.ini && \ | |
echo extension=igbinary.so >> /opt/php-7.2/lib/php.ini && \ | |
echo extension=imagick.so >> /opt/php-7.2/lib/php.ini && \ | |
echo extension=mcrypt.so >> /opt/php-7.2/lib/php.ini && \ | |
echo extension=memcached.so >> /opt/php-7.2/lib/php.ini && \ | |
echo extension=memcache.so >> /opt/php-7.2/lib/php.ini && \ | |
echo extension=mongodb.so >> /opt/php-7.2/lib/php.ini && \ | |
echo extension=msgpack.so >> /opt/php-7.2/lib/php.ini && \ | |
echo extension=oci8.so >> /opt/php-7.2/lib/php.ini && \ | |
echo extension=pdo_sqlsrv.so >> /opt/php-7.2/lib/php.ini && \ | |
echo extension=redis.so >> /opt/php-7.2/lib/php.ini && \ | |
echo extension=sqlsrv.so >> /opt/php-7.2/lib/php.ini && \ | |
echo extension=ssh2.so >> /opt/php-7.2/lib/php.ini && \ | |
echo extension=uploadprogress.so >> /opt/php-7.2/lib/php.ini | |
# php-7.2-fpm commands | |
service php-7.2-fpm {start|stop|force-quit|restart|reload} | |
# OR | |
/etc/init.d/php-7.2-fpm {start|stop|force-quit|restart|reload} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: php-7.2-fpm | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts php-7.2-fpm | |
# Description: starts the PHP FastCGI Process Manager daemon | |
### END INIT INFO | |
php_fpm_BIN=/opt/php-7.2/sbin/php-fpm | |
php_fpm_CONF=/opt/php-7.2/etc/php-fpm.conf | |
php_fpm_PID=/opt/php-7.2/var/run/php-7.2-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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment