Compile and Build Apache2 and PHP-Fpm From Source on Linux (Part 2)
Download or copy PHP.
Current Directory ~ src https://www.php.net/downloads.php wget https://www.php.net/distributions/php-7.3.16.tar.gz sudo gunzip php-7.3.16.tar.gz or gzip -d php-7.3.16.tar.gz tar -xvf php-7.3.16.tar.gz
First Install PHP dependencies
- Openssl
- Zlib
- Libxml
- Curl
- Icu
Download and install Openssl if not installed already with Apache2
wget https://www.openssl.org/source/openssl-1.1.1.tar.gz ./configure --prefix=/app/system/opt/lib/openssl make && make install
Download and install Zlib
wget http://www.zlib.net/zlib-1.2.3.tar.gz ./configure --prefix=/app/system/opt/lib/zlib make && make install
Download and install Libxml
wget ftp://xmlsoft.org/libxml2/libxml2-2.9.9.tar.gz ./configure --prefix=/app/system/opt/lib/libxml2 make && make install
Download and install Curl
wget https://curl.haxx.se/download/curl-7.68.0.tar.gz ./configure --prefix=/app/system/opt/lib/curl make && make install or make install PREFIX=/app/system/opt/lib/curl
Download and insall ICU
wget http://archive.ubuntu.com/ubuntu/pool/main/i/icu/icu_60.2.orig.tar.gz make install PREFIX=/app/system/opt/lib/icu
Now Download and install PHP 7.3
Current Directory ~ src wget https://www.php.net/distributions/php-7.3.16.tar.gz tar -xvf php-7.3.16.tar.gz ./configure --prefix=/app/system/opt/php-7.3 \ --enable-fpm \ --enable-mysqlnd \ --enable-bcmath \ --enable-mbstring \ --enable-intl \ --with-openssl=/app/system/opt/lib/openssl \ --enable-zip \ --without-libzip \ --with-zlib-dir=/app/system/opt/lib/zlib \ --with-libxml-dir=/app/system/opt/lib/libxml2 \ --with-curl=/app/system/opt/lib/curl \ --with-pdo-mysql=mysqlnd \ --with-pear \ --enable-ftp \ --with-icu-dir=/app/system/opt/lib/icu
# For PHP 7.2 wget https://www.php.net/distributions/php-7.2.29.tar.gz tar -xvf php-7.2.29.tar.gz ./configure --prefix=/app/system/opt/php-7.2 \ --enable-fpm \ --enable-mysqlnd \ --enable-bcmath \ --enable-mbstring \ --enable-intl \ --with-openssl=/app/system/opt/lib/openssl \ --enable-zip \ --with-libxml-dir=/app/system/opt/lib/libxml2 \ --with-zlib=/app/system/opt/lib/zlib \ --with-curl=/app/system/opt/lib/curl \ --with-pdo-mysql=mysqlnd \ --with-pear \ --with-icu-dir=/app/system/opt/lib/icu
Copy essential file after compile complete
cd /app/system/src/php-7.3.16 cp php.ini-production /app/system/opt/php-7.3/lib/php.ini cp /app/system/opt/php-7.3/etc/php-fpm.conf.default /app/system/opt/php-7.3/etc/php-fpm.conf cp /app/system/opt/php-7.3/etc/php-fpm.d/www.conf.default /app/system/opt/php-7.3/etc/php-fpm.d/www.conf
To change php-fpm port and user and group edit /app/system/opt/php-7.3/etc/php-fpm.d/www.conf
To start PHP- fpm version
/app/system/opt/php-7.3/sbin/php-fpm --fpm-config /app/system/opt/php-7.3/etc/php-fpm.conf
Check php-fpm is running
netstat -tapn | grep -E ".*9000.*php-fpm"
Stop php-fpm listener
lsof -t -i tcp:9000 | xargs kill -9
Part 1
http://tuts.raihanchow.com/2020/02/12/building-apache2-from-source-on-linux/
