Please use the “Print” function at the bottom of the page to create a PDF.
Valid for Linux Web Hosting and Managed Dedicated Servers.
With your own php.ini file, you can customize PHP settings such as the upload limit for your website. This guide shows you how to create the configuration file, upload it to your web space, and check that the changes have been successfully applied.
What is a php.ini file?
The php.ini is a configuration file for PHP. It consists of simple text instructions, the so-called directives, which are structured according to the scheme directive = value.
You can use a php.ini file to customize PHP settings for your website. For example, you can increase the upload limit for files, or activate server-side compression to optimize the loading time of your website.
Here is an example of a php.ini configuration:
upload_max_filesize = 128M
zlib.output_compression=1
zlib.output_compression_level=9
The entries explained:
- upload_max_filesize = 128M: Increases the maximum file size for uploads to 128 megabytes (default: 64 MB).
- zlib.output_compression = 1: Activates data compression to speed up your website. The value 1 stands for "On".
- zlib.output_compression_level = 9: Defines the compression level (scale from 1 to 9).
Which PHP settings can I change?
A complete overview of all PHP directives that you can change at IONOS can be found in this Help Center article: Which PHP settings can I change?
Customize PHP settings in 3 steps
Step 1: Create php.ini file
Open a simple text editor (e.g. Notepad on Windows, or TextEdit on macOS).
Insert the desired configuration instructions. Write each instruction on a new line. An example:
upload_max_filesize = 128M
zlib.output_compression = 1
zlib.output_compression_level = 9- Save the file under the name php.ini. Make sure that no additional extension, such as .txt, is appended.
Step 2: Upload php.ini file
Upload the created php.ini file to the directory in your webspace where you want the settings to apply. You can use Webspace Explorer or an SFTP program such as FileZilla to do this.
Instructions for uploading files can be found here:
Uploading a file using Webspace Explorer
Transferring files with FileZilla using SFTP
Please Note
Important notes on uploading:
- Do not overwrite existing php.ini files: If a php.ini file already exists in the directory, download it first to save your previous configurations. Then add your new instructions and upload the edited file again.
- Validity for subdirectories: The php.ini is only valid for the directory in which it is located. To apply the settings to all subdirectories, the file must be copied to each individual directory. You can find out how to automate this with a script in the article Applying PHP settings to all subdirectories.
Step 3: Check the effectiveness of the changes
To check whether your new settings are active, you can display the PHP system information:
Create a new file with the name info.php and the following content:
<?php phpinfo(); ?>
- Upload this file to the same directory where your php.ini is located.
- Open the page in your browser according to the following scheme: https://domain.tld/path/info.php. Adjust your domain name and the path to info.php accordingly.
- The script displays all active PHP settings. Use your browser's search function (Ctrl + F or Cmd + F) to quickly find the directive you have changed.
Please Note
Delete the info.php file from your webspace after the check so that sensitive server information does not remain publicly accessible.