How do I use a different PHP version in a subdomain or folder?
There are times you may find the need to use a specific PHP version
for a subdomain application that is different from your main account PHP
version. The following will show you how to use a different PHP version in
specific folder and/or subdomain than that of the main account PHP
version.
In the folder you want the PHP version changed or different, you need to edit the .htaccess file add the following code:
<FilesMatch "\.(php4|php5|php3|php2|php|phtml)$">
SetHandler application/x-lsphp80
</FilesMatch>
In the above examples, simply replace the "php80" portion with the PHP version of your choosing. For example, if you wanted to use PHP 7.4 you would use "php74". To see the available PHP versions, you can go to "Select PHP Version" in your DirectAdmin control panel.
Note: If your folder does not contain a .htaccess file, you can simply create one using the File Manager.
If you have any further questions, please open a support ticket with us!
Related Articles
How do I run my cron job on a specific PHP version?
To run a cron job using a specific PHP version, you can use the following example code: /opt/alt/php81/usr/bin/php -q FILE_PATH Where "php81" is the PHP version you want to use (PHP 8.1) and can be changed to suit your needs. Such as php72, php73, ...
How do I enable and use Redis?
What is Redis? Redis is a super-fast, in-memory database that stores data in a key-value format, making it quick to access. It's often used for caching, real-time applications, and quick data lookups. Redis is versatile, supporting various data types ...
How to change the PHP version in Enhance Control Panel?
Let's see how you can change the PHP version on your account/website. 1. Once you have logged in to the control panel at https://hub.hivium.com, go to the websites section. 2. Now hover over the "Advanced" option as seen in the below screenshot and ...
How to solve the error related to PHP session save path?
If you receive an error stating the PHP session path is not writable, you can simply update the session.save_path setting in the PHP Selector. From the Extra Features menu item in DirectAdmin: 1. Open Select PHP Version 2. Click Options 3. For the ...
What to do when we see Forbidden: PHP engine is disabled?
If you receive the error “Forbidden: PHP engine is disable”, it is due to “PHP Access” for the domain not being enabled. To enable it, simply go to Domain Setup in DirectAdmin and choose Modify. From there you can click the checkbox for PHP Access ...