United States - EN - USD ( $ )

Knowledge Base

How to modify PHP settings in web hosting

SugarHosts web web hosting is optimized by default for most web applications using PHP parameters, and usually these variables do not require adjustment.

To maximize server performance, we do not support custom php.ini files. However, you can define some PHP configurations in .htaccess file.


Find .htaccess file

.htaccess file is stored in the root folder of website, which is a hidden file. To see this hidden file (from cPanel > File Manager), you need to enable “Show Hidden Files” option (located in File Manager > Settings button, in top-right corner).

Another way to see and edit .htaccess file, is to use FTP.

Most mainstream web applications include .htaccess files by default. If the file does not exist in the website's root directory, creating a new blank file with the same name will be fine.


Adjust the maximum execution time of PHP scripts to 60 seconds

Add the following line to .htaccess:

php_value max_execution_time 60

The value 60 in the above parameter declaration can be replaced with the execution time you need, in seconds. The maximum execution time we allow is 180 seconds, and to ensure server performance and security, user processes which are being executed for more than 180 seconds will be forcefully terminated.

Modifying the executable time is not a recommended operation. A normal speed website program should be executed in less than 2 seconds. The longer a website program takes to execute, the longer a visitor will wait for the initial response (first data transmitted) from the website. If your website is experiencing frequent “Request Timed Out” errors during your daily visits, make it a priority to check your website's application settings and resources usage. On websites that remain unresponsive for more than 10 seconds, most visitors will get tired of waiting, and choose to close the page. Increasing the executable time, regardless of the cause, may not only fail to improve the site user experience, but may also make it impossible to terminate abnormal scripts in time, reducing the site's accessibility and efficiency.


Adjusting the maximum available memory for a single execution of a PHP script to 512M

Add the following line to .htaccess:

php_value memory_limit 512M

The default value is 256MB, which is more than sufficient for most web applications. Do not adjust it if this is not required. Adjustable range is between 64MB to 512MB.


Change the maximum upload file size

The default value of the maximum upload file size for PHP scripts is set to 100MB, and this setting can not, and should not, be changed. If you want to upload files over 100MB, please upload them via FTP. If you want to allow website users to upload files larger than 100MB, please note that, according to our terms, we do not allow hosting of file sharing services, or backup services, and such use may be in direct violation of our Acceptable Use Policy.

Choose your region, language and currency

Australia - English - AUD ( A$ ) European Union - English - EUR ( € ) United Kingdom - English - GBP ( £ ) United States - English - USD ( $ ) 中国大陆 - 简体中文 - CNY ( ¥ ) 香港 - 繁體中文 - HKD ( HK$ ) 台灣 - 正體中文 - TWD ( NT$ ) Hong Kong - English - HKD ( HK$ ) Worldwide - English - USD ( $ ) Worldwide - English - EUR ( € ) Changing region or currency will empty the cart [ CLOSE ]