How do I choose the right PHP version?
At mijn.host you have the possibility to fully manage the PHP version of your websites, allowing you to configure your website with the ideal settings. You can set the PHP version for your entire hosting package, or only for a specific domain. In this article we discuss both options.
Below we explain how you can change the PHP versions.
Step 1: Login to DirectAdmin:
To view and change the PHP settings, it is best to do this via DirectAdmin.
Go to your hosting package in the mijn.host control panel and click on open next to DirectAdmin.
Step 2: The General PHP selector
To set PHP for all domains you use the general CloudLinux PHP Selector.
Regardless of which version the 1st option has, this PHP selector overrides it.
If your domains are on other PHP versions within DirectAdmin, this PHP selector has no effect on those domains.
You will find more info about this later in this article.
In DirectAdmin, go to your menu and choose Extra Features, then click on Select PHP version.
Or type PHP in the search bar and choose Select PHP version.
You will arrive at the CloudLinux PHP Selector. The first tab shows all PHP extensions that you can turn on or off. Such as redis, imagick, solr, ioncube, mcrypt etc.
On the second tab options you can find options for example time-out, memory, disabled functions etc.
More info about this selector and settings can be found here: Change PHP settings hosting package
Set PHP per domain:
To choose a separate PHP version per domain, it is possible to do this via DirectAdmin. Note that with this option the 1st PHP choice in Directadmin is overridden by the General PHP Selector.
Make sure you are logged in to DirectAdmin. Click on Domain setup in the menu bar and then click on your desired domain.
Step 2: View and/or change the PHP version.
In the Domain setup of your domain, there is an option in the top right to adjust the PHP version. Click on PHP Version selector.
In the pop-up window you can see the current PHP version and change it if necessary. The 1st version in this list is therefore overridden by the General PHP Selector.
When you change the PHP version for this domain, select your desired version and click save. You can then adjust options under PHP Settings if necessary.
In the menu, choose PHP Settings
Here you can also set options for the version. If you want options such as max memory or post max size to be higher, please contact our support desk.
Which PHP Selector do I choose?
We always recommend the CloudLinux PHP Selector. So the General PHP Selector. Keep in mind that even if the option at the DirectAdmin domain selector" is set to PHP 7.4 then that does nomean that you are also using that version. Because the 1st choice is always overridden by the version of the General PHP Selector.
To show this a bit better, because it is sometimes quite unclear, you can follow the steps below.
Go to the public_html of the domain name you have changed. This can be done with the DirectAdmin File Manager (or via FTP). Here we create a file with the name: phpinfo.php
Now hover over the newly created file with your mouse and double-click to edit. Or choose edit in the menu.
Enter the code below and save the file:
// Alle INFO over php
phpinfo();
?>
Example:
After saving, you can now request the information by going to https://mijn.website/phpinfo.php in your web browser. Naturally, replace 'mijn.website' with your own domain name.
In this example, the PHP selector in DirectAdmin is set to the 1st version 7.4 lsphp.
But as we can see now, the actual PHP version is 8.1. Because the General PHP selector is set to 8.1.
So if you ever get the idea that your PHP changes are not being applied, check which PHP selector you are using. And whether you are modifying the correct one.
If you can't quite figure this out, don't hesitate to contact our support team.
Still have questions? Get in touch.