***Note : In this post, we will be using a $ in front of a variable.***
If you have a user that needs a custom php.ini file for their account for any reason, here is how you can do it.
The first thing that you want to do is SSH to the server that user is on.
Next, you want to navigate to the account you are creating the custom php.ini for.
cd ~$username/public_html
Next, you want to copy the server php.ini file to the customers account.
cp /usr/lib/php.ini ./
Now we want to change the owner for the php.ini file. ***Do not forget the “:”, you can also use “.”***
chown $username: php.ini or chown $username. php.ini
Once that is done, use your editor of choice and make the PHP changes required. In this tutorial, pico is used, but this will work with any editor.
pico php.ini
Now you can make the changes that you want. Once you have the changes made, save the file, and close it.
Next, we want to open the .htaccess file so that we can tell the account where to load the php.ini file from.
pico .htaccess
Once you have the .htaccess file open, we want to add the code for the php.ini to load.
At the top of the .htaccess file, type the code below making sure that you enter the username.
suPHP_ConfigPath /home/$username/public_html
Lastly, save the .htaccess file, and close it.
Once that is done, the users account will load a custom php.ini file from the location specified.