At times, you will want to use software that requires a custom php.ini file or custom PHP configuration changes such as increasing the memory limit or upload limit that your site is allowed. Since these are settings that we can not change on a server-wide basis, you would need to make these changes locally on your account. Fortunately, with these easy to follow steps, you can have a .user.ini file created and customized within minutes!
Please note: This would mean, for example, if you were to create the .user.ini within their public_html, the changes are applied to the software that is installed in that particular folder only. Any subsequent PHP installations such as WordPress in a public_html/blog/ folder, wouldn’t be affected by said changes. In order to apply changes to subsequent sub folders within a directory, a separate .user.ini is necessary for each directory.
- Open up File Manager through your control panel (SiteAdmin or cPanel) and ensure you are in the public_html (www) directory (also ensure that hidden files are visible).
- Then, click the New File link at the top of the page to access the tool to create your new .user.ini file.
- You will be presented with a popup allowing you to name and configure the new file. In the New File Name box, add the text .user.ini . Be sure to include the dot before “user” in the filename.
- Now, your .user.ini file has been created! The next step is to edit the file and add the lines that you would like to customize. Locate the file in the list and click on it 1 time to highlight it.
- Once the .user.ini file has been highlighted, click the Edit link at the top of the page.
- This will then open up the file editor so you can input your custom configuration settings. Since we’ve just created the .user.ini file, it will be blank. All you would need to do is add the line from the server-wide php.ini file you wish to change and the new value such as the example image below.
And that’s it! You’ve now created your .user.ini file and all of your custom PHP configuration changes added to the file will be used by your website! Below are some of the most common lines that are altered when making custom PHP changes.
- memory_limit
- upload_max_filesize
- post_max_size
- max_execution_time
- max_input_time
- register_globals
- magic_quotes_gpc
Changing Your Memory Limit
This guide will show you how to increase the memory limit in PHP. While we don’t have a technical limit on how high you can set the php memory limit, we highly recommend that you not exceed 256M(128M for Legacy Servers).
If your .user.ini file is setup, all you need to do is open up your .user.ini file in your favourite command line editor (vi/vim/emacs/nano) and add the following line:
memory_limit = 256M
|
The changes will take place immediately. The web server does not need to be restarted.
Changing Your Max Upload
This guide will show you how to increase the max upload size in PHP (upload_max_filesize). By default it is 1024M(128M on Legacy Servers) on our shared/reseller/managed VPS but this can be increased as high as 2GB (max).
If your .user.ini file is setup, all you need to do is open up your .user.ini file in your favourite command line editor (vi/vim/emacs/nano), FTP or through the File Manager and add the following line:
upload_max_filesize = 1024M
|
The changes will take place immediately and can be set to whatever value you like. The web server does not need to be restarted.
Notice: If you will be uploading files via the “POST” method (most common), you will likely need to increase the post_max_size configuration value in conjunction with the upload_max_filesize value, if you have not already done so. PHP recommends that you set the post_max_size value higher than the upload_max_filesize value. Experiment with increasing it slightly above upload_max_filesize and increase it further if your uploads are failing.
Changing Your Post Max Size
This guide will show you how to increase the max upload size in PHP (post_max_filesize). By default it is 1024M(128M on Legacy Servers) on our shared/reseller/managed VPS but this can be increased as high as 2GB (max).To ensure the changes
you’ve made have been properly configured, you’ll need to increase the limit for this value to be higher than
the upload_max_filesize.
If your .user.ini file is setup, all you need to do is open up your .user.ini file in your favourite command line editor (vi/vim/emacs/nano), FTP or through the File Manager and add the following line:
post_max_size=1024M
|
The changes will take place immediately and can be set to whatever value you like. The web server does not need to be restarted
Changing Your Max Execution Time
This guide will show you how to increase the time out limit in PHP (max_execution_time).This value sets the maximum time, in seconds, the PHP script is allowed to run. By default the limit is 300 seconds(30 seconds in Legacy Servers) and if a script runs longer than 300 seconds, it will be stopped and you encounter a PHP related error. For large or multiple files, or users on slower connections, the default of 300 seconds(60 seconds in Legacy Servers) may be exceeded.
If your .user.ini file is setup, all you need to do is open up your .user.ini file in your favourite command line editor (vi/vim/emacs/nano), FTP or through the File Manager and add the following line:
max_execution_time=300 |
Note: This value can be set to whatever time limit you wish, however please note that our server is configured to kill off PHP connections that last longer then 30 minutes, so please keep that in mind when setting the limit.
Changing Your Max Input Time
This guide will show you how to increase the time out limit in PHP max_input_time. This value sets the maximum time, in seconds, the script is allowed to receive input; this includes file uploads. For large or multiple files, or users on slower connections, the default of 300 seconds(60 seconds on Legacy Servers) may be exceeded.
If your .user.ini file is setup, all you need to do is open up your .user.ini file in your favourite command line editor (vi/vim/emacs/nano), FTP or through the File Manager and add the following line:
max_input_time=300 |
Note: This value can be set to whatever time limit you wish, however please note that our server is configured to kill off PHP connections that last longer then 30 minutes, so please keep that in mind when setting the limit.
Changing Your Register Globals Value
Most of your scripts should not need this enabled, but some older scripts like to have it. It is NOT recommended that you enable this option in php 5.3 as it was deprecated in that version and it is removed from PHP 5.4.
Changing Your Magic Quotes
Most of your scripts should not need this enabled, but some older scripts like to have it. It is NOT recommended that you enable this option in php 5.3 as it was deprecated in that version and it is removed from PHP 5.4.