Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

hritikaaa's avatar

Managing multiple php versions

Hi, I have 2 different projects on a single server, One is a laravel project that requires php 8.3 and another one includes php scripts which uses php 7.4.

How can I use php 8.3 for laravel project and for another project its 7.4. Where can we maintain the configurations? I would have gone with changing paths in virtual host file, but the file for the project doesn't exists.

0 likes
2 replies
gych's avatar

If you don't have virtual host files for your projects, you can look into setting this up via nginx configuration.

martinbean's avatar

@hritikaaa It depends on how you’re serving these projects.

If you have full control over the server, then you should be able to install different versions of PHP, and rename the binaries accordingly, i.e. php74 and php83. When you set up your server configuration for the two sites, you then choose which binary to use to serve that site.

Digital Ocean has a guide on setting up a server to run different sites using different versions of PHP: https://www.digitalocean.com/community/tutorials/how-to-run-multiple-php-versions-on-one-server-using-apache-and-php-fpm-on-ubuntu-18-04

Please or to participate in this conversation.