installer script!


Read With Formatting | Free Open Source Tutorials Account

PHP Development
Thread: installer script!


mally
Hi I'm a newbie!!!!!!!! so go easy

I've been developing a site for what seem ages now using php and mysql backend. now it nearly complete apart from i've had a brain fart :D and decided to make an installer script for it so if anyone want to download the source code to use at their pleasure. But i'd like them to be able to install the script by uploading it to their server CHMOD a few files so the install.php can write bits of info to with a form where they type host,username,password and what they want to call the DB then it installs everything and they are up and running in about 5 mins anybody done such a project to help me on my quest..... :confused: :confused:

any comments welcome now i've got as far as installing a DB on my test server using php.net to get this far.


<?php
include ('details.php');// this part holds the db config stuff
$link = mysql_connect($host, $user, $pword);
if (!$link) {
die('Could not connect: ' . mysql_error());
}

$sql = 'CREATE DATABASE $user_test';//this part needs to echo the $user to place in front of _test for db
if (mysql_query($sql, $link)) {
echo "Database my_db created successfully\n";
} else {
echo 'Error creating database: ' . mysql_error() . "\n";
} //other problem i'm having is creating the tables
?>

and the details code is as follows this isgoing to be the config file if you like!!


<?PHP
$host ="localhost";
//site & Mysql user login
$user ="my_user_name";
//site & Mysql password
$pword ="my_password";
// more info will be added below here EG $sitename
?>


Cheers

Mally