How To Install Multiple PHP Version With Nginx On Ubuntu 18.04 & 16.04
How To Install Multiple PHP Version With Nginx On Ubuntu 18.04 & 16.04
04
ABOUT US
POPULAR POSTS
Generally, web hosting manager used a separate
How to Install Apache 2.4
server for each PHP version application
& PHP 7.3 on Amazon Linux
deployment. Which increases the hosting cost.
Alternatively, you can run multiple Docker How to Install Angular on
Ubuntu 18.04 & 16.04
containers for multiple PHP versions.
How to Install MySQL 5.7 on
This tutorial helps you with the installation and Amazon Linux
configuration of two VirtualHost on Nginx web
How To Install Wine 4 on
server with different PHP versions. First
Debian 10 (Buster) Linux
VirtualHost will work with PHP 5.6 and another
VirtualHost will run with PHP 7.1. So just go How to Rename a Column
Name in SQL Server
Wethrough this
use cookies tutorial.
to ensure that You canyou
we give also use experience
the best more than on our website. If you continue to use this
Database
site we will assume that you are happy with it.
two PHP versions with Nginx as required but this
Ok No
tutorial covers two only.
https://tecadmin.net/install-multiple-php-version-nginx-ubuntu/ 1/8
8/9/2019 How To Install Multiple PHP Version with Nginx on Ubuntu 18.04 & 16.04
PHP Installation
For the installation of PHP versions, we use the
PPA maintained here. Use the below couple of
commands to add the PPA to your system.
For this tutorial, I used the PHP 5.6 and PHP 7.2
to configure with Nginx web server. To use the
multiple PHP versions, we will use PHP FPM and
FastCGI. Let’s install the following packages on
your system.
$ apt update
$ sudo apt install php5.6 php5.6-fpm
$ sudo apt install php7.2 php7.2-fpm
Nginx Installation
We use cookies to ensure that we give you the best experience on our website. If you continue to use this
site we will assume that you are happy with it.
Ok No
https://tecadmin.net/install-multiple-php-version-nginx-ubuntu/ 2/8
8/9/2019 How To Install Multiple PHP Version with Nginx on Ubuntu 18.04 & 16.04
Nginx Configuration
Get ready for the configuration of websites in
Nginx server. For the testing purpose, I am
configuring two websites to work with two
different-2 PHP versions. First, create two
directories on your server.
$ sudo
We use vimto/etc/nginx/sites-available/php56.example.c
cookies ensure that we give you the best experience on our website. If you continue to use this
site we will assume that you are happy with it.
Ok No
https://tecadmin.net/install-multiple-php-version-nginx-ubuntu/ 3/8
8/9/2019 How To Install Multiple PHP Version with Nginx on Ubuntu 18.04 & 16.04
root /var/www/php56;
index index.php;
server_name php56.example.com;
location ~* \.php$ {
# With php-fpm unix sockets
fastcgi_pass unix:/var/run/php/php5.6
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $d
fastcgi_param SCRIPT_NAME $f
}
}
$ sudo ln -s /etc/nginx/sites-available/php56.example
$ sudo ln -s /etc/nginx/sites-available/php72.example
Test Setup
All done. You can access both sites in your
favirote web browser . You will see that
php56.example.com shows the version PHP 5.6
and php72.example.com is showing the PHP 7.2
as the configuration.
We use cookies to ensure that we give you the best experience on our website. If you continue to use this
site we will assume that you are happy with it.
Ok No
https://tecadmin.net/install-multiple-php-version-nginx-ubuntu/ 5/8
8/9/2019 How To Install Multiple PHP Version with Nginx on Ubuntu 18.04 & 16.04
SHARE IT!
RAHUL
Ok No
https://tecadmin.net/install-multiple-php-version-nginx-ubuntu/ 6/8
8/9/2019 How To Install Multiple PHP Version with Nginx on Ubuntu 18.04 & 16.04
RELATED POSTS
5 COMMENTS
https://tecadmin.net/install-multiple-php-version-nginx-ubuntu/ 7/8
8/9/2019 How To Install Multiple PHP Version with Nginx on Ubuntu 18.04 & 16.04
LEAVE A REPLY
COMMENTS *
SUBMIT
Copyright © 2013-2019 TecAdmin.net. All Rights Reserved. This site uses cookies. By using this website you
agree with our term and services
We use cookies to ensure that we give you the best experience on our website. If you continue to use this
site we will assume that you are happy with it.
Ok No
https://tecadmin.net/install-multiple-php-version-nginx-ubuntu/ 8/8