For Linux Web Hosting and Managed Dedicated Server packages
In this article, we'll show you how to change the PHP settings for your webspace. You can set individual PHP settings, such as different security settings or file limits, for each of your applications.
What is php.ini?
PHP settings are set with a text file named php.ini. The corresponding statements - so-called php.ini directives - must be inserted into the text file, which must then be uploaded to the script directory in the webspace.
Example Contents of a php.ini File
The statements must be entered in the php.ini line by line according to the following scheme:
Name of the Directive = Assigned Value
upload_max_filesize = 64M zlib.output_compression=1 zlib.output_compression_level=9
- The entry upload_max_filesize = 64M has the effect that files with a size of up to 64 MB can be uploaded per form (the default limit is 2 MB).
- The entries zlib.output_compression=1 and zlib.output_compression_level=9 activate zlib compression. With zlib compression you can compress PHP scripts or PHP output to speed up your website even more.
For an overview of the changeable settings (php.ini directives), see the article Which PHP settings can I change?
Creating a php.ini File
- Start a simple text editor on your computer. For example, Notepad (Windows) or Gedit (Linux).
Please note: If you use a fully featured word processor such as Microsoft Word instead, make sure to save the file in the simple .txt format (files in.doc, .docx or.odt format are not compatible). If possible, however, you should use a text editor.
- Enter the instructions for the settings to be changed in an empty document. Make sure that there is only one statement per line.
- Save the finished file as php.ini.
Please note: The saved file must be called php.ini and must not have any other extensions. php.ini.txt would not be recognized by the PHP server and therefore ignored!
Upload the Edited php.ini File to Your Webspace
After you have created the php.ini file, you have to upload it to the directory where your PHP script is located:
- Load the file either with the WebspaceExplorer
- Or alternatively upload them through the FTP access to your webspace. How to do this with the FTP program FileZilla, for example, is described in the article Upload data via FTP with Filezilla.
Please note: If the configuration change is intended to apply to scripts located in different directories, the php.ini file must be uploaded to each directory. If your web hosting package has SSH access, you can easily do this with a small shell script. How to do this is shown in the article Apply PHP settings to all subdirectories.
- Save the file as phpinfo.php.
- Upload the phpinfo.php file to the directory on your webspace that contains the php.ini you created previously.
- Visit the PHP file in your browser as follows:
Hint: The output of the info script is very extensive. Therefore, use the search function of your browser to find the line with the desired information. The search function is usually accessed using the key combination [CTRL]+[F] for Windows or [CMD]+[F] for macOS.