I'm designing an application that dyncamically adds virtual hosts to the server through usage f a PHP CLI app. Apache is setup to read these virtual hosts using the VirtualDocumentRoot and VirtualScriptAlias configuration options
VirtualDocumentRoot /home/vhosts/hosts/%0/public_html VirtualScriptAlias /home/vhosts/hosts/%0/public_html
The directory structure of the app is similar to below:
/home/application/ /home/application/application.php /home/application/views/ /home/application/controllers/ /home/vhosts/hosts/dev.vhost1.example.com/ /home/vhosts/hosts/dev.vhost1.example.com/application/temp /home/vhosts/hosts/dev.vhost1.example.com/application/sessions /home/vhosts/hosts/dev.vhost2.example.com/public_html/index.php
Where /home/application contains the PHP CLI app. It also contains class files that the scripts within each of the /home/vhosts/hosts/*/public_html directories load and execute.
There are currently two users - excluding
vhost. When ssh'ing in to call application.php via the command line new vhosts I am connecting via the application user. The cli function that creates the vhosts directories are then owned by
application and not
I get that this is not the correct use of owners and would prefer for each vhost to be in crontrol of their own respective directories. I know how to add the new users, however I don't know how to get php to execute as a newly created user when it is being executed through the
I've also run into problems with each of the vhosts and the session/temp directories. As each of the writable directories are owned by
apache appears to be able to write files into the directories but not read them out again. I really don't know enough about permissions as to why this would be and any advice or pointers to good tutorials/docs would be greatly appreciated.