/    Sign up×
Community /Pin to ProfileBookmark

Installation script tutorial

Hi. When you install applications such as Joomla or WordPress, you run an installation page. This page asks for your database location and asks you to set a username and password. The script then creates a database, adds the user and installs the tables that the application requires, including table rows.

I am trying to create a similar setup. I guess I could do all of the above, but how do I save the database username and password etc so they can be used each time the application is run?

Does anyone know of a tutorial that shows how to build the installation process?

Thanks

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@NogDogSep 05.2011 — Generally you'll just want to write the info to a config file that is then used by your application as part of the config.php or whatever script you include for each page. It could be an XML or JSON file if you like using either of those formats, the format used by parse_ini_file(), or whatever suits your fancy. (JSON is really simple to use with the json_encode() and json_decode() functions, as long as requiring that PHP be at at least 5.2.0 is not an issue.)

As a side note, you may want to require that the user create the database separately, as many PHP installations do not allow it via PHP (or more accurately, do not allow users to create DB users with that privilege).
×

Success!

Help @Typhoon101 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...