DEV Community

Discussion on: Work and play in PHP 7.4 & PHP 8.0

Collapse
 
nicolus profile image
Nicolas Bailly • Edited

Hey, congrats on your first post ! That's a pretty nice solution too.

What I usually do with my LAMP stack is use php-fpm, run all versions I need at the same time, and then in my apache VirtualHost set the correct handler for php files depending on the version I want :

<FilesMatch ".+\.php$">
    SetHandler "proxy:unix:/run/php/php8.0-fpm.sock|fcgi://localhost"
</FilesMatch>
Enter fullscreen mode Exit fullscreen mode

or

<FilesMatch ".+\.php$">
    SetHandler "proxy:unix:/run/php/php7.4-fpm.sock|fcgi://localhost"
</FilesMatch>
Enter fullscreen mode Exit fullscreen mode

That way all my projects run at the same time without needing to switch from one version to the other, except for the CLI where I still need to run update-alternatives