Search code examples
phpdrupallamp

Need 2 PHP versions for using Drupal on LAMP


I need to run 2 different PHP versions (5.6 and 7) because of Drupal 6 & 8. Actually I use a LAMP server Ubuntu 16.04 with PHP 5.6. So these are my needs:

  • How can I install 2 differents PHP versions ?
  • How can I assign/choose a specific PHP version for each website depending on the drupal version ?

This for starting.

Thanks


Solution

  • PHP 5.6 security updates will end at the end of this year. Starting January 1st, PHP 5.6 is considered not secure. Before anything else, please consider migrating your Drupal 6 installation to PHP 7 instead of running a two tiered solution.

    To find out more about why you shouldn't use PHP 5.6 under Drupal 6, see this 3rd-party announcement of PHP7 support: https://www.mydropwizard.com/blog/drupal-6-year-2020-and-php-7-support

    If for some reason you still wish to run different versions of PHP, and are running mod-php, you can do so by specifying the version in the .htaccess file of each Drupal installation. Full details at how to change php version in htaccess in server

    For the modern PHP-FPM setups, you'll likely need to set the version in the virtual hosts file...

    Good luck on your mission!