hello... I'm more used to the Windows/ColdFusion world... so please excuse the nature of this nOOb question...
I'm helping to expand the capabilities of an XMB-driven online community. One new feature will be free blogs for members of a predefined status. I have some decent bloggin software (pMachine) and would like to create a PHP app that generates new blogs in a completely hands-off way. However, when I used the PHP script to write the new source pages for the blog (name.php), the premissions are set to Apache on the Linux server, not the admin of the virtual domain, which screws up subsequent blog scripts.
Is there a safe way where PHP can control setting the permissions of these newly created files? For now, I SSH to the machine (which I run) and chown * with the appropriate username. While this works, it requires a level of intervention I'd like to avoid.
Thanks.
use PHP to create new pages?
Moderator: General Moderators
You will need to create a process (method/script) that runs a few of the common *nix commands:
Ref : int chmod ( string filename, int mode)
http://uk2.php.net/manual/en/function.chmod.php
Ref : int chgrp ( string filename, mixed group)
http://uk2.php.net/manual/en/function.chgrp.php
Ref : int chown ( string filename, mixed user)
http://uk2.php.net/manual/en/function.chown.php
The generally take the same params as the CLI versions.
Regards,
EDIT>
To try and understand your issue a little better, it may be a job for Apache, or cause problems with apache.
If you have setup some kind of virtual hosting then there are synergies between the OS (adding users) and Apache (using /home/ dirs), but I'd need a better understanding of your system to confirm.
<END
Ref : int chmod ( string filename, int mode)
http://uk2.php.net/manual/en/function.chmod.php
Ref : int chgrp ( string filename, mixed group)
http://uk2.php.net/manual/en/function.chgrp.php
Ref : int chown ( string filename, mixed user)
http://uk2.php.net/manual/en/function.chown.php
The generally take the same params as the CLI versions.
Regards,
EDIT>
To try and understand your issue a little better, it may be a job for Apache, or cause problems with apache.
If you have setup some kind of virtual hosting then there are synergies between the OS (adding users) and Apache (using /home/ dirs), but I'd need a better understanding of your system to confirm.
<END
Last edited by cactus on Tue Jul 01, 2003 12:25 pm, edited 1 time in total.
Sorry, I should have supplied more info.
Yes, it is a virtual host scenario running under the Ensim WEBppliance control panel. I own (well lease) and operate the machine. So, the Linux owner of the files in this site is "adminX", and the owner of the php files written by the script is "Apache".
The ultimate goal is to offer a "Start Blog" button for community members that have achieved a certain status or rank. The blog databases would be populated with the user preferences from the forum database, and appropriate blog-specific files written automatically... hands off.
Yes, it is a virtual host scenario running under the Ensim WEBppliance control panel. I own (well lease) and operate the machine. So, the Linux owner of the files in this site is "adminX", and the owner of the php files written by the script is "Apache".
The ultimate goal is to offer a "Start Blog" button for community members that have achieved a certain status or rank. The blog databases would be populated with the user preferences from the forum database, and appropriate blog-specific files written automatically... hands off.
I'm unsure why you feel the files have to be (ch)owned. The (blog) files will still need to be owned by the "Apache" user to run, if so just ensure that any files created by the "Start Blog" system are owned by "Apache".
Does your "Start Blog" operation run outside of the Apache environment ?
Regards,
EDIT> Posted too late!
Does your "Start Blog" operation run outside of the Apache environment ?
Regards,
EDIT> Posted too late!