Skip to content
Advertisement

Use different php version in dedicated server folders?

I have dedicated server on godaddy.com which have a domain named example.com in this domain i have two backends one CodeIgniter which use PHP 7.4 and another Laravel 9 which required PHP 8.0 so my cPanel still using default PHP 7.4. Is there a way to make the folder contain Laravel 9 use PHP 8 instead of cPanel defaults version 7.4 which i don’t want to change ?

Advertisement

Answer

cPanel has a feature called Multi-PHP, which does what you need (if your host has it enabled).

For each project, it puts a snippet like this in the .htaccess which sets the PHP version to use:

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php81” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php81 .php .php8 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit

The example above is for PHP 8.1.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement