Download PHP source from https://museum.php.net
then save them into ~/Downloads
----- ----- ----- ----- -----
PRE-REQUISITES
$ sudo dnf install -y gcc gcc-c++ make readline-devel zlib-devel flex bison libxml2-devel libxslt-devel openssl-devel perl-devel python3-devel
$ sudo dnf install -y @development-tools @c-development
$ sudo dnf install -y libxml2-devel openssl-devel sqlite-devel zlib-devel libcurl-devel
$ sudo dnf install -y libpq-devel
$ sudo dnf install -y perl-FindBin perl-IPC-Cmd gcc make perl-interpreter
$ sudo dnf install -y perl-Time-Piece
$ sudo dnf install -y oniguruma-devel
$ sudo dnf install -y aspell-devel
$ sudo dnf install -y libtidy-devel
$ sudo dnf install -y libedit-devel
$ sudo dnf install -y libzip-devel
$ sudo dnf install -y gmp-devel
$ sudo dnf install -y net-snmp-devel
$ sudo dnf install -y libsodium-devel
----- ----- ----- ----- -----
Fedora 44 Workstation ships natively with OpenSSL 3.x. Because OpenSSL 3.x introduced major API changes, PHP versions earlier than PHP 8.1 cannot be compiled directly against Fedora's system OpenSSL library.
For older PHP versions, you must compile and install isolated legacy versions of OpenSSL into custom locations (such as /opt/openssl-1.0.2 or /opt/openssl-1.1.1), similar to the procedure shown in your installation steps.
OpenSSL Compatibility Matrix
| PHP Version | Official OpenSSL Requirement | Recommended OpenSSL Version (Fedora 44) | Works with Native Fedora OpenSSL 3.x? |
| PHP 5.6.40 | >= 0.9.8, < 1.1.0 | OpenSSL 1.0.2u
| No (Requires |
| PHP 7.0.33 | >= 0.9.8, < 1.2.0 | OpenSSL 1.0.2u | No (Requires /opt/openssl-1.0.2) |
| PHP 7.1.33 | >= 1.0.1, < 3.0 | OpenSSL 1.0.2u or 1.1.1w | No (Requires /opt/openssl-1.0.2 or /opt/openssl-1.1.1) |
| PHP 7.2.34 | >= 1.0.1, < 3.0 | OpenSSL 1.1.1w | No (Requires /opt/openssl-1.1.1) |
| PHP 7.3.33 | >= 1.0.1, < 3.0 | OpenSSL 1.1.1w | No (Requires /opt/openssl-1.1.1) |
| PHP 7.4.30 | >= 1.0.1, < 3.0 | OpenSSL 1.1.1w | No (Requires /opt/openssl-1.1.1) |
| PHP 8.0.30 | >= 1.0.1, < 3.0 | OpenSSL 1.1.1w | No (Requires /opt/openssl-1.1.1) |
| PHP 8.1.34 | >= 1.0.2, < 4.0 | OpenSSL 3.x (or 1.1.1w) | Yes (Native system OpenSSL) |
| PHP 8.2.32 | >= 1.0.2, < 4.0 | OpenSSL 3.x | Yes (Native system OpenSSL) |
| PHP 8.3.32 | >= 1.0.2, < 4.0 | OpenSSL 3.x | Yes (Native system OpenSSL) |
| PHP 8.4.24 | >= 1.1.1, < 4.0 | OpenSSL 3.x | Yes (Native system OpenSSL) |
| PHP 8.5.9 | >= 1.1.1, < 4.0 | OpenSSL 3.x / 3.5 | Yes (Native system OpenSSL) |
Implementation Summary
- PHP 5.6.40 – PHP 7.0.33: Must be compiled against OpenSSL 1.0.2u built manually into a custom prefix like --prefix=/opt/openssl-1.0.2.
- PHP 7.1.33 – PHP 8.0.30: Best compiled against OpenSSL 1.1.1w built into a separate prefix like --prefix=/opt/openssl-1.1.1.
- PHP 8.1.34 – PHP 8.5.9: Can be compiled directly using Fedora 44's system OpenSSL development files (openssl-devel) using --with-openssl without needing custom source builds.
Download OpenSSL source from https://openssl-library.org/source/old/index.html
then save them into ~/Downloads
Install OpenSSL v1.0.2u for PHP v5.6.40 , v7.0.33
$ cd ~/Downloads
$ wget https://www.openssl.org/source/old/1.0.2/openssl-1.0.2u.tar.gz && clear && ls -al | grep "openssl"
$ cd /opt
$ tar -xf openssl-1.0.2u.tar.gz
$ sudo mv openssl-1.0.2u openssl-1.0.2-src
$ cd openssl-1.0.2-src
$ rm -f config.cache && make distclean
$ sudo make clean 2>/dev/null || true
$ sudo ./config --prefix=/opt/openssl-1.0.2 --openssldir=/opt/openssl-1.0.2 shared -fPIC
or
$ sudo CFLAGS="-g -O2 -std=gnu11 -fpermissive -Wno-error -Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration -Wno-stringop-overflow" ./config --prefix=/opt/openssl-1.0.2 --openssldir=/opt/openssl-1.0.2 shared
$ sudo make clean
$ sudo make -j$(nproc)
$ sudo make install
Install OpenSSL v1.1.1w for PHP v7.1.33 , v7.2.34 , v7.3.33 , v7.4.30 , v8.0.30
$ cd ~/Downloads
$ wget https://www.openssl.org/source/old/1.1.1/openssl-1.1.1w.tar.gz && clear && ls -al | grep "openssl"
$ cd /opt
$ tar -xf openssl-1.1.1w.tar.gz
$ sudo mv openssl-1.1.1w openssl-1.1.1-src
$ cd openssl-1.1.1-src
$ rm -f config.cache && make distclean
$ sudo make clean 2>/dev/null || true
$ sudo ./config --prefix=/opt/openssl-1.1.1 --openssldir=/opt/openssl-1.1.1 shared -fPIC
$ sudo make clean
$ sudo make -j$(nproc)
$ sudo make install
Install OpenSSL v3.5 LTS for PHP v8.1.34, v8.2.32, v8.3.32, v8.4.24, v8.5.9
$ cd ~/Downloads
$ wget https://www.openssl.org/source/old/3.5/openssl-3.5.7.tar.gz && clear && ls -al | grep "openssl"
$ cd /opt
$ tar -xf openssl-3.5.7.tar.gz
$ sudo mv openssl-3.5.7 openssl-3.5.7-src
$ cd openssl-3.5.7-src
$ rm -f config.cache && make distclean
$ sudo make clean 2>/dev/null || true
$ sudo ./config --prefix=/opt/openssl-3.5.7 --openssldir=/opt/openssl-3.5.7 shared -fPIC
$ sudo make clean
$ sudo make -j$(nproc)
$ sudo make install
----- ----- ----- ----- -----
PHP v5.6.40 - customize port 9056
$ cd /opt
$ wget https://curl.se/download/curl-7.88.1.tar.gz
$ tar -xf ./curl-7.88.1.tar.gz
$ mv curl-7.88.1 curl-7.88.1-src
$ cd curl-7.88.1-src
$ ./configure --prefix=/opt/curl-openssl1.0.2 --with-openssl=/opt/openssl-1.0.2 --disable-ldap --disable-ldaps
$ make -j$(nproc) && make install
$ sudo mkdir -p /opt/php
$ cd /opt/php
$ sudo cp ~/Downloads/php-5.6.40.tar.gz .
$ sudo tar -xf ./php-5.6.40.tar.gz
$ sudo rm -rf ./php-5.6.40.tar.gz
$ sudo mv php-5.6.40 php-5.6
$ cd php-5.6
$ rm -f config.cache && make distclean
$ sudo make clean 2>/dev/null || true
$ sudo CFLAGS="-g -O2 -std=gnu17 -fpermissive -Wno-error -Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration" ./configure --prefix=/opt/php/php-5.6 --with-openssl=/opt/openssl-1.0.2 --with-zlib --enable-mbstring --enable-sockets --enable-fpm --with-curl --with-pdo-mysql --with-pdo-pgsql --with-gd
$ sudo CFLAGS="-g -O0 -std=gnu11 -fpermissive -Wno-error -Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration" ./configure --prefix=/opt/php/php-5.6 --with-openssl=/opt/openssl-1.0.2 --with-zlib --enable-mbstring --enable-sockets --enable-fpm --with-curl=/opt/curl-openssl1.0 --with-pdo-mysql --with-gd --disable-phar
$ sudo CFLAGS="-g -O0 -std=gnu11 -fpermissive -Wno-error -Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration" ./configure --prefix=/opt/php/php-5.6 --with-openssl=/opt/openssl-1.0.2 --with-zlib --enable-mbstring --enable-sockets --enable-fpm --with-pdo-mysql --with-gd --disable-phar
$ CFLAGS="-g -O0 -std=gnu17 -fPIC -fpermissive -Wno-error -Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration" LDFLAGS="-L/opt/openssl-1.0.2/lib -Wl,-rpath,/opt/openssl-1.0.2/lib -L/opt/curl-7.88.1-openssl-1.0.2/lib -Wl,-rpath,/opt/curl-7.88.1-openssl-1.0.2/lib -L/opt/libpq-openssl-1.0.2/lib -Wl,-rpath,/opt/libpq-openssl-1.0.2/lib" ./configure --prefix=/opt/php/php-5.6 --with-openssl=/opt/openssl-1.0.2 --with-zlib --enable-mbstring --enable-sockets --enable-fpm --with-curl=/opt/curl-7.88.1-openssl-1.0.2 --with-pdo-mysql --with-pdo-pgsql=/opt/libpq-openssl-1.0.2 --with-gd --disable-phar
$ sudo make clean
$ sudo make -j$(nproc)
$ sudo make install
$ sudo make install-cli install-sapi install-modules install-headers install-build install-programs
$ make -j$(nproc) && make install
Verify the php before continue :
$ /opt/php/php-5.6/bin/php -v
$ /opt/php/php-5.6/sbin/php-fpm -v
$ sudo cp etc/php-fpm.conf.default etc/php-fpm.conf
$ sudo cp php.ini-production lib/php.ini
$ sudo nano etc/php-fpm.conf
Find in nano "127.0.0.1:9000" then change to "0.0.0.0:9056"
Save php-fpm.conf by press Ctrl + x
Now, we were gonna create linux service for PHP v5.6.40 FPM
$ sudo touch /opt/php/php-5.6/var/run/php-fpm.pid
$ sudo touch /etc/systemd/system/php-5.6.service
$ sudo nano /etc/systemd/system/php-5.6.service
Paste these :
[Unit]
Description=PHP v5.6 FastCGI Process Manager
After=network.target
[Service]
Type=simple
PIDFile=/opt/php/php-5.6/var/run/php-fpm.pid
Environment="LD_LIBRARY_PATH=/opt/openssl-1.0.2/lib:/opt/curl-7.88.1-openssl-1.0.2/lib:/opt/libpq-openssl-1.0.2/lib"
ExecStart=/opt/php/php-5.6/sbin/php-fpm --nodaemonize --fpm-config /opt/php/php-5.6/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
Then save php-5.6.service by press Ctrl + x
Reload linux services :
$ sudo systemctl daemon-reload
Run service :
$ sudo systemctl start php-5.6.service
Check is php-5.6.service run :
$ sudo systemctl status php-5.6.service
Check is port 9056 of php-5.6.service run :
$ sudo netstat -tulpn | grep 9056
----- ----- ----- ----- -----
PHP v7.0.33 - customize port 9070
$ cd /opt
$ wget https://curl.se/download/curl-7.88.1.tar.gz
$ tar -xf ./curl-7.88.1.tar.gz
$ mv curl-7.88.1 curl-7.88.1-src
$ cd curl-7.88.1-src
$ ./configure --prefix=/opt/curl-openssl1.0.2 --with-openssl=/opt/openssl-1.0.2 --disable-ldap --disable-ldaps
$ make -j$(nproc) && make install
$ sudo mkdir -p /opt/php
$ cd /opt/php
$ sudo cp ~/Downloads/php-7.0.33.tar.gz .
$ sudo tar -xf ./php-7.0.33.tar.gz
$ sudo rm -rf ./php-7.0.33.tar.gz
$ sudo mv php-7.0.33 php-7.0
$ cd php-7.0
$ rm -f config.cache && make distclean
$ sudo make clean 2>/dev/null || true
$ sudo CFLAGS="-g -O0 -std=gnu17 -fPIC -fpermissive -Wno-error -Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration" LDFLAGS="-L/opt/openssl-1.0.2/lib -Wl,-rpath,/opt/openssl-1.0.2/lib -L/opt/curl-openssl1.0.2/lib -Wl,-rpath,/opt/curl-openssl1.0.2/lib -L/opt/libpq-openssl1.0.2/lib -Wl,-rpath,/opt/libpq-openssl1.0.2/lib" ./configure --prefix=/opt/php/php-7.0 --with-openssl=/opt/openssl-1.0.2 --with-zlib --enable-mbstring --enable-sockets --enable-fpm --with-curl=/opt/curl-openssl1.0.2 --with-pdo-mysql --with-pdo-pgsql=/opt/libpq-openssl1.0.2 --with-gd --disable-phar
$ CFLAGS="-g -O0 -std=gnu17 -fPIC -fpermissive -Wno-error -Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration" LDFLAGS="-L/opt/openssl-1.0.2/lib -Wl,-rpath,/opt/openssl-1.0.2/lib -L/opt/curl-7.88.1-openssl-1.0.2/lib -Wl,-rpath,/opt/curl-7.88.1-openssl-1.0.2/lib -L/opt/libpq-openssl-1.0.2/lib -Wl,-rpath,/opt/libpq-openssl-1.0.2/lib" ./configure --prefix=/opt/php/php-7.0 --with-openssl=/opt/openssl-1.0.2 --with-zlib --enable-mbstring --enable-sockets --enable-fpm --with-curl=/opt/curl-7.88.1-openssl-1.0.2 --with-pdo-mysql --with-pdo-pgsql=/opt/libpq-openssl-1.0.2 --with-gd --disable-phar
$ sudo make clean
$ sudo make -j$(nproc)
$ sudo make install
$ sudo make install-cli install-sapi install-modules install-headers install-build install-programs
$ make -j$(nproc) && make install
Verify the php before continue :
$ /opt/php/php-7.0/bin/php -v
$ /opt/php/php-7.0/sbin/php-fpm -v
$ sudo cp etc/php-fpm.conf.default etc/php-fpm.conf
$ sudo cp etc/php-fpm.d/www.conf.default etc/php-fpm.d/www.conf
$ sudo cp php.ini-production lib/php.ini
$ sudo nano etc/php-fpm.d/www.conf
Find in nano "127.0.0.1:9000" then change to "0.0.0.0:9070"
Save php-fpm.conf by press Ctrl + x
Now, we were gonna create linux service for PHP v7.0.33 FPM
$ sudo touch /opt/php/php-7.0/var/run/php-fpm.pid
$ sudo touch /etc/systemd/system/php-7.0.service
$ sudo nano /etc/systemd/system/php-7.0.service
Paste these :
[Unit]
Description=PHP v7.0 port 9070 FastCGI Process Manager
After=network.target
[Service]
Type=simple
PIDFile=/opt/php/php-7.0/var/run/php-fpm.pid
Environment="LD_LIBRARY_PATH=/opt/openssl-1.0.2/lib:/opt/curl-7.88.1-openssl-1.0.2/lib:/opt/libpq-openssl-1.0.2/lib"
ExecStart=/opt/php/php-7.0/sbin/php-fpm --nodaemonize --fpm-config /opt/php/php-7.0/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
Then save php-7.0.service by press Ctrl + x
Reload linux services :
$ sudo systemctl daemon-reload
Run service :
$ sudo systemctl start php-7.0.service
Check is php-7.0.service run :
$ sudo systemctl status php-7.0.service
Check is port 9070 of php-7.0.service run :
$ sudo netstat -tulpn | grep 9070
----- ----- ----- ----- -----
PHP v7.1.33 - customize port 9071
$ cd /opt
$ wget https://curl.se/download/curl-7.88.1.tar.gz
$ tar -xf ./curl-7.88.1.tar.gz
$ mv curl-7.88.1 curl-7.88.1-src
$ cd curl-7.88.1-src
$ ./configure --prefix=/opt/curl-openssl1.0.2 --with-openssl=/opt/openssl-1.0.2 --disable-ldap --disable-ldaps
$ make -j$(nproc) && make install
$ sudo mkdir -p /opt/php
$ cd /opt/php
$ sudo cp ~/Downloads/php-7.1.33.tar.gz .
$ sudo tar -xf ./php-7.1.33.tar.gz
$ sudo rm -rf ./php-7.1.33.tar.gz
$ sudo mv php-7.1.33 php-7.1
$ cd php-7.1
$ rm -f config.cache && make distclean
$ sudo make clean 2>/dev/null || true
$ sudo CFLAGS="-g -O0 -std=gnu17 -fPIC -fpermissive -Wno-error -Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration" LDFLAGS="-L/opt/openssl-1.0.2/lib -Wl,-rpath,/opt/openssl-1.0.2/lib -L/opt/curl-openssl1.0.2/lib -Wl,-rpath,/opt/curl-openssl1.0.2/lib -L/opt/libpq-openssl1.0.2/lib -Wl,-rpath,/opt/libpq-openssl1.0.2/lib" ./configure --prefix=/opt/php/php-7.1 --with-openssl=/opt/openssl-1.0.2 --with-zlib --enable-mbstring --enable-sockets --enable-fpm --with-curl=/opt/curl-openssl1.0.2 --with-pdo-mysql --with-pdo-pgsql=/opt/libpq-openssl1.0.2 --with-gd --disable-phar
$ CFLAGS="-g -O0 -std=gnu17 -fPIC -fpermissive -Wno-error -Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration" LDFLAGS="-L/opt/openssl-1.0.2/lib -Wl,-rpath,/opt/openssl-1.0.2/lib -L/opt/curl-7.88.1-openssl-1.0.2/lib -Wl,-rpath,/opt/curl-7.88.1-openssl-1.0.2/lib -L/opt/libpq-openssl-1.0.2/lib -Wl,-rpath,/opt/libpq-openssl-1.0.2/lib" ./configure --prefix=/opt/php/php-7.1 --with-openssl=/opt/openssl-1.0.2 --with-zlib --enable-mbstring --enable-sockets --enable-fpm --with-curl=/opt/curl-7.88.1-openssl-1.0.2 --with-pdo-mysql --with-pdo-pgsql=/opt/libpq-openssl-1.0.2 --with-gd --disable-phar
$ sudo make clean
$ sudo make -j$(nproc)
$ sudo make install
$ sudo make install-cli install-sapi install-modules install-headers install-build install-programs
$ make -j$(nproc) && make install
Verify the php before continue :
$ /opt/php/php-7.1/bin/php -v
$ /opt/php/php-7.1/sbin/php-fpm -v
$ sudo cp etc/php-fpm.conf.default etc/php-fpm.conf
$ sudo cp etc/php-fpm.d/www.conf.default etc/php-fpm.d/www.conf
$ sudo cp php.ini-production lib/php.ini
$ sudo nano etc/php-fpm.d/www.conf
Find in nano "127.0.0.1:9000" then change to "0.0.0.0:9071"
Save php-fpm.conf by press Ctrl + x
Now, we were gonna create linux service for PHP v7.1.33 FPM
$ sudo touch /opt/php/php-7.1/var/run/php-fpm.pid
$ sudo touch /etc/systemd/system/php-7.1.service
$ sudo nano /etc/systemd/system/php-7.1.service
Paste these :
[Unit]
Description=PHP v7.1 port 9071 FastCGI Process Manager
After=network.target
[Service]
Type=simple
PIDFile=/opt/php/php-7.1/var/run/php-fpm.pid
Environment="LD_LIBRARY_PATH=/opt/openssl-1.0.2/lib:/opt/curl-7.88.1-openssl-1.0.2/lib:/opt/libpq-openssl-1.0.2/lib"
ExecStart=/opt/php/php-7.1/sbin/php-fpm --nodaemonize --fpm-config /opt/php/php-7.1/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
Then save php-7.1.service by press Ctrl + x
Reload linux services :
$ sudo systemctl daemon-reload
Run service :
$ sudo systemctl start php-7.1.service
Check is php-7.1.service run :
$ sudo systemctl status php-7.1.service
Check is port 9071 of php-7.1.service run :
$ sudo netstat -tulpn | grep 9071
----- ----- ----- ----- -----
PHP v7.2.34 - customize port 9072
$ cd /opt
$ wget https://curl.se/download/curl-8.5.0.tar.gz
$ tar -xf ./curl-8.5.0.tar.gz
$ mv curl-8.5.0 curl-8.5.0-src
$ cd curl-8.5.0-src
$ ./configure --prefix=/opt/curl-openssl1.1.1 --with-openssl=/opt/openssl-1.1.1 --disable-ldap --disable-ldaps
$ make -j$(proc) && make install
$ sudo mkdir -p /opt/php
$ cd /opt/php
$ sudo cp ~/Downloads/php-7.2.34.tar.gz .
$ sudo tar -xf ./php-7.2.34.tar.gz
$ sudo rm -rf ./php-7.2.34.tar.gz
$ sudo mv php-7.2.34 php-7.2
$ cd php-7.2
$ sudo CFLAGS="-g -O2 -std=gnu17 -fpermissive -Wno-error -Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration" ./configure --prefix=/opt/php/php-7.2 --with-openssl=/opt/openssl-1.1.1 --with-zlib --enable-mbstring --enable-sockets --enable-fpm --with-curl --with-pdo-mysql --with-pdo-pgsql --with-gd
$ sudo make clean
$ sudo make -j$(nproc)
$ sudo make install
$ rm -f config.cache && make distclean
$ sudo make clean 2>/dev/null || true
$ sudo CFLAGS="-g -O0 -std=gnu17 -fPIC -fpermissive -Wno-error -Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration" LDFLAGS="-L/opt/openssl-1.1.1/lib -Wl,-rpath,/opt/openssl-1.1.1/lib -L/opt/curl-openssl1.1.1/lib -Wl,-rpath,/opt/curl-openssl1.1.1/lib -L/opt/libpq-openssl1.1.1/lib -Wl,-rpath,/opt/libpq-openssl1.1.1/lib" ./configure --prefix=/opt/php/php-7.2 --with-openssl=/opt/openssl-1.1.1 --with-zlib --enable-mbstring --enable-sockets --enable-fpm --with-curl=/opt/curl-openssl1.1.1 --with-pdo-mysql --with-pdo-pgsql=/opt/libpq-openssl1.1.1 --with-gd --disable-phar
$ CFLAGS="-g -O0 -std=gnu17 -fPIC -fpermissive -Wno-error -Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration" LDFLAGS="-L/opt/openssl-1.1.1/lib -Wl,-rpath,/opt/openssl-1.1.1/lib -L/opt/curl-8.12.1-openssl-1.1.1/lib -Wl,-rpath,/opt/curl-8.12.1-openssl-1.1.1/lib -L/opt/libpq-openssl-1.1.1/lib -Wl,-rpath,/opt/libpq-openssl-1.1.1/lib" ./configure --prefix=/opt/php/php-7.2 --with-openssl=/opt/openssl-1.1.1 --with-zlib --enable-mbstring --enable-sockets --enable-fpm --with-curl=/opt/curl-8.12.1-openssl-1.1.1 --with-pdo-mysql --with-pdo-pgsql=/opt/libpq-openssl-1.1.1 --with-gd --disable-phar
$ sudo make clean
$ sudo make -j$(nproc)
$ sudo make install
$ sudo make install-cli install-sapi install-modules install-headers install-build install-programs
$ make -j$(nproc) && make install
Verify the php before continue :
$ /opt/php/php-7.2/bin/php -v
$ /opt/php/php-7.2/sbin/php-fpm -v
$ sudo cp etc/php-fpm.conf.default etc/php-fpm.conf
$ sudo cp etc/php-fpm.d/www.conf.default etc/php-fpm.d/www.conf
$ sudo cp php.ini-production lib/php.ini
$ sudo nano etc/php-fpm.d/www.conf
Find in nano "127.0.0.1:9000" then change to "0.0.0.0:9072"
Save php-fpm.conf by press Ctrl + x
Now, we were gonna create linux service for PHP v7.2.34 FPM
$ sudo touch /opt/php/php-7.2/var/run/php-fpm.pid
$ sudo touch /etc/systemd/system/php-7.2.service
$ sudo nano /etc/systemd/system/php-7.2.service
Paste these :
[Unit]
Description=PHP v7.2 port 9072 FastCGI Process Manager
After=network.target
[Service]
Type=simple
PIDFile=/opt/php/php-7.2/var/run/php-fpm.pid
Environment="LD_LIBRARY_PATH=/opt/openssl-1.1.1/lib:/opt/curl-8.12.1-openssl-1.1.1/lib:/opt/libpq-openssl-1.1.1/lib"
ExecStart=/opt/php/php-7.2/sbin/php-fpm --nodaemonize --fpm-config /opt/php/php-7.2/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
Then save php-7.2.service by press Ctrl + x
Reload linux services :
$ sudo systemctl daemon-reload
Run service :
$ sudo systemctl start php-7.2.service
Check is php-7.2.service run :
$ sudo systemctl status php-7.2.service
Check is port 9072 of php-7.2.service run :
$ sudo netstat -tulpn | grep 9072
----- ----- ----- ----- -----
PHP v7.3.33 - customize port 9073
$ sudo mkdir -p /opt/php
$ cd /opt/php
$ sudo cp ~/Downloads/php-7.3.33.tar.gz .
$ sudo tar -xf ./php-7.3.33.tar.gz
$ sudo rm -rf ./php-7.3.33.tar.gz
$ sudo mv php-7.3.33 php-7.3
$ cd php-7.3
$ rm -f config.cache && make distclean
$ sudo make clean 2>/dev/null || true
$ sudo CFLAGS="-g -O2 -std=gnu17 -fpermissive -Wno-error -Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration" ./configure --prefix=/opt/php/php-7.3 --with-openssl=/opt/openssl-1.1.1 --with-zlib --enable-mbstring --enable-sockets --enable-fpm --with-curl --with-pdo-mysql --with-pdo-pgsql --with-gd
$ CFLAGS="-g -O0 -std=gnu17 -fPIC -fpermissive -Wno-error -Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration" LDFLAGS="-L/opt/openssl-1.1.1/lib -Wl,-rpath,/opt/openssl-1.1.1/lib -L/opt/curl-8.12.1-openssl-1.1.1/lib -Wl,-rpath,/opt/curl-8.12.1-openssl-1.1.1/lib -L/opt/libpq-openssl-1.1.1/lib -Wl,-rpath,/opt/libpq-openssl-1.1.1/lib" ./configure --prefix=/opt/php/php-7.3 --with-openssl=/opt/openssl-1.1.1 --with-zlib --enable-mbstring --enable-sockets --enable-fpm --with-curl=/opt/curl-8.12.1-openssl-1.1.1 --with-pdo-mysql --with-pdo-pgsql=/opt/libpq-openssl-1.1.1 --with-gd --disable-phar
$ sudo make clean
$ sudo make -j$(nproc)
$ sudo make install
$ make -j$(nproc) && make install
Verify the php before continue :
$ /opt/php/php-7.3/bin/php -v
$ /opt/php/php-7.3/sbin/php-fpm -v
$ sudo cp etc/php-fpm.conf.default etc/php-fpm.conf
$ sudo cp etc/php-fpm.d/www.conf.default etc/php-fpm.d/www.conf
$ sudo cp php.ini-production lib/php.ini
$ sudo nano etc/php-fpm.d/www.conf
Find in nano "127.0.0.1:9000" then change to "0.0.0.0:9073"
Save php-fpm.conf by press Ctrl + x
Now, we were gonna create linux service for PHP v7.3.33 FPM
$ sudo touch /opt/php/php-7.3/var/run/php-fpm.pid
$ sudo touch /etc/systemd/system/php-7.3.service
$ sudo nano /etc/systemd/system/php-7.3.service
Paste these :
[Unit]
Description=PHP v7.3 port 9073 FastCGI Process Manager
After=network.target
[Service]
Type=simple
PIDFile=/opt/php/php-7.3/var/run/php-fpm.pid
Environment="LD_LIBRARY_PATH=/opt/openssl-1.1.1/lib:/opt/curl-8.12.1-openssl-1.1.1/lib:/opt/libpq-openssl-1.1.1/lib"
ExecStart=/opt/php/php-7.3/sbin/php-fpm --nodaemonize --fpm-config /opt/php/php-7.3/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
Then save php-7.3.service by press Ctrl + x
Reload linux services :
$ sudo systemctl daemon-reload
Run service :
$ sudo systemctl start php-7.3.service
Check is php-7.3.service run :
$ sudo systemctl status php-7.3.service
Check is port 9073 of php-7.3.service run :
$ sudo netstat -tulpn | grep 9073
----- ----- ----- ----- -----
PHP v7.4.30 - customize port 9074
$ sudo mkdir -p /opt/php
$ cd /opt/php
$ sudo cp ~/Downloads/php-7.4.30.tar.gz .
$ sudo tar -xf ./php-7.4.30.tar.gz
$ sudo rm -rf ./php-7.4.30.tar.gz
$ sudo mv php-7.4.30 php-7.4
$ cd php-7.4
$ rm -f config.cache && make distclean
$ sudo make clean 2>/dev/null || true
$ sudo CFLAGS="-g -O2 -std=gnu17 -fpermissive -Wno-error -Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration" ./configure --prefix=/opt/php/php-7.4 --with-openssl=/opt/openssl-1.1.1 --with-zlib --enable-mbstring --enable-sockets --enable-fpm --with-curl --with-pdo-mysql --with-pdo-pgsql --with-gd
$ sudo CFLAGS="-g -O2 -std=gnu17 -fpermissive -Wno-error -Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration" ./configure --prefix=/opt/php/php-7.4 --with-openssl=/opt/openssl-1.1.1 --with-zlib --enable-mbstring --enable-sockets --enable-fpm --with-curl --with-pdo-mysql --with-pdo-pgsql --enable-gd
$ sudo PKG_CONFIG_PATH="/opt/openssl-1.1.1/lib/pkgconfig:$PKG_CONFIG_PATH" CPPFLAGS="-I/opt/openssl-1.1.1/include" LDFLAGS="-L/opt/openssl-1.1.1/lib -Wl,-rpath,/opt/openssl-1.1.1/lib" CFLAGS="-g -O2 -std=gnu17 -fpermissive -Wno-error -Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration" ./configure --prefix=/opt/php/php-7.4 --with-openssl=/opt/openssl-1.1.1 --with-zlib --enable-mbstring --enable-sockets --enable-fpm --with-curl --with-pdo-mysql --with-pdo-pgsql --enable-gd
$ CFLAGS="-g -O0 -std=gnu17 -fPIC -fpermissive -Wno-error -Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration" LDFLAGS="-L/opt/openssl-1.1.1/lib -Wl,-rpath,/opt/openssl-1.1.1/lib -L/opt/curl-8.12.1-openssl-1.1.1/lib -Wl,-rpath,/opt/curl-8.12.1-openssl-1.1.1/lib -L/opt/libpq-openssl-1.1.1/lib -Wl,-rpath,/opt/libpq-openssl-1.1.1/lib" LIBS="$(/opt/curl-8.12.1-openssl-1.1.1/bin/curl-config --static-libs)" ./configure --prefix=/opt/php/php-7.4 --with-openssl=/opt/openssl-1.1.1 --with-zlib --enable-mbstring --enable-sockets --enable-fpm --with-curl=/opt/curl-8.12.1-openssl-1.1.1 --with-pdo-mysql --with-pdo-pgsql=/opt/libpq-openssl-1.1.1 --enable-gd --disable-phar
$ PKG_CONFIG_PATH="/opt/openssl-1.1.1/lib/pkgconfig:$PKG_CONFIG_PATH" CPPFLAGS="-I/opt/openssl-1.1.1/include" LDFLAGS="-L/opt/openssl-1.1.1/lib -Wl,-rpath,/opt/openssl-1.1.1/lib" CFLAGS="-g -O2 -std=gnu17 -fpermissive -Wno-error -Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration" ./configure --prefix=/opt/php/php-7.4 --with-openssl=/opt/openssl-1.1.1 --with-zlib --enable-mbstring --enable-sockets --enable-fpm --with-curl=/opt/curl-8.12.1-openssl-1.1.1 --with-pdo-mysql --with-pdo-pgsql=/opt/libpq-openssl-1.1.1 --enable-gd
$ sudo make clean
$ sudo make -j$(nproc)
$ sudo make install
$ make -j$(nproc) && make install
Verify the php before continue :
$ /opt/php/php-7.4/bin/php -v
$ /opt/php/php-7.4/sbin/php-fpm -v
$ sudo cp etc/php-fpm.conf.default etc/php-fpm.conf
$ sudo cp etc/php-fpm.d/www.conf.default etc/php-fpm.d/www.conf
$ sudo cp php.ini-production lib/php.ini
$ sudo nano etc/php-fpm.d/www.conf
Find in nano "127.0.0.1:9000" then change to "0.0.0.0:9074"
Save php-fpm.conf by press Ctrl + x
Now, we were gonna create linux service for PHP v7.3.33 FPM
$ sudo touch /opt/php/php-7.4/var/run/php-fpm.pid
$ sudo touch /etc/systemd/system/php-7.4.service
$ sudo nano /etc/systemd/system/php-7.4.service
Paste these :
[Unit]
Description=PHP v7.4 port 9074 FastCGI Process Manager
After=network.target
[Service]
Type=simple
PIDFile=/opt/php/php-7.4/var/run/php-fpm.pid
Environment="LD_LIBRARY_PATH=/opt/openssl-1.1.1/lib:/opt/curl-8.12.1-openssl-1.1.1/lib:/opt/libpq-openssl-1.1.1/lib"
ExecStart=/opt/php/php-7.4/sbin/php-fpm --nodaemonize --fpm-config /opt/php/php-7.4/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
Then save php-7.4.service by press Ctrl + x
Reload linux services :
$ sudo systemctl daemon-reload
Run service :
$ sudo systemctl start php-7.4.service
Check is php-7.4.service run :
$ sudo systemctl status php-7.4.service
Check is port 9074 of php-7.4.service run :
$ sudo netstat -tulpn | grep 9074
----- ----- ----- ----- -----
PHP v8.0.30 - customize port 9080
$ sudo mkdir -p /opt/php
$ cd /opt/php
$ sudo cp ~/Downloads/php-8.0.30.tar.gz .
$ sudo tar -xf ./php-8.0.30.tar.gz
$ sudo rm -rf ./php-8.0.30.tar.gz
$ sudo mv php-8.0.30 php-8.0
$ cd php-8.0
$ rm -f config.cache && make distclean
$ sudo make clean 2>/dev/null || true
$ sudo PKG_CONFIG_PATH="/opt/openssl-1.1.1/lib/pkgconfig:$PKG_CONFIG_PATH" CPPFLAGS="-I/opt/openssl-1.1.1/include" LDFLAGS="-L/opt/openssl-1.1.1/lib -Wl,-rpath,/opt/openssl-1.1.1/lib" CFLAGS="-g -O2 -std=gnu17 -fpermissive -Wno-error -Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration" ./configure --prefix=/opt/php/php-8.0 --with-openssl=/opt/openssl-1.1.1 --with-zlib --enable-mbstring --enable-sockets --enable-fpm --with-curl --with-pdo-mysql --with-pdo-pgsql --enable-gd
$ PKG_CONFIG_PATH="/opt/openssl-1.1.1/lib/pkgconfig:$PKG_CONFIG_PATH" CPPFLAGS="-I/opt/openssl-1.1.1/include" LDFLAGS="-L/opt/openssl-1.1.1/lib -Wl,-rpath,/opt/openssl-1.1.1/lib" CFLAGS="-g -O2 -std=gnu17 -fpermissive -Wno-error -Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration" ./configure --prefix=/opt/php/php-8.0 --with-openssl=/opt/openssl-1.1.1 --with-zlib --enable-mbstring --enable-sockets --enable-fpm --with-curl=/opt/curl-8.12.1-openssl-1.1.1 --with-pdo-mysql --with-pdo-pgsql=/opt/libpq-openssl-1.1.1 --enable-gd
$ sudo make clean
$ sudo make -j$(nproc)
$ sudo make install
$ make -j$(nproc) && make install
Verify the php before continue :
$ /opt/php/php-8.0/bin/php -v
$ /opt/php/php-8.0/sbin/php-fpm -v
$ sudo cp etc/php-fpm.conf.default etc/php-fpm.conf
$ sudo cp etc/php-fpm.d/www.conf.default etc/php-fpm.d/www.conf
$ sudo cp php.ini-production lib/php.ini
$ sudo nano etc/php-fpm.d/www.conf
Find in nano "127.0.0.1:9000" then change to "0.0.0.0:9080"
Save php-fpm.conf by press Ctrl + x
Now, we were gonna create linux service for PHP v8.0.30 FPM
$ sudo touch /opt/php/php-8.0/var/run/php-fpm.pid
$ sudo touch /etc/systemd/system/php-8.0.service
$ sudo nano /etc/systemd/system/php-8.0.service
Paste these :
[Unit]
Description=PHP v8.0 port 9080 FastCGI Process Manager
After=network.target
[Service]
Type=simple
PIDFile=/opt/php/php-8.0/var/run/php-fpm.pid
Environment="LD_LIBRARY_PATH=/opt/openssl-1.1.1/lib:/opt/curl-8.12.1-openssl-1.1.1/lib:/opt/libpq-openssl-1.1.1/lib"
ExecStart=/opt/php/php-8.0/sbin/php-fpm --nodaemonize --fpm-config /opt/php/php-8.0/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
Then save php-8.0.service by press Ctrl + x
Reload linux services :
$ sudo systemctl daemon-reload
Run service :
$ sudo systemctl start php-8.0.service
Check is php-8.0.service run :
$ sudo systemctl status php-8.0.service
Check is port 9080 of php-8.0.service run :
$ sudo netstat -tulpn | grep 9080
----- ----- ----- ----- -----
PHP v8.1.34 - customize port 9081
$ sudo mkdir -p /opt/php
$ cd /opt/php
$ sudo cp ~/Downloads/php-8.1.34.tar.gz .
$ sudo tar -xf ./php-8.1.34.tar.gz
$ sudo rm -rf ./php-8.1.34.tar.gz
$ sudo mv php-8.1.34 php-8.1
$ cd php-8.1
$ rm -f config.cache && make distclean
$ sudo make clean 2>/dev/null || true
$ sudo PKG_CONFIG_PATH="/opt/openssl-3.5.7/lib/pkgconfig:$PKG_CONFIG_PATH" CPPFLAGS="-I/opt/openssl-3.5.7/include" LDFLAGS="-L/opt/openssl-3.5.7/lib -Wl,-rpath,/opt/openssl-3.5.7/lib" CFLAGS="-g -O2 -std=gnu17 -fpermissive -Wno-error -Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration" ./configure --prefix=/opt/php/php-8.1 --with-openssl=/opt/openssl-3.5.7 --with-zlib --enable-mbstring --enable-sockets --enable-fpm --with-curl --with-pdo-mysql --with-pdo-pgsql --enable-gd
$ PKG_CONFIG_PATH="/opt/openssl-3.0.22/lib64/pkgconfig:$PKG_CONFIG_PATH" CPPFLAGS="-I/opt/openssl-3.0.22/include" LDFLAGS="-L/opt/openssl-3.0.22/lib64 -Wl,-rpath,/opt/openssl-3.0.22/lib64" CFLAGS="-g -O2 -std=gnu17 -fpermissive -Wno-error -Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration" ./configure --prefix=/opt/php/php-8.1 --with-openssl=/opt/openssl-3.0.22 --with-zlib --enable-mbstring --enable-sockets --enable-fpm --with-curl=/opt/curl-8.12.1-openssl-3.0.22 --with-pdo-mysql --with-pdo-pgsql=/opt/libpq-openssl-3.0.22 --enable-gd
$ PKG_CONFIG_PATH="/opt/curl-8.12.1-openssl-3.0.22/lib/pkgconfig:/opt/openssl-3.0.22/lib64/pkgconfig:$PKG_CONFIG_PATH" CPPFLAGS="-I/opt/openssl-3.0.22/include" LDFLAGS="-L/opt/openssl-3.0.22/lib64 -Wl,-rpath,/opt/openssl-3.0.22/lib64 -L/opt/curl-8.12.1-openssl-3.0.22/lib -Wl,-rpath,/opt/curl-8.12.1-openssl-3.0.22/lib" LIBS="-lssl -lcrypto -ldl -lpthread" CFLAGS="-g -O2 -std=gnu17 -fpermissive -Wno-error -Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration" ./configure --prefix=/opt/php/php-8.1 --with-openssl=/opt/openssl-3.0.22 --with-zlib --enable-mbstring --enable-sockets --enable-fpm --with-curl=/opt/curl-8.12.1-openssl-3.0.22 --with-pdo-mysql --with-pdo-pgsql=/opt/libpq-openssl-3.0.22 --enable-gd
$ sudo make clean
$ sudo make -j$(nproc)
$ sudo make install
$ make -j$(nproc) && make install
Verify the php before continue :
$ /opt/php/php-8.1/bin/php -v
$ /opt/php/php-8.1/sbin/php-fpm -v
$ sudo cp etc/php-fpm.conf.default etc/php-fpm.conf
$ sudo cp etc/php-fpm.d/www.conf.default etc/php-fpm.d/www.conf
$ sudo cp php.ini-production lib/php.ini
$ sudo nano etc/php-fpm.d/www.conf
Find in nano "127.0.0.1:9000" then change to "0.0.0.0:9081"
Save php-fpm.conf by press Ctrl + x
Now, we were gonna create linux service for PHP v8.1.34 FPM
$ sudo touch /opt/php/php-8.1/var/run/php-fpm.pid
$ sudo touch /etc/systemd/system/php-8.1.service
$ sudo nano /etc/systemd/system/php-8.1.service
Paste these :
[Unit]
Description=PHP v8.1 port 9081 FastCGI Process Manager
After=network.target
[Service]
Type=simple
PIDFile=/opt/php/php-8.1/var/run/php-fpm.pid
Environment="LD_LIBRARY_PATH=/opt/openssl-3.0.22/lib64:/opt/curl-8.12.1-openssl-3.0.22/lib:/opt/libpq-openssl-3.0.22/lib"
ExecStart=/opt/php/php-8.1/sbin/php-fpm --nodaemonize --fpm-config /opt/php/php-8.1/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
Then save php-8.1.service by press Ctrl + x
Reload linux services :
$ sudo systemctl daemon-reload
Run service :
$ sudo systemctl start php-8.1.service
Check is php-8.1.service run :
$ sudo systemctl status php-8.1.service
Check is port 9081 of php-8.1.service run :
$ sudo netstat -tulpn | grep 9081
----- ----- ----- ----- -----
PHP v8.2.32 - customize port 9082
$ sudo mkdir -p /opt/php
$ cd /opt/php
$ sudo cp ~/Downloads/php-8.2.32.tar.gz .
$ sudo tar -xf ./php-8.2.32.tar.gz
$ sudo rm -rf ./php-8.2.32.tar.gz
$ sudo mv php-8.2.32 php-8.2
$ cd php-8.2
$ rm -f config.cache && make distclean
$ sudo make clean 2>/dev/null || true
$ sudo PKG_CONFIG_PATH="/opt/openssl-3.5.7/lib/pkgconfig:$PKG_CONFIG_PATH" CPPFLAGS="-I/opt/openssl-3.5.7/include" LDFLAGS="-L/opt/openssl-3.5.7/lib -Wl,-rpath,/opt/openssl-3.5.7/lib" CFLAGS="-g -O2 -std=gnu17 -fpermissive -Wno-error -Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration" ./configure --prefix=/opt/php/php-8.2 --with-openssl=/opt/openssl-3.5.7 --with-zlib --enable-mbstring --enable-sockets --enable-fpm --with-curl --with-pdo-mysql --with-pdo-pgsql --enable-gd
$ PKG_CONFIG_PATH="/opt/curl-8.12.1-openssl-3.0.22/lib/pkgconfig:/opt/openssl-3.0.22/lib64/pkgconfig:$PKG_CONFIG_PATH" CPPFLAGS="-I/opt/openssl-3.0.22/include" LDFLAGS="-L/opt/openssl-3.0.22/lib64 -Wl,-rpath,/opt/openssl-3.0.22/lib64 -L/opt/curl-8.12.1-openssl-3.0.22/lib -Wl,-rpath,/opt/curl-8.12.1-openssl-3.0.22/lib" LIBS="-lssl -lcrypto -ldl -lpthread" CFLAGS="-g -O2 -std=gnu17 -fpermissive -Wno-error -Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration" ./configure --prefix=/opt/php/php-8.2 --with-openssl=/opt/openssl-3.0.22 --with-zlib --enable-mbstring --enable-sockets --enable-fpm --with-curl=/opt/curl-8.12.1-openssl-3.0.22 --with-pdo-mysql --with-pdo-pgsql=/opt/libpq-openssl-3.0.22 --enable-gd
$ sudo make clean
$ sudo make -j$(nproc)
$ sudo make install
$ make -j$(nproc) && make install
Verify the php before continue :
$ /opt/php/php-8.2/bin/php -v
$ /opt/php/php-8.2/sbin/php-fpm -v
$ sudo cp etc/php-fpm.conf.default etc/php-fpm.conf
$ sudo cp etc/php-fpm.d/www.conf.default etc/php-fpm.d/www.conf
$ sudo cp php.ini-production lib/php.ini
$ sudo nano etc/php-fpm.d/www.conf
Find in nano "127.0.0.1:9000" then change to "0.0.0.0:9082"
Save php-fpm.conf by press Ctrl + x
Now, we were gonna create linux service for PHP v8.2.32 FPM
$ sudo touch /opt/php/php-8.2/var/run/php-fpm.pid
$ sudo touch /etc/systemd/system/php-8.2.service
$ sudo nano /etc/systemd/system/php-8.2.service
Paste these :
[Unit]
Description=PHP v8.2 port 9082 FastCGI Process Manager
After=network.target
[Service]
Type=simple
PIDFile=/opt/php/php-8.2/var/run/php-fpm.pid
Environment="LD_LIBRARY_PATH=/opt/openssl-3.0.22/lib64:/opt/curl-8.12.1-openssl-3.0.22/lib:/opt/libpq-openssl-3.0.22/lib"
ExecStart=/opt/php/php-8.2/sbin/php-fpm --nodaemonize --fpm-config /opt/php/php-8.2/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
Then save php-8.2.service by press Ctrl + x
Reload linux services :
$ sudo systemctl daemon-reload
Run service :
$ sudo systemctl start php-8.2.service
Check is php-8.2.service run :
$ sudo systemctl status php-8.2.service
Check is port 9082 of php-8.2.service run :
$ sudo netstat -tulpn | grep 9082
----- ----- ----- ----- -----
PHP v8.3.32 - customize port 9083
$ sudo mkdir -p /opt/php
$ cd /opt/php
$ sudo cp ~/Downloads/php-8.3.32.tar.gz .
$ sudo tar -xf ./php-8.3.32.tar.gz
$ sudo rm -rf ./php-8.3.32.tar.gz
$ sudo mv php-8.3.32 php-8.3
$ cd php-8.3
$ rm -f config.cache && make distclean
$ sudo make clean 2>/dev/null || true
$ sudo PKG_CONFIG_PATH="/opt/openssl-3.5.7/lib/pkgconfig:$PKG_CONFIG_PATH" CPPFLAGS="-I/opt/openssl-3.5.7/include" LDFLAGS="-L/opt/openssl-3.5.7/lib -Wl,-rpath,/opt/openssl-3.5.7/lib" CFLAGS="-g -O2 -std=gnu17 -fpermissive -Wno-error -Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration" ./configure --prefix=/opt/php/php-8.3 --with-openssl=/opt/openssl-3.5.7 --with-zlib --enable-mbstring --enable-sockets --enable-fpm --with-curl --with-pdo-mysql --with-pdo-pgsql --enable-gd
$ PKG_CONFIG_PATH="/opt/curl-8.12.1-openssl-3.0.22/lib/pkgconfig:/opt/openssl-3.0.22/lib64/pkgconfig:$PKG_CONFIG_PATH" CPPFLAGS="-I/opt/openssl-3.0.22/include" LDFLAGS="-L/opt/openssl-3.0.22/lib64 -Wl,-rpath,/opt/openssl-3.0.22/lib64 -L/opt/curl-8.12.1-openssl-3.0.22/lib -Wl,-rpath,/opt/curl-8.12.1-openssl-3.0.22/lib" LIBS="-lssl -lcrypto -ldl -lpthread" CFLAGS="-g -O2 -std=gnu17 -fpermissive -Wno-error -Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration" ./configure --prefix=/opt/php/php-8.3 --with-openssl=/opt/openssl-3.0.22 --with-zlib --enable-mbstring --enable-sockets --enable-fpm --with-curl=/opt/curl-8.12.1-openssl-3.0.22 --with-pdo-mysql --with-pdo-pgsql=/opt/libpq-openssl-3.0.22 --enable-gd
$ sudo make clean
$ sudo make -j$(nproc)
$ sudo make install
$ make -j$(nproc) && make install
Verify the php before continue :
$ /opt/php/php-8.3/bin/php -v
$ /opt/php/php-8.3/sbin/php-fpm -v
$ sudo cp etc/php-fpm.conf.default etc/php-fpm.conf
$ sudo cp etc/php-fpm.d/www.conf.default etc/php-fpm.d/www.conf
$ sudo cp php.ini-production lib/php.ini
$ sudo nano etc/php-fpm.d/www.conf
Find in nano "127.0.0.1:9000" then change to "0.0.0.0:9083"
Save php-fpm.conf by press Ctrl + x
Now, we were gonna create linux service for PHP v8.3.32 FPM
$ sudo touch /opt/php/php-8.3/var/run/php-fpm.pid
$ sudo touch /etc/systemd/system/php-8.3.service
$ sudo nano /etc/systemd/system/php-8.3.service
Paste these :
[Unit]
Description=PHP v8.3 port 9083 FastCGI Process Manager
After=network.target
[Service]
Type=simple
PIDFile=/opt/php/php-8.3/var/run/php-fpm.pid
Environment="LD_LIBRARY_PATH=/opt/openssl-3.0.22/lib64:/opt/curl-8.12.1-openssl-3.0.22/lib:/opt/libpq-openssl-3.0.22/lib"
ExecStart=/opt/php/php-8.3/sbin/php-fpm --nodaemonize --fpm-config /opt/php/php-8.3/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
Then save php-8.3.service by press Ctrl + x
Reload linux services :
$ sudo systemctl daemon-reload
Run service :
$ sudo systemctl start php-8.3.service
Check is php-8.3.service run :
$ sudo systemctl status php-8.3.service
Check is port 9083 of php-8.3.service run :
$ sudo netstat -tulpn | grep 9083
----- ----- ----- ----- -----
PHP v8.4.24 - customize port 9084
$ sudo mkdir -p /opt/php
$ cd /opt/php
$ sudo cp ~/Downloads/php-8.4.24.tar.gz .
$ sudo tar -xf ./php-8.4.24.tar.gz
$ sudo rm -rf ./php-8.4.24.tar.gz
$ sudo mv php-8.4.24 php-8.4
$ cd php-8.4
$ rm -f config.cache && make distclean
$ sudo make clean 2>/dev/null || true
$ sudo PKG_CONFIG_PATH="/opt/openssl-3.5.7/lib/pkgconfig:$PKG_CONFIG_PATH" CPPFLAGS="-I/opt/openssl-3.5.7/include" LDFLAGS="-L/opt/openssl-3.5.7/lib -Wl,-rpath,/opt/openssl-3.5.7/lib" CFLAGS="-g -O2 -std=gnu17 -fpermissive -Wno-error -Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration" ./configure --prefix=/opt/php/php-8.4 --with-openssl=/opt/openssl-3.5.7 --with-zlib --enable-mbstring --enable-sockets --enable-fpm --with-curl --with-pdo-mysql --with-pdo-pgsql --enable-gd
$ PKG_CONFIG_PATH="/opt/curl-8.12.1-openssl-3.0.22/lib/pkgconfig:/opt/openssl-3.0.22/lib64/pkgconfig:$PKG_CONFIG_PATH" CPPFLAGS="-I/opt/openssl-3.0.22/include" LDFLAGS="-L/opt/openssl-3.0.22/lib64 -Wl,-rpath,/opt/openssl-3.0.22/lib64 -L/opt/curl-8.12.1-openssl-3.0.22/lib -Wl,-rpath,/opt/curl-8.12.1-openssl-3.0.22/lib" LIBS="-lssl -lcrypto -ldl -lpthread" CFLAGS="-g -O2 -std=gnu17 -fpermissive -Wno-error -Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration" ./configure --prefix=/opt/php/php-8.4 --with-openssl=/opt/openssl-3.0.22 --with-zlib --enable-mbstring --enable-sockets --enable-fpm --with-curl=/opt/curl-8.12.1-openssl-3.0.22 --with-pdo-mysql --with-pdo-pgsql=/opt/libpq-openssl-3.0.22 --enable-gd
$ sudo make clean
$ sudo make -j$(nproc)
$ sudo make install
$ make -j$(nproc) && make install
Verify the php before continue :
$ /opt/php/php-8.4/bin/php -v
$ /opt/php/php-8.4/sbin/php-fpm -v
$ sudo cp etc/php-fpm.conf.default etc/php-fpm.conf
$ sudo cp etc/php-fpm.d/www.conf.default etc/php-fpm.d/www.conf
$ sudo cp php.ini-production lib/php.ini
$ sudo nano etc/php-fpm.d/www.conf
Find in nano "127.0.0.1:9000" then change to "0.0.0.0:9084"
Save php-fpm.conf by press Ctrl + x
Now, we were gonna create linux service for PHP v8.4.24 FPM
$ sudo touch /opt/php/php-8.4/var/run/php-fpm.pid
$ sudo touch /etc/systemd/system/php-8.4.service
$ sudo nano /etc/systemd/system/php-8.4.service
Paste these :
[Unit]
Description=PHP v8.4 port 9084 FastCGI Process Manager
After=network.target
[Service]
Type=simple
PIDFile=/opt/php/php-8.4/var/run/php-fpm.pid
Environment="LD_LIBRARY_PATH=/opt/openssl-3.0.22/lib64:/opt/curl-8.12.1-openssl-3.0.22/lib:/opt/libpq-openssl-3.0.22/lib"
ExecStart=/opt/php/php-8.4/sbin/php-fpm --nodaemonize --fpm-config /opt/php/php-8.4/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
Then save php-8.4.service by press Ctrl + x
Reload linux services :
$ sudo systemctl daemon-reload
Run service :
$ sudo systemctl start php-8.4.service
Check is php-8.4.service run :
$ sudo systemctl status php-8.4.service
Check is port 9084 of php-8.4.service run :
$ sudo netstat -tulpn | grep 9084
----- ----- ----- ----- -----
PHP v8.5.9 - customize port 9085
$ sudo mkdir -p /opt/php
$ cd /opt/php
$ sudo cp ~/Downloads/php-8.5.9.tar.gz .
$ sudo tar -xf ./php-8.5.9.tar.gz
$ sudo rm -rf ./php-8.5.9.tar.gz
$ sudo mv php-8.5.9 php-8.5
$ cd php-8.5
$ rm -f config.cache && make distclean
$ sudo make clean 2>/dev/null || true
$ sudo PKG_CONFIG_PATH="/opt/openssl-3.5.7/lib/pkgconfig:$PKG_CONFIG_PATH" CPPFLAGS="-I/opt/openssl-3.5.7/include" LDFLAGS="-L/opt/openssl-3.5.7/lib -Wl,-rpath,/opt/openssl-3.5.7/lib" CFLAGS="-g -O2 -std=gnu17 -fpermissive -Wno-error -Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration" ./configure --prefix=/opt/php/php-8.5 --with-openssl=/opt/openssl-3.5.7 --with-zlib --enable-mbstring --enable-sockets --enable-fpm --with-curl --with-pdo-mysql --with-pdo-pgsql --enable-gd
$ PKG_CONFIG_PATH="/opt/curl-8.12.1-openssl-3.0.22/lib/pkgconfig:/opt/openssl-3.0.22/lib64/pkgconfig:$PKG_CONFIG_PATH" CPPFLAGS="-I/opt/openssl-3.0.22/include" LDFLAGS="-L/opt/openssl-3.0.22/lib64 -Wl,-rpath,/opt/openssl-3.0.22/lib64 -L/opt/curl-8.12.1-openssl-3.0.22/lib -Wl,-rpath,/opt/curl-8.12.1-openssl-3.0.22/lib" LIBS="-lssl -lcrypto -ldl -lpthread" CFLAGS="-g -O2 -std=gnu17 -fpermissive -Wno-error -Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration" ./configure --prefix=/opt/php/php-8.5 --with-openssl=/opt/openssl-3.0.22 --with-zlib --enable-mbstring --enable-sockets --enable-fpm --with-curl=/opt/curl-8.12.1-openssl-3.0.22 --with-pdo-mysql --with-pdo-pgsql=/opt/libpq-openssl-3.0.22 --enable-gd
$ sudo make clean
$ sudo make -j$(nproc)
$ sudo make install
$ make -j$(nproc) && make install
Verify the php before continue :
$ /opt/php/php-8.5/bin/php -v
$ /opt/php/php-8.5/sbin/php-fpm -v
$ sudo cp etc/php-fpm.conf.default etc/php-fpm.conf
$ sudo cp etc/php-fpm.d/www.conf.default etc/php-fpm.d/www.conf
$ sudo cp php.ini-production lib/php.ini
$ sudo nano etc/php-fpm.d/www.conf
Find in nano "127.0.0.1:9000" then change to "0.0.0.0:9085"
Save php-fpm.conf by press Ctrl + x
Now, we were gonna create linux service for PHP v8.5.9 FPM
$ sudo touch /opt/php/php-8.5/var/run/php-fpm.pid
$ sudo touch /etc/systemd/system/php-8.5.service
$ sudo nano /etc/systemd/system/php-8.5.service
Paste these :
[Unit]
Description=PHP v8.5 port 9085 FastCGI Process Manager
After=network.target
[Service]
Type=simple
PIDFile=/opt/php/php-8.5/var/run/php-fpm.pid
Environment="LD_LIBRARY_PATH=/opt/openssl-3.0.22/lib64:/opt/curl-8.12.1-openssl-3.0.22/lib:/opt/libpq-openssl-3.0.22/lib"
ExecStart=/opt/php/php-8.5/sbin/php-fpm --nodaemonize --fpm-config /opt/php/php-8.5/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
Then save php-8.5.service by press Ctrl + x
Reload linux services :
$ sudo systemctl daemon-reload
Run service :
$ sudo systemctl start php-8.5.service
Check is php-8.5.service run :
$ sudo systemctl status php-8.5.service
Check is port 9085 of php-8.5.service run :
$ sudo netstat -tulpn | grep 9085
----- ----- ----- ----- -----
Enable PHP Extensions : pgsql
For example, I will enable pgsql extension in php-7.4
For (Debian) :
$ apt-get update && apt-get install -y autoconf
$ cd /opt/php/php-7.4/ext/pgsql
$ cat /opt/php/php-7.4/lib/php.ini | grep ";extension="
Check first :
$ /opt/php/php-7.4/bin/php -m | grep pgsql
$ rm -f config.cache && make distclean
$ make clean 2>/dev/null || true
$ sudo make clean
$ sudo /opt/php/php-7.4/bin/phpize --clean
$ sudo /opt/php/php-7.4/bin/phpize
$ sudo CFLAGS="-g -O2 -std=gnu17 -fpermissive -Wno-error -Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration" ./configure --with-php-config=/opt/php/php-7.4/bin/php-config --with-pgsql
$ sudo make clean
$ sudo make -j$(nproc)
$ sudo make install
$ make -j$(nproc) && make install
$ ls -al /opt/php/php-7.4/lib/php/extensions/no-debug-non-zts-20190902
$ sudo nano /opt/php/php-7.4/lib/php.ini
Change extension_dir to be :
extension_dir = "/opt/php/php-7.4/lib/php/extensions/no-debug-non-zts-20190902"
Uncomment extension=pgsql to be :
extension=pgsql.so
Verify :
$ /opt/php/php-7.4/bin/php -m | grep pgsql
$ sudo systemctl restart php-7.4.service
----- ----- ----- ----- -----
Enable PHP Extensions : intl
$ cd /opt/php/php-7.4/ext/intl
Check first :
$ /opt/php/php-7.4/bin/php -m | grep intl
$ rm -f config.cache && make distclean
$ make clean 2>/dev/null || true
$ sudo /opt/php/php-7.4/bin/phpize --clean
$ sudo /opt/php/php-7.4/bin/phpize
$ sudo CFLAGS="-g -O2 -std=gnu17 -fpermissive -Wno-error -Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration" CXXFLAGS="-std=gnu++17 -fpermissive" ./configure --with-php-config=/opt/php/php-7.4/bin/php-config --with-intl
$ make -j$(nproc) && make install
$ ls -al /opt/php/php-7.4/lib/php/extensions/no-debug-non-zts-20190902
$ sudo nano /opt/php/php-7.4/lib/php.ini
Change extension_dir to be :
extension_dir = "/opt/php/php-7.4/lib/php/extensions/no-debug-non-zts-20190902"
Uncomment extension=intl
Verify :
$ /opt/php/php-7.4/bin/php -m | grep intl
Good job !

Comments
Post a Comment