How to set PHP directives using .php.ini

This guide will explain how to set PHP directives for your site by using a .php.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 .php.ini file

You can use a text editor like Notepad, Wordpad, or Textedit to create a .php.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: .php.ini.

Please Note: 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 .php.ini:


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

How to upload your .php.ini file

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

For instructions on how to upload your file via FTP we have guide here

Or you can use the File Manager as shown here.

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

Was this article helpful?

Check out some of our related guides

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