Programming Languages – PHP Questions
PHP support articles: need to know what versions of PHP we support, how to change versions, or anything else? This is the place to find out.
Which PHP functions are disabled on your WordPress platform?
Our WordPress platform has been specifically designed to offer the best security, performance and reliability for WordPress.
As a result, we have specifically tuned firewall rules and layers of protection to help keep WordPress sites secure. As part of this protection, a small number of PHP functions have been disabled, as we've found that they're often used for malicious purposes.
The following functions are disabled for security reasons:
- exec
- opcache_get_configuration
- opcache_get_status
- passthru
- parse_ini_file
- popen
- proc_open
- shell_exec
- show_source
- system
In our experience, it's highly unlikely any of your plugins rely on any of the functions above. However, if you have a genuine use case for any of these functions, you can still host your WordPress site on our Linux platform.
If you're a 20i Reseller you can move packages between all 3 of our platforms easily. So for example, if you've setup a WordPress site on Linux and now wish to migrate to the WordPress platform, head to the Platform Transfer area in My20i to get started.
Why is my website not able to send email?
A common reason for this relates to the address not matching your site domain.
To help improve email deliverability and help prevent spam being sent from our network, the 'Sender' address for your message must match the domain name of the website used to send the message.
If this header is set to a domain not assigned to your hosting package, the message will not be sent.
Websites will also be unable to send mail if there is malware found on the site. If malware is found it will need to be removed and another malware scan run before the website will be able to send mail again. More information on malware scanning can be found here.
If you have any further issues please contact our Support Team.
How do I change PHP maximum upload file size?
On 20i web hosting, PHP max upload file size is set to 128M by default. This can be changed through the PHP Configuration option within a hosting package.
- Head to Manage Hosting and select Options > Manage on the package you're wanting to change
- Select the PHP Configuration icon.
- Scroll to the bottom and you'll see upload_max_filesize.
If you're having trouble uploading a particular file, you may wish to try 512M or 1024M.
Why is MySQL support missing from PHP installation?
Our web servers run PHP 7+ as standard. In this version of PHP the MySQL module has been replaced by either the 'mysqli' or 'PDO_MySQL' extension. Read more about the MySQL extension deprecation on PHP's website.
If you have a website using this module we recommend updating your code to use the latest modules. However, if this isn't feasible or you're using third-party software, you can run older versions of PHP on our Linux platform. You're able to switch between PHP 5.3, 5.4, 5.5, 5.6 - all of which support the older MySQL module - by using the 'Switch PHP Version' icon inside the control panel.
What is the PHP memory_limit?
The PHP memory_limit is the maximum amount of server memory that each PHP script can use.
The official PHP documentation explains this in greater detail.
“This sets the maximum amount of memory in bytes that a script is allowed to allocate. This helps prevent poorly written scripts from eating up all available memory on a server.”
PHP memory usage is typically managed by the PHP interpreter and the web server running PHP scripts. PHP has a default memory limit setting, which restricts the amount of memory a script can use.
The default value for PHP memory is 128M. This can be raised if an application or website needs more memory.
It's important to note that allocating too much memory to PHP can also have negative consequences, such as slowing down the application or causing other performance issues. This may be due to a specific PHP process using far too much memory than what is available.
When a script exceeds the memory limit that's been set for the server an error similiar to the following will be logged.
Fatal error: Allowed memory size of x bytes exhausted (tried to allocate x bytes) in /example/php/script PHP Fatal error: Out of memory (allocated x) (tried to allocate x bytes) in /example/php/script
You can update the PHP memory limit for your site through My20i or StackCP.
Be aware that if you're on a Managed VPS then your server has a physical memory limit. You should optimize your code if the memory_limit parameter is already set to its maximum.
How do I change PHP version?
Standard PHP Version
By default, our hosting runs PHP 7+. If you need to switch PHP versions:
- Go to My20i.
- Select Manage Hosting.
- Find the package that you would like to change the PHP Version on and click Options, then Manage.
- Under Web Tools, select Change PHP Version.
Available PHP Versions
We support the following PHP versions on our Linux platform:
- PHP 5.3
- PHP 5.4
- PHP 5.5
- PHP 5.6
- PHP 7.0
- PHP 7.1
- PHP 7.2
- PHP 7.3
- PHP 7.4
- PHP 8.0
- PHP 8.1
- PHP 8.2
- PHP 8.3
Note: Version changes are typically instant but may take up to 60 seconds.
Managed WordPress Platform
On our Managed WordPress Platform, we run PHP 7.0 and higher.
Note: PHP versions prior to 7.0 are not supported on the WordPress platform.
Changing PHP Version for Subdirectories/Subdomains
Note: This method is applicable only to shared hosting packages and is not supported on Managed VPS or Cloud Servers.
To host multiple websites on the same package using different PHP versions:
- Navigate to the directory where you want to change the PHP version.
- Edit or create a
.htaccess
file. - At the top of the file, add the following line to set the PHP version:
- For PHP 7.4:AddHandler x-httpd-php74 .php
- For PHP 5.6:AddHandler x-httpd-php56 .php
- For PHP 8.3:AddHandler x-httpd-php83 .php
Changing PHP Version for WordPress Staging
To change the PHP version for a WordPress staging site:
1. Navigate to staging_html
within your WordPress package.
2. Add the appropriate AddHandler
line to the .htaccess
file with the desired PHP version.
Checking PHP Version
To verify the PHP version in use:
- Create a new PHP file, such as `info.php`, in the directory where you've changed the PHP version.
- Add the following code to the file:
<?php
phpinfo();
?>
3. Access the file directly in a browser (e.g., staging.domain.com/info.php
). The PHP version will be displayed at the top of the page like this:
Security Note: PHPinfo files can expose sensitive information. It's advisable to delete the PHPinfo file after checking your PHP version.
Is ionCube PHP Loader installed?
The ionCube Loader is a PHP extension often used by setups such as WHMCS - it decodes PHP scripts that have been encoded by the ionCube PHP Encoder. Without this, the scripts cannot be read and so the sites that use them cannot run, so it’s important to know what areas of our hosting have this included.
The availability of ionCube can differ between our different platforms and PHP versions.
Linux Web Hosting: ionCube Loader is available on our Linux platform for all currently supported PHP versions (but see note below).
WordPress Hosting: ionCube Loader is available on our WordPress platform for all available PHP versions that support it.
Note: ionCube Loader’s development skipped PHP 8.0 as outlined in their blog post here. As such, it is not available on this version, but is available on PHP 8.1 instead.
Windows Hosting: ionCube is not available on our Windows platform. If you are running PHP software and don't need any of the Windows specific-languages like ASP.NET we recommend using our Linux platform.
Managed Hosting: ionCube Loader is available on all supported PHP versions similar to our Linux hosting.
You can use the Platform Transfer feature inside My20i to automatically move between all of our hosting platforms.