Jump to content

Recommended Posts

I would like to create an auto-install script that allows users to automatically upload my product to their host. I have created a pseudo-script as a logical reference for what I am trying to accomplish, but I am not sure of the correct methods to use.

 

Basically I will have a form where the user can enter his domain, username and password so the script can login as a root user to the site. Then, I would like to create the appropriate directories, then upload the files, then create the database, and run a database setup script.

 

Here is the logical pseudo-script:

 

<?

 

//Variables

$domain= "";

$user= "";

$pass= "";

$databaseName= "";

$databaseUser= "";

$databasePass= "";

$rootFolder= "";

 

//File Array

$fileArray= array();

$fileArray[0]= "";

$fileArray[1]= "";

$fileArray[2]= "";

$fileArray[3]= "";

$fileArray[4]= "";

$fileArray[5]= "";

$fileArray[6]= "";

 

//Host Connect

host_connect($domain, $user, $pass);

 

//Create Directories

$mp3s= mkdir($rootFolder."/MP3s");

$images= mkdir($rootFolder."/Images");

$downloads= mkdir($rootFolder."/Downloads");

 

//Upload Files

for($i=0; $i< count($fileArray); $i++){

file_put_contents($fileArray[$i], $path);

};

 

//Create Database

mysql_create_database($databaseName, $databaseUser, $databasePass);

 

//Setup Database

$dbSetup= file_open($rootFolder."/databaseSetup.php");

if($dbSetup= true){

echo "Setup Complete";

$deleteSetup= delete_file($rootFolder."/databaseSetup.php");

}else{

echo "Database Setup Error";

};

 

 

?>

 

 

Also, is there anything I should know about running scripts like this? How do I end the session logged in as the root user of their domain?

 

Help is greatly appreciated,

Jesse

 

 

I think including an install.php script in your software would be the best step, or just simplify your installation process to where no one would really need to use such a script (make a one-file compact configuration file). Having remote installation would make people, including myself, very uneasy, however trustful you make yourself out to be.

 

As for moving the files around, you would need an FTP connection, thusly, FTP information. As for MySQL, you would have to make sure that you can externally access the database, which isn't always the case. You can just have the database created in the local installation file, which should be all they really need.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.