Page 1 of 1

creating a install.php feature.

Posted: Sun Jan 28, 2007 2:10 pm
by Pezmc
I have made a hit counter script but I would like a client to be able to download it upload it and run install.php. They then fill in a form with mysql address password etc, and a config.php file is created with all this information for the script to use, the script then creates tables in the database and then self combusts (deletes its self) how can I go about doing this?d

Posted: Sun Jan 28, 2007 2:34 pm
by superdezign
This takes a little familiarity with sql (or the ability to read the sql queries from phpMyAdmin or whatver database management system you use), but just make your install.php chmod a folder/file for you to create the config.php, print all of the information you want to be in there to the file, and then create the database table(s) through sql queries.

Ensure you have a lot of error reports for your user in case they make typos.

And I haven't see an installation script delete itself before... I think it's a bad idea because what if they want to reinstall/repair after making a small mistake, and aren't familiar with php?

Just make sure that you have a notice for them to delete it after use.

Posted: Sun Jan 28, 2007 2:41 pm
by Kieran Huggins
ole! This question has you written all over it!

Posted: Sun Jan 28, 2007 3:25 pm
by Pezmc
how can I make php chmod a folder, create a file and put stuff in the file?

Posted: Sun Jan 28, 2007 3:39 pm
by superdezign
To chmod a file, chmod($filename, permissions)

To open a file for writing to it, $handleToOpenFile = fopen($filename, 'w')

To write to the file, fwrite($handleToOpenFile, $data)

Be sure to fclose() the file, as well as chmod it back to what it was

Posted: Mon Jan 29, 2007 12:47 am
by dude81
I hope Im not adverstising open source tool here :roll:, I shall stop this.

Why dont you look at dotproject, which has the same feature, I know it fits exactly your requirement