Mass Update PHP Settings Across All Domains...

Hi,

I just came across an issue with PHP sessions and PHP running through FastCGI.

Apparently, you cannot use the global sessions directory to store session data when you use FastCGI implementation for a domain.

Ok, so I decided to create a directory structure inside the home directory like this:

/home


   /mydomain.com


      /var


         /lib


            /php


               /session

This folder tree is then owned by the domain owner in the same way as the custom “php.ini” file is.

All is good, HOWEVER…

The issue I’m running into is, HOW to EASILY convert existing domains to this structure without having to completely re-create the domain in Virtualmin.

I need to accomplish the following in a somewhat automated fashion.

  1. Create the directories “var”,“var/lib”,“var/lib/php”, and “var/lib/php/session” inside the home directory of each user.

  2. Update the value for “session.save_path” inside the “etc/php.ini” (which is located in each home directory) to reflect the new path.

*** PLEASE NOTE: this is already automated when creating NEW domains, so that’s not an issue. ***

Thanks in advance for any assistance on this matter!