derwunner avatar

[Feature Request] Integrate possibility to have multiple PHP Versions for Apache

derwunner

Published: 10 Jul 2018 › Updated: 10 Jul 2018[Feature Request] Integrate possibility to have multiple PHP Versions for Apache

[Feature Request] Integrate possibility to have multiple PHP Versions for Apache

GitHub Issue

https://github.com/laravel/homestead/issues/892

In the Vagrant Homestead box, it's possible to have different php versions when using nginx as the web server. They offer also apache web server. But inside apache, it's not possible for now.

Indeed, they have the most dependencies included (PHP-FPM) to get multiple php version also for apache.
The basic handlers could be added to /etc/apache2/sites-enabled/000-default.conf like this:

<IfModule mod_fastcgi.c>
  AddHandler php56-fcgi-www .php
  Action php56-fcgi-www /php56-fcgi-www
  Alias /php56-fcgi-www /usr/lib/cgi-bin/php56-fcgi-www
  FastCgiExternalServer /usr/lib/cgi-bin/php56-fcgi-www -socket /run/php/php5.6-fpm.sock -pass-header Authorization

  <Directory "/usr/lib/cgi-bin">
     Require all granted
  </Directory>
</IfModule>

<IfModule mod_fastcgi.c>
   AddHandler php70-fcgi-www .php
   Action php70-fcgi-www /php70-fcgi-www
   Alias /php70-fcgi-www /usr/lib/cgi-bin/php70-fcgi-www
   FastCgiExternalServer /usr/lib/cgi-bin/php70-fcgi-www -socket /run/php/php7.0-fpm.sock -pass-header Authorization

   <Directory "/usr/lib/cgi-bin">
      Require all granted
   </Directory>
</IfModule>

<IfModule mod_fastcgi.c>
   <FilesMatch ".+\.ph(p[345]?|t|tml)$">
      SetHandler php70-fcgi-www
   </FilesMatch>
</IfModule>

And the php version / the handler could be set to each vhost by adding this line to the vhost config:

SetHandler php70-fcgi-www

All they need to do is to install fastcgi:

apt-get install libapache2-mod-fastcgi

Source

https://www.thomaschristlieb.de/mehrere-php-versionen-auf-einem-linux-server-mit-php-fpm/

Leave [Feature Request] Integrate possibility to have multiple PHP Versions for Apache to:

Written by

technical stuff, sports and life style === german software developer ===

Read more #utopian-io posts


Best Posts From derwunner

We have not curated any of derwunner's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From derwunner