1. Home
  2. Technical Advice
  3. How to modify PHP value(s) on a shared hosting

How to modify PHP value(s) on a shared hosting

This tutorial is for shared hosting only

Some CMS or older website need a particular PHP version or value to work properly.

There two way to change those settings on shared hosting.

1. On your cPanel, click on “Select PHP version”

2. On this screen. you will see a drop-down menu that will let you choose the PHP version for the whole cPanel.

    Once PHP version is selected, click set as current.

3. If you need some particular PHP module, you can add  them by clicking on “Switch to PHP extensions” in the top right corner

4. If you need to modify certain PHP value, you can use the “Switch To PHP Options”

    Don’t forget to save your settings after changing them.


Second method – Modify PHP value by .htaccess

Please note that this method won’t work if you choose the PHP version. Please use the first method if you want to change PHP version

  1. You can change PHP value by editing your .htaccess.
    This file can be found at the root of your website folder.
    Some PHP values cannot be changed due to the restriction being on a shared hosting.
  2. The format to use in this .htaccess is:
    php_value [variable] [value]

Here is some common example you may have to use:

To change upload_max_filesize value

php_value upload_max_filesize 20M

To change max_input_vars.   

php_value max_input_vars 10000

To add time before  “timeout” expired for your request

php_value max_execution_time 120

To change PHP memory limit

php_value memory_limit 128M

To change “POST” max size

php_value post_max_size 32M

To desactivate short_open_tag

php_flag short_open_tag off

Improve Moodle or Magento cms

php_value always_populate_raw_post_data –1
Updated on 18 August 2021

Was this article helpful?

Related Articles

Need Support?
Can't find the answer you're looking for?
Contact Support