released Posted August 2, 2007 Share Posted August 2, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/62968-remote-file-uploaddatabase-creation-script/ Share on other sites More sharing options...
deadimp Posted August 2, 2007 Share Posted August 2, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/62968-remote-file-uploaddatabase-creation-script/#findComment-314076 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.