Some of our clients’ domains are still using PHP versions older than php5.3. This only applies to domains that still need php versions older than php5.3.
In any case where the server’s global PHP version have been upgraded to above php5.3, but some domains are still running on php5.3 or below, we would need to compile and customize those domains php versions using the old FCGI method.
I will use server IP 210.5.43.44 as an example.
The server already has custombuild installed with php7.2 as the main php, and php5.6 as the second php.
However, there is one domain still running on php5.3 (justlavender.com).
This would mean that the server needs 3 seperate php versions when custombuild only supports 2 php versions. So the third php version has to be customized and compiled manually.
First, SSH into the server and find out which php versions have been compiled on the server.
[cc]
cd /usr/local
[root@server101 local]# ll |grep php
drwxr-xr-x 3 root root 4096 Nov 28 2016 php
drwxr-xr-x 7 root root 4096 May 15 2017 php5.3
drwxr-xr-x 7 root root 4096 Nov 29 2016 php56
drwxr-xr-x 7 root root 4096 Dec 24 2015 php5.6
drwxr-xr-x 8 root root 4096 Mar 24 20:09 php72
d—rwxrwx 4 root root 4096 Nov 28 2016 php-imap
[/cc]
This means that the server already has php5.3, php5.6, and php7.2 already compiled.
If you find that your php version isn’t compiled on the server yet, please refer to this GUIDE.
Once your desired php version has been compiled, you would need to set it for the particular domain which needs it.
[cc]
vi /fcgi/jlavender/public_html/fcgi.sh
#!/bin/sh
export PHP_FCGI_MAX_REQUESTS=0
exec /usr/local/php5.3/bin/php-cgi \
-c /usr/local/php5.3/etc/php.ini -d \
-d open_basedir=/home/buysubang/ \
-d upload_tmp_dir=/tmp \
-d session.save_path=/tmp \
$1
[/cc]
Login to DirectAdmin control as admin, and go to Custom HTTPD Configurations and select the domain that you like to change the php version.
Expand the CUSTOM3 and paste following codes then save it,
[cc]
SetHandler fcgid-script
FCGIWrapper ‘/fcgi/buysubang/public_html/fcgid.sh’ .php
Options ALL
allow from all
[/cc]
Verify the php version by uploading the php script contained phpinfo();