{"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-10-29T14:56:43","modified_gmt":"2026-10-29T14:56:43","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><h2 id=\"h_cfd61835cd\">Step 1 &ndash; Preparations<\/h2><p class=\"no-margin\">First, ensure your website, script, or application is <a data-click-id=\"hgr-post-content-link-optimized\" class=\"intercom-content-link\" href=\"\/tutorials\/website-speed-optimization\/\" target=\"_blank\" rel=\"noopener\">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\">Next, check the fixed maximum PHP values on the <a data-click-id=\"hgr-post-content-link-php-info-page\" class=\"intercom-content-link\" href=\"\/support\/1583467-how-to-check-the-php-information-of-your-website-in-hostinger\/\" target=\"_blank\" rel=\"noopener\">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><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 data-click-id=\"hgr-post-content-link-file-editor\" class=\"intercom-content-link\" href=\"\/support\/7949267-how-to-use-the-file-editor-at-hostinger\/\" target=\"_blank\" rel=\"noopener\">file editor<\/a>. If the file is not present in the <b>public_html<\/b> folder of your website, <a data-click-id=\"hgr-post-content-link-create-it\" class=\"intercom-content-link\" href=\"\/support\/1583307-how-to-create-an-htaccess-file-at-hostinger\/\" target=\"_blank\" rel=\"noopener\">create it<\/a>.<\/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\r\nphp_value post_max_size 256M\r\nphp_value memory_limit 512M\r\nphp_value max_input_time 180\r\nphp_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\">If your project is growing, and you consistently need <b>more resources<\/b>, consider <a data-click-id=\"hgr-post-content-link-upgrading-your-hosting-plan\" class=\"intercom-content-link\" href=\"\/support\/1583459-how-to-upgrade-a-hosting-plan-at-hostinger\/\" target=\"_blank\" rel=\"noopener\">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":{"_content_updated_date":"","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-BR","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-\u044f\u043a-\u0437\u0431\u0456\u043b\u044c\u0448\u0438\u0442\u0438-\u043b\u0456\u043c\u0456\u0442\u0438-php-\u0437\u0430-\u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e-\u0444\u0430","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":2,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/1160\/revisions"}],"predecessor-version":[{"id":23113,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/1160\/revisions\/23113"}],"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}]}}