How to change PHP version and update PHP extensions on Shared servers
- Category : PHP Configuration
- Posted on : Feb 21, 2021
- Views : 987
- By : HostSEO
In some cases, the correct functioning of your website depends on a PHP version installed on the server.
This guide describes how to change php version on Shared servers (Stellar, Stellar Plus plans and old Value, Professional, Ultimate plans). For Business SSD servers, use this guide.
Thanks to the PHP Selector function, it is possible to select the necessary PHP version as well as enable/disable certain PHP modules and functions.
Change PHP version and/or manage extensions
3. Here you will see the list of available modules and extensions.
If you do not need to change the PHP version and just want to turn on/off specific extensions, you can do this by checking/unchecking the corresponding boxes.
Use the Current PHP version drop-down box to select the required version and click on Set as current in order to apply the changes.
4. To change individual settings within the PHP version in question, click on the Options tab.
By clicking on one of the options in blue, you will be presented with a drop-down list to change specific settings:
NOTE: In order to increase the max upload size, make sure to modify both post_max_size and upload_max_filesize values.
To set a different PHP version for an addon domain, you need to add a special code to your .htaccess file. To do this, follow the steps below.
1. Find the .htaccess file for the addon domain in question. The steps for how to find it can be located here.
2. Add the following line to your .htaccess file:
<FilesMatch ".(?:html|php)$"> SetHandler application/x-lsphpXX
For servers with LiteSpeed the code should be the following:
<FilesMatch ".(?:html|php)$"> SetHandler application/x-httpd-alt-phpXX
where XX is the PHP version you wish to set. It can be 52, 53, 54, 55, 56, 70, 71,72, 73, 74, 80 or 81.
For example:
NOTE: When a different PHP version is set for the addon domain, there are no PHP extensions enabled by default. To make a website work correctly, you will need to upload a php.ini file to the folder of the addon domain. You can check this article (see point 6) to help you with uploading files to the hosting account.
You need to download the php.ini file for different PHP versions from the Attachments section at the end of this guide. Do not forget to rename the file to php.ini once it is uploaded to the hosting account.
Alternatively, you can run the command below via SSH:
cp /opt/alt/default_php_ini/phpXX.ini /home/cPanel_username/path_to_the_folder/php.ini
- XX is PHP version you wish to set (it can be 52, 53, 54, 55, 56, 70, 71, 72, 73, 74, 80 or 81),
- cPanel_username should be replaced with your actual cPanel username, and
- path_to_the_folder is a path to the folder of the addon domain.
For example:
The process is similar if you wish to set a different PHP version for a subdomain.
Categories
- cPanel Question 47
- cPanel Software Management 29
- cPanel Tutorials 13
- Development 29
- Domain 13
- General 19
- Linux Helpline (Easy Guide) 156
- Marketing 47
- MySQL Question 13
- News 2
- PHP Configuration 14
- SEO 4
- SEO 42
- Server Administration 84
- SSL Installation 54
- Tips and Tricks 24
- VPS 3
- Web Hosting 44
- Website Security 22
- WHM questions 13
- WordPress 148
Subscribe Now
10,000 successful online businessmen like to have our content directly delivered to their inbox. Subscribe to our newsletter!Archive Calendar
Sat | Sun | Mon | Tue | Wed | Thu | Fri |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 |
Recent Articles
-
Posted on : Sep 17
-
Posted on : Sep 10
-
Posted on : Aug 04
-
Posted on : Apr 01
Tags
- ts
- myisam
- vpn
- sql
- process
- kill
- tweak
- server load
- attack
- ddos mitigation
- Knowledge
- layer 7
- ddos
- webmail
- DMARC
- Development
- nginx
- seo vpn
- Hosting Security
- wireguard
- innodb
- exim
- smtp relay
- smtp
- VPS Hosting
- cpulimit
- Plesk
- Comparison
- cpu
- encryption
- WHM
- xampp
- sysstat
- optimize
- cheap vpn
- php-fpm
- mariadb
- apache
- Small Business
- Error
- Networking
- VPS
- SSD Hosting
- Link Building
- centos
- DNS
- optimization
- ubuntu