-
how to install multiple versions PHP? |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 9 replies
-
See my blog post: How to update the PHP version in Laragon |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
To install multiple versions of PHP, you can use a tool like phpbrew or multiple PHP-FPM instances. |
Beta Was this translation helpful? Give feedback.
-
Is there any way to use a different PHP version for each project using |
Beta Was this translation helpful? Give feedback.
-
How to manually pin Apache to a set version of PHP. Thanks to RobiNN1 for his reply above and SO: Setting PHP Include Path on a per site basis? I have found a way to manually pin one site to a fixed PHP version, while Laragon can still switch PHP to another version and Apache will automatically use Laragon's PHP. There are some caveats:
Download and install the required NTS version of PHP see: How to update the PHP version in Laragon, if the PHP version is 'legacy' see the archive Update the Windows host file with a different TLD than Laragon. e.g. app.stranding.local
Create an Apache conf file for the site: e.g. manual.app.stranding.local.conf in sites_enabled (Laragon menu > Apache > dir: conf) double click sites-enabled
Edit the file paths and names in the first four lines:
Laragon can be restarted, the site will be pinned. You can now switch to a different PHP version in Laragon, for other sites. When you have finished pinning the PHP version either rename the file so it doesn't end .conf or delete it. I hope this helps. |
Beta Was this translation helpful? Give feedback.
-
It's working now. You are champion. Thanks a lot. I think the problem I have is I should not have 2 copy of php in TS. Once I delete the other one, it works. Both websites in 2 different php version can run at the same time. Thanks Bro |
Beta Was this translation helpful? Give feedback.
Amazingly, this worked for me! However, images were not loading correctly, especially .svg files, which failed to appear on the page.
The issue occurred because, after setting
SetHandler application/x-httpd-php70-cgi
, every file was being served by CGI as PHP.I resolved this by configuring the CGI handler to apply only to PHP files in .htaccess file:
Handle PHP files using this specific CGI handler
Now even laragon has php 8 by defualt in my case but my projects can use php7 (or any specified version by sethandler) without switching php version in laragon.