Web Hosting Talk







View Full Version : One-Click Virt Domain Script Install


DreamStudios
04-08-2003, 12:50 AM
I'm using PHPManager and just want to add a link (I know how to do this) to the nav for my clients to install scripts like FormMail, Invisionboard, OSCommerce, Counters, Etc. Etc.

Basically, I want to know how I can use PHP to copy a file from like a /root/installs/whatever.tar.gz file to the virtual domain of the user (I will use variables pulled from PHPManager to do like /home/virtual/$domainname$domain/home/$username/mainwebsite_html/ )

Can anyone help me with this?

DreamStudios
04-08-2003, 12:52 AM
In addition to this, it would be hella sweet if I could figure out how to configure or run the install scripts for these scripts so that the user just has to type in the URL...

RandallKent
04-08-2003, 12:58 AM
If safe mode is turned off, you can use the fuctions below

system();
passthru();


-Randy

DreamStudios
04-08-2003, 01:06 AM
Sweet, do I need to do anything permissions wise on this file to be able to copy from directories which a normal user would not have access too? just chown root ?!?

Also, any ideas on how to do the config files for these scripts? I'm sure I could load the config file into PHP and like re-print the lines with the variables I need changed, but if there is an easier way that would be rockin.

DreamStudios
04-08-2003, 01:51 AM
This is what I've come up with:

<?

$cmd = "
cp /installs/formmail/formmail.v41b.tar.gz /home/virtual/$domain/home/$username/mainwebsite_html
cd /home/virtual/$domain/home/$username/mainwebsite_html
tar -zxvf formmail.v41b.tar.gz
cd formmail.v41b
cp formmail.php formmail.php.tmp
sed 's/yourdomain.com/$domain/g' formmail.php.tmp > formmail.php
sed 's/216.64.145.194/xxx.xxx.xxx.xxx/g' formmail.php.tmp > formmail.php
rm -f formmail.php.tmp
cd ..
mv formmail.v41b formmail
rm -f formmail.v41b.tar.gz";


system($cmd);

?>

However, it doesn't seem to be doing anything, it doesn't out put anything, it doesn't seem to do what it's supposed to. Any ideas?!

DreamStudios
04-08-2003, 01:53 AM
What permissions should I set the PHP file as btw?!

LinuXpert
04-08-2003, 03:47 AM
When you call a PHP script via web browser it will run as user nobody (web server's uid) so make sure user nobody has permission to run those commands.

DreamStudios
04-08-2003, 04:14 PM
How would I do that, I'm still learning, so a little how-to would be appreciated, the second I get this figured out, I'm gonna go crazy and be able to auto-install SOOO much for customers, it'll be great. Just gotta get over this hurdle though.