based on https://github.com/leymannx/apache-multiphp
Debian 9 - Apache 2.4 - PHP 5.6, PHP 7.1 and PHP 7.2
Build the docker image: docker build -t dockserver-multiphp .
$ docker run -p 8856:8856 -p 8871:8871 -p 8872:8872 [-v c:/xampp/htdocs:/var/www] dockserver-multiphp
- In your browser visit
- http://localhost:8856 for PHP 5.6
- http://localhost:8871 for PHP 7.1
- http://localhost:8872 for PHP 7.2
- Break stuff! :)
I use this image to test Magento (and others) on different PHP versions
Following tools will also be provided:
- Composer
- npm
- ssh access (default root/root)
For more info see Dockerix on GitHub.
This image uses Apache's mod_proxy_fcgi
and loads the right PHP version with ProxyPassMatch
. You don't have to do anyting as I already incorporated into Apache's 000-default.conf
:
Listen 8856
Listen 8871
Listen 8872
<VirtualHost *:8856>
ServerName localhost
ServerAdmin webmaster@localhost
DocumentRoot /var/www/php56
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.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>
<VirtualHost *:8871>
ServerName localhost
ServerAdmin webmaster@localhost
DocumentRoot /var/www/php71
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ProxyPassMatch "^/(.*\.php(/.*)?)$" "unix:/var/run/php/php7.1-fpm.sock|fcgi://localhost/var/www/php71"
<Directory "/var/www/php71">
Order allow,deny
Allow from all
AllowOverride FileInfo All
Require all granted
</Directory>
</VirtualHost>
....etc :)