How to change PHP settings in cPanel using .htaccess

Why change PHP settings with .htaccess?

The PHP settings you change with .htaccess define the operating limits of your website (e.g. upload size, available memory, script execution time).
At Konet, thanks to CloudLinux OS + LiteSpeed Enterprise Web Server, you can easily adjust these settings through the .htaccess file.

Important: The maximum limits are always determined by your hosting plan and the upper security limits we have set.


Where is the .htaccess file?

  • For the main domain: in the /public_html/ folder.

  • For addon domains or subdomains: in the corresponding folder inside public_html (e.g. /public_html/example.com/).


How to modify PHP settings via cPanel

  1. Log in to cPanel.

  2. Select File Manager.

  3. Go to the public_html folder or your domain's folder.

  4. Locate the .htaccess file.

    • If it does not exist, create it (New File → .htaccess).

  5. Download a copy of .htaccess (right-click → Download) before every change, so you can restore it if something goes wrong.

  6. Right-click → Edit.

  7. Add the lines you need.


Examples of PHP settings you can change

 
# Maximum number of input vars php_value max_input_vars 3000 # Maximum available memory php_value memory_limit 512M # Maximum file size for uploads php_value upload_max_filesize 64M # Maximum size for POST php_value post_max_size 128M # Script execution time php_value max_execution_time 120

max_execution_time 120 means 120 seconds.

Tip: If the value you set exceeds the limit of your plan, the plan limit applies.


Frequently Asked Questions

Why do I see Error 500 after the change?
An Internal Server Error (500) usually means a syntax error in .htaccess or a value that is not allowed. Restore the copy you downloaded or remove the last lines you added. If the error persists, open a ticket with Konet support.

Can I change settings with php.ini or user.ini?
No, php.ini and .user.ini do not apply. At Konet, PHP settings are changed from the CloudLinux PHP Selector (Select PHP Version → Options) or through .htaccess, as the MultiPHP INI Editor guide also explains.

Why isn't the setting I added being applied?
It most likely exceeds your plan's limit. For custom needs, contact Support.

Can I have different settings on subdomains?
Yes. Create a .htaccess file in each subdomain's folder and add the settings there.


 

Was this article helpful?

Related service Konet Web Hosting cPanel, LiteSpeed and automatic backups: 24 every 2 hours for 48 hours, then 6 daily, 4 weekly and 3 monthly.

Related articles