Steps to Change PHP Version in cPanel
Log in to cPanel:
- Open your web browser and navigate to Hosting URL which will resemble the following https://yourdomain.com:2083
- Enter your cPanel username and password to log in.
Locate the "Select PHP Version" Tool:
- In the Software section, look for the "Select PHP Version" option.
Choose PHP Version:
- You'll see a list of available PHP versions (e.g., 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1, etc..).
- Select the PHP version you want to use from the dropdown menu.
Apply the Changes:
- After selecting the PHP version, click on "Set as current" or "Apply" to make the changes.
Configure PHP Extensions (Optional):
- Below the PHP version selection, you'll find a list of PHP extensions (such as mbstring, pdo, curl, etc.).
- You can enable or disable specific extensions based on your website’s requirements by checking or unchecking the boxes.
Save Changes:
- After enabling the required PHP extensions, the server saves automatically.
Check Your Website:
- Visit your website to ensure it’s running correctly with the new PHP version. If you encounter issues, you can return to cPanel and switch back to a previous version.
Notes:
- Make sure your website’s software (CMS, plugins, themes, etc.) is compatible with the PHP version you choose to avoid functionality issues.
- Always back up your website before making changes to the PHP version.
In cPanel, PHP limits refer to configurable settings that determine how PHP scripts behave on your server. These limits control the resource allocation for PHP processes, such as memory, file size, execution time, and more. Adjusting these values helps optimize performance, avoid server overloads, and ensure compatibility with certain applications (e.g., CMS platforms like WordPress or Joomla).
While you are still on the Select PHP version page, Switch to the "Options" Tab.
Here are the common PHP limits you can manage in cPanel:
Memory Limit (memory_limit):
- Definition: This setting controls the maximum amount of memory a PHP script is allowed to allocate.
- Purpose: Prevents poorly written scripts from using excessive resources and crashing the server.
- Example: If you are running a CMS or e-commerce platform, increasing the memory limit might be required for complex processes like image handling or large database queries.
- Default Value: Often set between 64MB and 128MB.
- Typical Increase: 256MB, 512MB.
Upload Max Filesize (upload_max_filesize):
- Definition: Defines the maximum size of files that can be uploaded via PHP scripts.
- Purpose: Limits the size of file uploads to prevent server overloading.
- Example: If you’re uploading large media files, images, or videos, you might need to increase this value.
- Default Value: Typically set at 2MB or 8MB.
- Typical Increase: 32MB, 64MB, 128MB, depending on the server resources.
Max File Uploads (max_file_uploads):
- Definition: Limits the number of files that can be uploaded simultaneously in one request.
- Purpose: Prevents server overloads due to multiple file uploads.
- Default Value: Often set to 20.
- Typical Increase: 50, 100, or more depending on your use case.
Modify PHP Limits:
- You'll see a list of PHP directives, such as memory_limit, upload_max_filesize, post_max_size, etc.
- Click on the value next to the setting you want to change, and either type a new value or select one from the dropdown.
Save Changes.
Be cautious not to set the values too high, as this could lead to excessive resource usage on your server, affecting its performance.