creating a install.php feature.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Pezmc
Forum Commoner
Posts: 53
Joined: Mon Nov 06, 2006 2:15 pm

creating a install.php feature.

Post 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
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post 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.
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

ole! This question has you written all over it!
Pezmc
Forum Commoner
Posts: 53
Joined: Mon Nov 06, 2006 2:15 pm

Post by Pezmc »

how can I make php chmod a folder, create a file and put stuff in the file?
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post 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
User avatar
dude81
Forum Regular
Posts: 509
Joined: Mon Aug 29, 2005 6:26 am
Location: Pearls City

Post 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
Post Reply