This guide will explain how to set PHP directives for your site by using a .user.ini file. For customers using LCN web hosting and WordPress hosting.

Let’s get started…

What are PHP directives?

PHP directives are the configuration settings used to control various behaviours of PHP functions on your site. This can include for example; the memory limit assigned for PHP, the maximum amount of time before a PHP process will time out and the maximum file-size that could be uploaded via a PHP script.

For sites hosted on LCN Web hosting packages, changes to PHP directives can be applied by uploading a file named .user.ini to the hosting web directory. Changes specified in this file will only apply to the individual site that the file is uploaded to.

How to create a .user.ini file

You can use a text editor like Notepad, Wordpad, or Textedit to create a .user.ini file. You can start with an empty text file, then add each PHP directive that you need to set for your site on a new line and save the file, entering the file name as: .user.ini.

Please note; that the file name starts with a dot – on some operating systems this may be treated as a hidden file. You may need to update your system settings to allow viewing hidden files to avoid problems with this.

Below are some examples of PHP directives you can add to the .user.ini:

memory_limit=256M
post_max_size=1024M
upload_max_filesize=1024M
max_input_vars=1000
max_input_time=50
max_execution_time=60

Please note; the values included above are the defaults for sites hosted with LCN using PHP7. You should not need to add a .user.ini file unless you need to increase the default values provided above.

How to upload your .user.ini file

After you’ve created a .user.ini file, you can upload it to the webspace for your domain using FTP.

The following page will provide instructions for uploading files via FTP: how-to-upload-files-to-your-website-with-ftp

That’s it! You’ve created or edited and uploaded a .user.ini file to your website. The new settings should take effect on your site within five minutes.

Need a hand? Search over a hundred step-by-step support guides