Please use the “Print” function at the bottom of the page to create a PDF.
Valid for web hosting contracts purchased before September 15, 2025 and Managed Dedicated Servers.
Would you like to standardise your PHP configuration for all subdirectories without having to copy the php.ini file to each individual folder? In this article, we will show you an elegant and time-saving method that allows you to control all settings from a single file.
Note
For web hosting contracts purchased from September 15, 2025, the php.ini file must be located in the /home/www/ directory. The settings in the php.ini file will then be automatically adopted by all subdirectories.
The problem: Decentralized php.ini files
If you want to make individual PHP settings for your web hosting package or managed server, you usually use a php.ini file for this. By default, however, this file only works in the directory in which it is located. If your website has a complex folder structure (e.g. for various scripts, plugins, or image galleries), you would have to manually copy the php.ini to all subfolders each time you make a change. This is not only time-consuming, but also prone to errors.
The solution: Symbolic links (symlinks)
The efficient solution to this problem is symbolic links (also called symlinks). Instead of copying the php.ini, we create an intelligent link in each subdirectory that points to a single, central php.ini file.
Your advantages:
- Central administration: You only have to make changes in a single file.
- Time saving: No more manual copying for each customisation.
- Consistency: All subdirectories are guaranteed to use the same PHP settings.
Step-by-step instructions
Requirements
- SSH access: You need active SSH access to your web space.
- Basic knowledge of the command line: You should be familiar with simple commands such as cd.
- Backup: To be on the safe side, always create a backup of your data before making any major changes.
- Connect to the server: Connect to your web space via SSH. You can find instructions on how to establish an SSH connection in the article Connecting to your webspace via Secure Shell (SSH) using PuTTY.
Change to the root directory: Use the cd command (change directory) to navigate to the root directory of your website in which the central php.ini file is or should be located.
cd /path/to/your/website
Replace /path/to/your/website with the actual path on your server.
Create symlinks: Now execute the following command. It searches for all subdirectories and automatically creates a symlink to php.ini in your current directory.
find . -type d -exec ln -s "$PWD/php.ini" "{}/php.ini" \;
You are now finished. Future changes to your PHP configuration now only need to be made in the one original php.ini file in the root directory. The changes will immediately affect all subdirectories.
Note
After executing the command, you will probably receive a message such as: ln: the symbolic link './php.ini' could not be created: The file already exists.
You can safely ignore this message. It appears because the command also tries to create a link in the current directory where the original php.ini is already located.
To undo the changes
If you want to remove the created symlinks again, for example to test different configurations, you can also do this with a single command.
Navigate back to your main directory and execute the following command:
find . -type l -name 'php.ini' -delete
This command searches for all symbolic links with the name php.ini and safely deletes them without touching the original file.