Home >

Installing A PHP/MySQL Script

Many PHP scripts use a MySQL database, and you will want to set up the database through cPanel before installing the script. The process can be a little tricky, so we'll go through it, step by step.

For this example we'll use phpEventCalendar, a free application that allows users to post and display events or notes on a month-at-a-glance calendar. You can download phpEventCalendar from http://www.ikemcg.com/pec.

Once you have downloaded and unzipped the file, you will want to find the installation instructions. With this script, they are in a file named "README". The instructions indicate that you make changes to the "config.php" file and then run "createtables.php". Since the instructions don't indicate what changes need to be made to "config.php", you upload everything to your server and attempt to run "createtables.php". You get a cryptic error message, but don't give up. All you need to do is create a database through cPanel and enter the information in "config.php". Here are the steps (for the screen captures in this example, we used the Blue Lagoon version of cPanel):

 1. From cPanel, select "Manage MySQL":

pic1

 2. Scroll down to "Add DB", enter "calendar" and click "Add DB":

pic2

 3. You should get a message confirming that you created the database named calendar. Click "Go Back":

pic3

 4. When you return to account maintenance, you will notice that a prefix has been added to the database name. Databases are always prefixed with your account username and an underscore:

pic4

 5. Now we need to add a user account. Enter "admin" for UserName and "sesame" for Password and click "Add User":

pic5

 6. The screen should show that you created the account "admin" with the password "sesame". Click "Go Back":

pic6

 7. The last step in MySQL Account Maintenance is to add the user to the database. Note that the username has been prefixed with your account username and an underscore. Select the User and the Db and click "Add User to Db":

pic7

 8. You should get a screen showing that the account has been added to the access list:

pic8

 9. You are now finished with MySQL Account Maintenance and you can log out of cPanel, but we still need to add the database information to "config.php". Open the file and look for the following lines:

pic9

10. Add the database information:

pic10
Leave the database host name as "localhost". It is possible to add additional access hosts through MySQL Account Maintenance in cPanel, but it's not necessary.

11. Save "config.php" and upload it to your server. You should now be able to run "createtables.php" and complete the installation.


Email:  info@pittsites.com          Phone:  (916) 222-1573
Copyright © 2004 - 2006, Pitt Sites