4th Street Bar Hive-Bar

Hive-Bar Powered by Hive beta-fdb5b5b

Community post

[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/

6 upvotes $0.01

Replies (3)

Review before signing

Posting as . Signing with . Keychain permission: Posting. Hive Keychain will ask you to approve this action next.


  
Technical details

Operation fingerprint: