Applying PHP Settings to All Subdirectories

For Web Hosting Linux packages with shell (SSH) access and Managed Dedicated Server

You may have already experienced this: You want your php.ini settings to apply to several directories. However, because the php.ini file only applies for the directory where it is located, it must be copied manually into each individual directory. This can be time consuming and must be repeated for each change.

In the following we will show you how to link your php.ini file to all subdirectories using a shell command ( more precisely: you create symlinks). Further changes to the original php.ini will automatically appl to all subdirectories. This is how it works:

 

Step 1

Connect to your web space via SSH.

Step 2

Go to the directory where the php.ini file is located. Type the command cd (change directory) in conjunction with the directory name and press ENTER.

cd myhomepage
Step 3

Enter the following command and press the ENTER to create the symlinks:

find -type d -exec ln -s $PWD/php.ini {}/php.ini \;

Note: As a php.ini file already exists in the current directory and therefore no symlink can be generated, you will receive the message "ln: creating symbolic link `./php.ini': File exists". You can ignore this message. For further changes you only need to make these in the original php.ini, because it now automatically applies to the subdirectories. You do not need another symlink to do this.