How to Increase Upload Max Filesize and PHP Values via .htaccess cPanel Print

  • Updated on 14-Jul-2024
  • 27

How to Increase Upload Max Filesize and PHP Values via .htaccess in cPanel

When you're working with your website hosted on a cPanel server, you might encounter a situation where you need to upload a file larger than the default size limit allowed by PHP. Similarly, you may need to adjust PHP values to meet the requirements of your website. Fortunately, you can easily increase the upload max filesize and other PHP values by using the .htaccess file. This article will guide you through the process.

Understanding the .htaccess File

The .htaccess file is a powerful configuration file used by the Apache web server. It allows you to override your server's global settings for the directory it is placed in and all the subdirectories under it. This means you can increase the PHP file upload size, among other settings, directly from this file.

Info! Before making any changes, ensure you have a backup of your .htaccess file. This precaution allows you to restore the original settings if needed.

Steps to Increase PHP Values via .htaccess

  1. Accessing the File Manager: Log in to your cPanel account and navigate to the File Manager under the Files section. Here, you'll find your website's files and directories.

  2. Locating .htaccess: Navigate to the public_html directory, which is the root directory for your website. If the .htaccess file isn't visible, click on the "Settings" button in the top-right corner and select "Show Hidden Files (dotfiles)."

  3. Editing .htaccess: Right-click on the .htaccess file and select "Edit." If you don't have a .htaccess file, you can create one by clicking on the "New File" option, naming it ".htaccess," and ensuring it's placed in the public_html directory.

You can find the detailed article here about access and edit .htaccess

Modifying PHP Values: Add the following lines to your .htaccess file to increase the maximum file upload size and modify other PHP values as needed:

php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300

This example increases the maximum file size for uploads to 64MB and adjusts the execution and input times. Adjust these values according to your requirements.

Warning! Be cautious when setting these values too high, as they can affect your website's performance and security.

Save Changes: After adding the desired PHP values, save the changes to your .htaccess file and close the editor.

Test the Changes: To ensure that your changes have been applied, you can create a simple PHP info file or contact support for assistance.

Success! You've successfully increased the upload max filesize and adjusted PHP values via the .htaccess file.

Step-by-Step Guide to Create a PHP Info File

  1. Log in to cPanel: Start by logging into your cPanel account. You can usually do this by navigating to and entering your credentials. Replace with your actual domain name.

  2. Access the File Manager: Once logged in, look for the “File Manager” under the Files section and open it. The File Manager allows you to manage all files related to your website.

  3. Navigate to the Public_html Directory: Find the public_html directory in the File Manager. This directory is the root folder for your website where your site’s files are stored.

  4. Create a New File: In the public_html directory, click on the “+ File” button at the top-left corner to create a new file. Name this file phpinfo.php.

  5. Edit the New File: After creating the phpinfo.php file, find it in the list, right-click on it, and choose “Edit” from the context menu. A text editor will open within your browser.

  6. Add PHP Info Code: In the text editor, paste the following PHP code:


This code will generate a webpage displaying the current PHP configuration and settings for your server.

  1. Save the Changes: Click on the “Save Changes” button in the top-right corner of the editor to save the phpinfo.php file.

  2. View Your PHP Info: Open a web browser and navigate to (replace with your actual domain name). You should now see a page displaying all your PHP configuration settings.

Info! The PHP info page contains sensitive information about your server's PHP environment. For security reasons, remember to delete the file from your server after you have finished reviewing the information.

Need Help?

If you encounter any issues or need further assistance with adjusting your PHP values, please open a support ticket here or initiate a LiveChat session using the icon located at the bottom right of the screen. Our team is here to help you ensure your website runs smoothly.

Remember, the .htaccess file is a powerful tool that can greatly affect your website. Always proceed with caution and consult with a professional if you're unsure about making these changes yourself.

Was this answer helpful?

« Back