For all of our web hosting you can change all settings when it comes to the global .user.ini file on the server. We recommend changing PHP settings via cPanel under "PHP selector" as shown in the guide on step 4.
Apache / LiteSpeed
There is no difference when it comes to settings on these servers.
Content of the .user.ini file
When it comes to the content of the .user.ini file, you need to be aware of the following:
- Being able to change the .user.ini file also makes it possible to abuse the servers resources. If you have made changes in .user.ini which later causes massive usage of resources, your account will be suspended. The account will not be opened until we are sure you will take the necessary precautions in order to prevent this from occuring again.
- The configuration lines you do not include in your .user.ini file will use PHP settings on the server. The file only needs to contain the configurations you wish to change and not all other PHP settings like a php.ini file would need.
- The changes you include in .user.ini will normally apply immediately after the changes has been made. In some cases where the php process is already runningt this will need to finish first. It can take up to 0-5 minutes before the process is completed and the changes are made.
To see the existing configuration in PHP you can place the following code in a PHP-file (for example test.php) and access the file in your webbrowser:
The list of ini directives can be found here.
Classic examples of changing php.ini values
The examples below is classic examples of what our clients wants to change in php.ini. The examples contains only the change we want to make in the php.ini. All the other lines can also be included in the php.ini file. Error messages referred to under is found in the error_log file or on the site you are displaying if you have approved for error messages to appear.
- Changing upload_max_filesize (to 200Mb) is often necessary when uploading files. upload_max_filesize specifies the max file size available for upload.
upload_max_filesize = 200M;
- Changing post_max_size (to 200Mb) is often necessary when uploading files. post_max_size specifies the maximum file size available for upload by POST.
post_max_size = 200M;
- Changing max_file_uploads (to 50) is often necessary when uploading files. max_file_uploads specifies how many files maximum available for upload.
max_file_uploads = 50;
- Changing memory_limit (to 756Mb) is often necessary for PHP scripts with a larger requirement for memory than standard.
memory_limit = 756M;
You will typically see this error message if memory_limit is too low:
PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 8192 bytes) in /home/username/public_html/one_or_another_file.php on line 573
- Changing max_execution_time (to 180 seconds) is often necessary for PHP scripts that needs to run for a longer time to complete all code:
max_execution_time = 180;
You will typically see this error messsage if max_execution_time is too low:
PHP Fatal error: Maximum execution time of 60 seconds exceeded in /home/username/public_html/one_or_another_file.php on line 33
- Changing register_globals (to on) can be necessary for older scripts or scripts with special needs:
register_globals = On;
- Changing display_errors (to on) can be necessary for testing when programming in order for error messages to display on website:
display_errors = On;
- Changing session.save_path to store sessions somewhere else than /tmp which is standard:
session.save_path = /home/username/min_tmp;
- Changing magic_quotes_gpc to not make changes in GET/POST/Cookie data (is turned off for our newest servers - required by Joomla 3.0):
magic_quotes_gpc = Off;