Directory

Terms of Use

Privacy

FAQ's

Contact

How to Install PHP Scripts

There is an old saying with the acronym RTFM. Reading the manual that came with the script is certainly fastest way to learn how to install your script. As a newbie you may not know where to find that information. Almost all scripts worth installing have one or more files that will at least get you started. They exist within the files that came with the script but I am getting ahead of myself.

The first thing you need to do is unzip the script file you purchased or downloaded to some folder on your hard drive. If you are new at this you now have your first surprise. Your script as they are commonly called had a lot of files in that folder. Yep. A script is actually a series of scripts. Don't worry. In most cases you will never need to modify more than one or two of them.

Now before you do anything else create a new folder named BAK and copy all the existing files and folders to that folder. That way if you break something you have quick restore ability. Also keep your downloaded zip file in a safe place for future use.

The file you are looking for right now can have one of many names depending on what the developer choose to call it. The file might be html or just plain text. It may be in the main folder or located in a folder named Install or Docs. Some of the common names are: Readme, read1st, Install, installation, docs.

Before we go any further this would be a great time to advise you to download and use a better text editor than Windows notepad. Notepad2 is fast, free, easy to use text editor that will not break your scripts. It will also open files that the regular notepad won't open and display properly. As you will see in the screenshots below the real beauty of this little powerhouse is the syntax coloring of script elements. Due to the generous licensing the creator has given with the product we are able to offer you a free Notepad2 download from our site right now. Or you can visit the Author's site and download the most recent or an older version.

Either you found your file or did not. You understood it or you did not. If you are still reading, you have questions. Let's try to answer those questions. We are going to assume that this is a database site and that the scripts do not come with an installer program or at doesn't come with one that can write the configuration file for you.

Login to your hosting control panel and create the database. See our article Create a Mysql Database for full details on how to create a database, database user, user password and adding that user to the database. Be sure to take notes as you work and save that information to a notepad file.

Hopefully you reviewed the database creation article and you now have something like this copied to your notepad file:
Database host name: localhost
Database name: CPuser_dbName
Database Username: CPuser_username
Password: what-ever-you chose

You need to add that information and maybe some other information to one or two files. The most common name is config.php or config.inc. Sometimes it will be named conn.php or connect.php. Some scripts will have a conn file that only provides for the database connection and all the other control variables are stored in the config file or in the database. If you have no instructions for your scripts and none of the above exist, just keep opening files until you find one that looks something like the fragment below:

The screen shot above is for a set of scripts where only the database variables are set. Most of the other site configuration data is stored in the database and is entered by you as you install the sql tables using the provided installer program. There may be other information you need to modify whether there is or isn't depends on the script. Generally it is a good plan to never edit anything below the Do not Edit portion of any script unless you really know what you are doing.

Note how the coloring coding in the screen shot above shows you that this script is broken! The closing " is missing from the db_name and that changes the color of the remarks and comment fields to green. When the missing " is added back the display changes to this:

The next screenshot shows a configure script where additional information other than the database connection information is entered. You will need to enter data between the " " where the text is colored green for most of the items if the default option is not the same as yours.


Click to see a larger version of this image

Save your changes, upload the files to your server, visit the site and see what happens. Usually nothing happens because you have not installed the database tables yet. Some modern scripts will auto run the installer program at this point, most don't but they do provide an installer script for the database tables. If your script doesn't have that option then you will need to install the tables from the sql file using phpmyadmin from your control panel.

The two things we did not cover in this article are file permissions and manually importing database tables into mysql because neither are usually necessary. We will try to address those issues in future articles.