Forum Moderators: coopster

Message Too Old, No Replies

Creating a Fantastico like 1 click install?

         

erikcw

4:12 pm on Apr 12, 2006 (gmt 0)

10+ Year Member



Hi all,

I need to create a script that will perform a "1 click install" of another script.

The install requires:
-create MySQL database and user - assign "all" privleges
-copy script into user's home directory
-populate database with data
-create config.php file with database user/pass etc...

Any ideas about how I can tackle this one?

Thanks!
Erik

kkobashi

5:09 pm on Apr 12, 2006 (gmt 0)



Best thing to do is study installer code of other PHP applications that you use and admire. PhpBB's installer comes to mind.

jatar_k

5:28 pm on Apr 12, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



you've pretty much got the layout right there, I would change a couple steps though

- user copies script into their home directory along with config.php file
- user edits config with database user/pass etc...
- create MySQL database
- populate database with data

erikcw

5:49 pm on Apr 12, 2006 (gmt 0)

10+ Year Member



Maybe I misyped. I want to create a one click install on the admin side. So I can just run the shell script or whatever and it will setup the script for the user (quick and dirty).

Thanks!
Erik

jatar_k

5:54 pm on Apr 12, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



aaahhhh

well then making a shell script would work

you should look up shell scripting but essentially you are issuing the same commands you would from the command line. So go through the process from the command line and paste everything you put in into a text file and at least that will tell you what steps there are in the process.

erikcw

6:08 pm on Apr 12, 2006 (gmt 0)

10+ Year Member



Thanks Jatar.

Any idea how to submit mysql commands using a shell script?

I tried a simple script with 2 commands

mysql
quit

The first command works, but quit isn't sent. Is there a special way to "pipe" commands into mysql? I'll need to create a database/user, and execute some sql...

Thanks!

jatar_k

6:21 pm on Apr 12, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



good point

you would probably have to create files to pipe in for the various commands, have you used a dump from mysql before? same premise

mysql -h hostname -u username -p databasename < /path/to/file.sql

some of those aren't always required, especially if you are creating the db and if the hostname is localhost you can leave that out as well

you do have to input the pass after that, then it just goes