{"id":1160,"date":"2020-11-12T14:43:12","date_gmt":"2020-11-12T14:43:12","guid":{"rendered":"https:\/\/blog.hostinger.io\/support\/2020\/11\/12\/4622356-how-to-edit-php-values-via-htaccess-at-hostinger\/"},"modified":"2026-03-16T12:12:13","modified_gmt":"2026-03-16T12:12:13","slug":"4622356-how-to-edit-php-values-via-htaccess-at-hostinger","status":"publish","type":"post","link":"https:\/\/www.hostinger.com\/support\/4622356-how-to-edit-php-values-via-htaccess-at-hostinger\/","title":{"rendered":"How to Edit PHP Values via .htaccess at Hostinger"},"content":{"rendered":"<p class=\"no-margin\">You can set up your website to handle larger file uploads and execute PHP scripts more efficiently by adjusting some configurations on your website&rsquo;s <b>.htaccess<\/b> file. This will help you fix issues such as crashes or errors when uploading large files, script execution timeouts, or memory limitations while running resource-intensive PHP applications.<\/p><p class=\"no-margin\">\n<\/p><h2 id=\"h_cfd61835cd\">Step 1 &ndash; Preparations<\/h2><p class=\"no-margin\">First, ensure your website, script, or application is <a href=\"\/support\/1583325-how-to-optimize-your-website-to-make-it-load-faster\" target=\"_blank\" class=\"intercom-content-link\">optimized<\/a>.<b> <\/b>Changing the limits is a temporary fix if your code has underlying issues, such as inefficient memory usage or memory leaks.<\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">Next, check the fixed maximum PHP values on the <a href=\"\/support\/1583467-how-can-i-see-my-php-configuration-info\" target=\"_blank\" class=\"intercom-content-link\">PHP Info page<\/a> of your hosting plan. The recommendation is to set values that meet your requirements while also leaving free resources for other essential processes. While you can add a buffer for occasional usage spikes, <b>avoiding allocating the maximum<\/b>&nbsp;available PHP memory limit is best.<\/p><p class=\"no-margin\">\n<\/p><h2 id=\"h_78aeb5af62\">Step 2 &ndash; Edit the .htaccess file<\/h2><p class=\"no-margin\">Open the <b>.htaccess<\/b> file using the <a href=\"\/support\/7949267-how-to-use-the-file-editor-at-hostinger\" target=\"_blank\" class=\"intercom-content-link\">file editor<\/a>. If the file is not present in the <b>public_html<\/b> folder of your website, <a href=\"\/support\/1583307-how-to-create-an-htaccess-file\" target=\"_blank\" class=\"intercom-content-link\">create it<\/a>.<\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">Once there, add the following lines at the end of the file:<\/p><pre><code>php_value upload_max_filesize 256M<br>php_value post_max_size 256M<br>php_value memory_limit 512M<br>php_value max_input_time 180<br>php_value max_execution_time 180<\/code><\/pre><p class=\"no-margin\">Replacing the sample limits according to your desired values, click on <b>Save <\/b>to apply the changes.<\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">If your project is growing, and you consistently need <b>more resources<\/b>, consider <a href=\"\/support\/1583459-how-can-i-upgrade-my-hosting-account\" target=\"_blank\" class=\"intercom-content-link\">upgrading your hosting plan<\/a> &#128640; <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Increasing PHP limits via the .htaccess file<\/p>\n","protected":false},"author":581,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"include_on_kodee":true,"footnotes":""},"categories":[194],"tags":[],"class_list":["post-1160","post","type-post","status-publish","format-standard","hentry","category-php-cpanel"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/support\/4622356-how-to-edit-php-values-via-htaccess-at-hostinger\/","default":1},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/support\/4622356-como-aumentar-el-tamano-maximo-de-archivo-de-carga-y-los-valores-de-php-a-traves-de-htaccess-en-hostinger\/","default":0},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/support\/4622356-comment-augmenter-la-taille-maximale-des-fichiers-a-telecharger-les-valeurs-php-via-le-fichier-htaccess-chez-hostinger\/","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/support\/4622356-bagaimana-cara-menaikkan-batasan-upload-max-filesize-php-value-melalui-file-htaccess-di-hostinger\/","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/br\/support\/4622356-como-aumentar-o-upload-max-filesize-e-valores-php-via-htaccess-hostinger\/","default":0},{"locale":"uk-UA","link":"https:\/\/www.hostinger.com\/ua\/support\/4622356----php---\/","default":0}],"include_on_kodee":true,"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/1160","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/users\/581"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/comments?post=1160"}],"version-history":[{"count":0,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/1160\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/media?parent=1160"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/categories?post=1160"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/tags?post=1160"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}