Build an eCommerce Website with PHP – Part 4 – WAMP & Oracle SQL

dfsdfsd

So far we’ve looked at how the site was conceived and gained some general knowledge of PHP, HTML, JavaScript. We also took a quick look at how the database was built.
Now it’s time to move on to the actual project files and get them running on a local machine.

Download Project Files

Setting up the development environment

Software needed

  1. WAMP Server – This program offers a great way of running PHP/MySQL applications on a local machine through an easy to use interface. It also functions as a web server so that other internet users can access websites that are stored on your PC just like if they were hosted on a professional web server.
  2. Oracle Java Software Development Kit (JDK) – Java isn’t needed to run this project but it’s required if you want to run Oracle SQL Developer. Since I’ve used Oracle SQL Developer to design the website’s database, it’s necessary that Java JDK is installed in order for the Database Administrator to be able to make changes to the Database.
  3. Oracle 11g Express Edition – The website’s database is entirely build on Oracle Server 11g

Installation steps

  1. Download WAMP Server from here
  2. Install WAMP Server. During the installation make sure to specify an easy to remember location for the program. I recommend using the default c:\wamp

    WAMP Instalation

    WAMP Instalation

  3. Download Java JRE from here
  4. Install Java JRE
  5. Download Java JDK from here
  6. Install Java JDK and make note of the location where you installed it. By default this should be C:\Program Files\Java\JDK
  7. Download Oracle 11g Express Edition from here
  8. Install Oracle 11g Express Edition. During the install process, you’ll be asked to enter a password for your database. Make sure you write down this password as it will be needed to later access the server.

    Oracle Setup

    Oracle Setup

  9. Download Oracle SQL Developer from here
  10. Unzip to the desktop the archive downloaded on step 9.

Setup process

Now that the Oracle server is installed, it’s time to create a new user. This user’s credentials will be used to access the database from PHP so make sure to write down his login information.

  1. Go to Start -> Oracle Database -> Run SQL Command Line
  2. In the command window that opens up, type connect, enter the user name SYSTEM and the password that you set on „Installation steps”, step 8.
  3. Create a new user using the create user command. The syntax for this command is as follows:
    create user user_name identified by user_password;
  4. Grant the newly created user dba rights:
    grant connect, resource to user_name;
  5. In SQL Developer go to File -> New -> Database Connection

    SQL Developer Connection

    SQL Developer Connection

  6. Enter a Connection Name (can be anything you want). For Username and Password use the credentials created on step 3. Be sure to check Save Password.
  7. Leave the other fields unchanged. Press Test to test this connection then Save and Connect.

The next part in this setup process is to create and initialize the database. Here’s what you need to do.

  1. Locate the database creation script, alarme_buzau_database.sql and open it in Notepad or any other plain-text editor.
  2. Select all of the lines in this file with Ctrl + A and copy them to the computer’s clipboard with Ctrl + C.
  3. Go to Oracle SQL Developer.
  4. Right click on the connection you created earlier and choose Connect.

    Connect to Database

    Connect to Database

  5. On the right side of the screen a new tab will open. Click in it and paste the database creation instructions with Ctrl + V
  6. Press F5 to run the script and create the database.

The last part of the setup process involves copying the website files and making them work with the database. Here are the steps that you need to follow:

  1. Locate the website folder named alarme_buzau
  2. Place this folder in your WAMP installation folder, this is by default c:\wamp\www. The final path to the website should be c:\wamp\www\alarme_buzau
  3. In your website folder, go to script\functions.php and open this file in a text editor.
  4. Change the two variables $dbUser and $dbPass so that they contain the credentials created in “Setup process” step 3. The line should look similar to the one below. Be careful not to erase the quotations around each of the values.
    //================== Database Connection ====================
    $dbUser = "AA";
    $dbPass = "aa";
    $dbServer = "localhost";
    
  5. Setup is now complete. In order to run the website you need to start WAMP Server by double clicking the shortcut on your desktop.
  6. Open your web browser and go to the following address: http://localhost/alarmebuzau/
Series Navigation