Skip to content

Instantly share code, notes, and snippets.

@latuminggi
Created March 11, 2020 03:48
Show Gist options
  • Save latuminggi/602556a94c53b91c9b53c83f3c07df96 to your computer and use it in GitHub Desktop.
Save latuminggi/602556a94c53b91c9b53c83f3c07df96 to your computer and use it in GitHub Desktop.
COMPILE PHP 7.2 UBUNTU 14.04 LTS
### COMPILE PHP 7.2 UBUNTU 14.04 LTS ###
## https://www.howtoforge.com/tutorial/how-to-compile-and-install-php-7.4-on-ubuntu-18-04
## https://www.fastnetserv.com/how-to-install-php-7-2-on-ubuntu-14-04-ispconfig-3-1
## https://www.php.net/manual/en/imap.requirements.php
cd /tmp
## clone imap src
git clone https://github.com/uw-imap/imap.git
cd /tmp/imap
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
## download & extract php 7
cd /tmp/php-7.2.28
./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-intl --with-pear --with-imap-ssl=/tmp/imap --enable-fpm
make test
make install
cp 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
sed -i 's/;pid = run\/php-fpm.pid/pid = run\/php-fpm.pid/g' /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
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 /opt/php-7.2/etc
../bin/pecl -C ./pear.conf update-channels
../bin/pecl -C ./pear.conf install memcached
echo extension=memcached.so >> /opt/php-7.2/lib/php.ini
mkdir /opt/php-7.2/exec
cd /opt/php-7.2/exec
nano start
## paste
<?php exec('/opt/php-7.2/sbin/php-fpm --nodaemonize --fpm-config /opt/php-7.2/etc/php-fpm.conf </dev/null &>/dev/null &'); echo "Service started!\n";
nano stop
## paste
<?php $port = 9072; exec('/bin/kill -9 $(lsof -t -i:'. $port .') &'); echo "Port ". $port ." has been killed!\n";
nano restart
## paste
<?php require_once('/opt/php-7.2/exec/stop'); require_once('/opt/php-7.2/exec/start'); echo "Restarted!\n";
crontab -e
## add
@reboot /usr/bin/php /opt/php-7.2/exec/start
## to start ==> /usr/bin/php /opt/php-7.2/exec/start
## to restart ==> /usr/bin/php /opt/php-7.2/exec/restart
## to stop ==> /usr/bin/php /opt/php-7.2/exec/stop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment