How to set the PHP max upload file size limit through an .htaccess file? Print

  • 0

Today, we will guide you on how to set the PHP max upload file size limit through a .htaccess file. In order to set it, you need to perform the following steps.

  1. Login into your cPanel account.



  2. Go to Files Section and click on the File Manager option.





  3. Once you click on it, File Manager window will be opened.



  4. Click on the home icon. After then click on the public_html folder.





  5. Select the website name on which you want to set the max PHP upload file size limit. If the domain name is hosted as a primary domain name then the .htaccess file will be located under the public_html folder.

    If the domain name is added as an addon domain then it will be located under /public_html/domain_name/. Here, we have added quiz.com as an addon domain name so the .htaccess will be located under /home/public_html/quiz.com/



  6. Open the .htaccess file with the file editor. If you don't see the .htaccess file in the site's document root folder, you may need to make hidden files visible or create a file.





  7. Add the following code at the end of the file. If the below lines already exists in the file then you need to edit the value (xx) you want to set.

    php_value upload_max_filesize xxM

    php_value post_max_size xxM




    Note:
    • Replace xx with the max PHP upload file size limit that you want to set, in Megabytes.

    • Upload max filesize - It is the maximum size of an uploaded file. This is the limit for a SINGLE file.

    • Post max size - It is the limit of the entire body of the request (which may include multiple files as well as other stuff). The PHP documentation even says “To upload large files, this value must be larger than upload_max_filesize.

      Example: If you want to set 32 MB max PHP upload file size limit for your website then you need to set the upload_max_filezile to 32 MB and the post_max_size to 64.

  8. Click on the Save changes button to save the changes made in the .htaccess file.



  9. By clicking on it, the data will be saved in the .htaccess file and you will get a message on the screen that Success!. That's all.







Was this answer helpful?

« Back
Sign up for a newsletter

chat