On premium hosting you can alter php settings using various methods
How to Change PHP Options on a cPanel Server with CloudLinux
Overview
This guide explains how to modify PHP options on a cPanel server running CloudLinux. CloudLinux provides multiple methods to configure PHP settings, including PHP Selector for end-users and server-wide configurations for administrators.
Prerequisites
- cPanel/WHM access
- CloudLinux OS installed
- PHP Selector enabled in CloudLinux
- Appropriate user permissions (end-user or root/administrator)
Method 1: Using PHP Selector (For End Users)
PHP Selector allows hosting customers to select PHP versions and configure PHP options through their cPanel interface.
Step 1: Access PHP Selector in cPanel
- Log into your cPanel account
- Navigate to the Software section
- Click on Select PHP Version
Step 2: Select PHP Version
- From the dropdown menu, select your desired PHP version
- Click Set as current to apply the version
Step 3: Configure PHP Options
- Click on the Options tab
- Modify the following common PHP settings as needed:
memory_limit - Maximum memory a script can consume
max_execution_time - Maximum time a script can run
upload_max_filesize - Maximum file upload size
post_max_size - Maximum POST data size
max_input_time - Maximum input parsing time
max_input_vars - Maximum number of input variables
- Changes are saved automatically when you modify values
Step 4: Managing PHP Extensions
- Click on the Extensions tab
- Check or uncheck extensions as needed
- Common extensions include:
- mysqli
- pdo_mysql
- gd
- curl
- mbstring
- zip
- xml
Method 2: Using .htaccess File
Users can also override certain PHP settings using .htaccess access files
You can create a .htaccess file using your file manager (or add to it if it already exists)
examples are :
php_value memory_limit 256M
php_value max_execution_time 300
php_value upload_max_filesize 64M
php_value post_max_size 64M
Method 3: Using php.ini file
Users can also override certain PHP settings using a php.ini file, upload the file into the folder you want to apply the changes to
memory_limit = 256M
max_execution_time = 300
upload_max_filesize = 64M
post_max_size = 64M
Common PHP Options Reference
| Directive | Description | Default | Recommended |
|---|
| memory_limit | Maximum memory per script | 128M | 256M-512M |
| max_execution_time | Maximum script execution time | 30 | 60-300 |
| upload_max_filesize | Maximum upload file size | 2M | 32M-128M |
| post_max_size | Maximum POST data size | 8M | 32M-128M |
| max_input_time | Maximum input parsing time | 60 | 60-300 |
| max_input_vars | Maximum input variables | 1000 | 2000-5000 |
| display_errors | Show errors on screen | Off | Off (production) |
| error_reporting | Error reporting level | E_ALL & ~E_DEPRECATED | E_ALL & ~E_DEPRECATED |
| date.timezone | Default timezone | System | Your timezone |
| session.gc_maxlifetime | Session lifetime | 1440 | 1440-7200 |