1

My still requires me to run Drupal 6 (yes I understand the risks). I have multiple versions of PHP installed on my Ubuntu 16.04 - 5.6, 7, 7.2.3. The 7.2.3. is being used by Laravel and my Drupal 7 installs. I tried making updates to Drupal 6 but it keeps on complaining about the mbsting.http_input. Even though I have updated the php.ini for 7.23 it is still there. Is there a way that I can point drupal 6 to PHP 5.6 while still keeping 7.2.3 for the rest?

To add some additional context - when I log to my drupal 6 blog and go to install.php it says drupal already installed. But when I go to the main page it show 500 error.

1
  • For Drupal 6 & 7 I'd recommend PHP 5.6 and only for Drupal 8 it should be PHP 7.1 Commented Apr 18, 2018 at 20:26

1 Answer 1

1

Yes you can use different PHP versions per vhost. But it's quite fiddly to setup (at least for me it was). Have a look at mod_proxy_fcgi and ProxyPassMatch.

I once managed to set this up in Docker (Dockerfile). Natively I guess it must go along the lines of the following Apache confs.

drupal6.com.conf

Listen 80

<VirtualHost *:80>

    ServerName drupal6.com
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/php56

    ErrorLog ${APACHE_LOG_DIR}/php56error.log
    CustomLog ${APACHE_LOG_DIR}/php56access.log combined

    ProxyPassMatch "^/(.*\.php(/.*)?)$" "unix:/var/run/php/php5.6-fpm.sock|fcgi://localhost/var/www/php56"
    <Directory "/var/www/php56">
        Order allow,deny
        Allow from all
        AllowOverride FileInfo All
        Require all granted
    </Directory>

</VirtualHost>

drupal7.com.conf

Listen 80

<VirtualHost *:80>

    ServerName drupal7.com
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/php72

    ErrorLog ${APACHE_LOG_DIR}/php72error.log
    CustomLog ${APACHE_LOG_DIR}/php72access.log combined

    ProxyPassMatch "^/(.*\.php(/.*)?)$" "unix:/var/run/php/php7.1-fpm.sock|fcgi://localhost/var/www/php72"
    <Directory "/var/www/php72">
        Order allow,deny
        Allow from all
        AllowOverride FileInfo All
        Require all granted
    </Directory>

</VirtualHost>

For Nginx take the following approach as starting point (source).

  1. $ git clone https://gist.github.com/2fca8bfdc5004bade15bac84b9ab73e7.git test/multiphp
  2. $ docker build -t nginx-multiphp test/multiphp
  3. $ docker run -p 8856:8856 -p 8871:8871 --rm -P nginx-multiphp
  4. In your browser visit: http://localhost:8856 for PHP56 and http://localhost:8871 for PHP71 accordingly.
  5. Happy happy
Sign up to request clarification or add additional context in comments.

4 Comments

Thanks. It actually gets worse.. Drupal 6 is sitting in a Laravel sub-directory. But looks like the option is to crate a subdomain and point it there.
@user9465677 – Challenging :) Good luck pal!
Would this command unix:/var/run/php/php5.6-fpm.sock|fcgi://localhost/var/www/php56 work on Ubuntu 16.04
Finally got around testing this - ProxyPassMatch "^/(.*\.php(/.*)?)$" "unix:/var/run/php/php5.6-fpm.sock|fcgi://localhost/var/www/php56" causes the apache2 restart failure. I get "Job for apache2.service failed because the control process exited with error code."

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.