Customer Service > Knowledgebase > Advanced > Make Custom PHP Changes Using .user.ini File

Make Custom PHP Changes Using .user.ini File

Pelican Server - 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'll need to make these changes locally on your account. However, 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 your 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.

- How To Create Your .user.ini file:

  • Open up File Manager through your control panel (cPanel) and ensure you are in the public_html (www) directory (also ensure that "hidden files" are visible).

File Manager public_html

  • Then, click the "New File" link at the top of the page to access the tool to create your new .user.ini file.

File Manager New 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" (without quotes). Be sure to include the dot before "user" in the filename.

File Manager new userini file

  • 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.

File Manager userini file

  • Once the .user.ini file has been highlighted, click the "Edit" link at the top of the page.

File Manager Edit File

  • 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.

File Editor userini config

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!


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 128M.

If your .user.ini file is setup, all you need to do is open up your .user.ini file and add the following line:

memory_limit = 128M

The changes will take place immediately on your hosting account.

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 128MB 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 via FTP or through the File Manager and add the following line:

upload_max_filesize = 1000M

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" (default: 12M) 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 128MB, 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 via FTP or through the File Manager and add the following line:

post_max_size=1005M

The changes will take place immediately on your hosting account.

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 60 seconds and if a script runs longer than 60 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 60 seconds may be exceeded.

If your .user.ini file is setup, all you need to do is open up your .user.ini file via FTP or through the File Manager and add the following line:

max_execution_time=120

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 60 seconds may be exceeded.

If your .user.ini file is setup, all you need to do is open up your .user.ini file via FTP or through the File Manager and add the following line:

max_input_time=120

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.


Also Read

Powered by WHMCompleteSolution