Question

How to run multiple websites with mix of php 5 and php 7 on Ubuntu 16 Nginx 64bit on a single droplet?

I have already setup multiple websites on 64bit Ubuntu 16 Nginx server with php 7 Now I’d like to add another website to the same droplet to use php 5, (this premade site need ionCube loader, ionCube doesn’t support php7) Please help


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

For adding multiple sites on nginx server you should utilize Nginx Server Blocks (Virtual Hosts). More about Nginx Server Blocks you can read in this DigitalOcean tutorial.

The main idea is to have one VH to point on php-5, while another will point to php-7. This could be done by setting correct php path under ~.php$ location in Server Block config file. Taken from Ubuntu 14.04 LEMP tutorial your php config should be something like…

/etc/nginx/sites-available/php5.com
...
    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
...

For php-7 we will reefer to Ubuntu 16.04 LEMP tutorial, here it should look like

/etc/nginx/sites-available/php7.com
...
   location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    }
...

For full guide reefer to links I given you, they’re pretty good-written tutorials. :) I hope this will fix problem

Hey i am trying to install prosper202 app. And my site is already working with php7 ubuntu 16…But the prosper usses some deprecated functions which will run below php 5.3…I used the method you said but a error is coming up…

" Package ‘php5-fpm’ has no installation candidate " What to do, i google can came to know that now in ubuntu 16…php7 is standard …Can you guide a bit plz