Jump to content

Get Started on the Linux Apache/PHP Stack

What is an application stack?

An application stack consists of:

  • An Operating System that everything runs on (Linux)
  • A database that holds your data (Postgres Plus)
  • A Web Server that handles the data (Apache)
  • A programming environment (php)

How do I get an application stack?

To Install Postgres Plus on your computer, use this tutorial

To install Apache and php on your computer, use this tutorial

What ports are my stack components using?

When you installed Postgres Plus and Apache, you were prompted for a port number.

The default port for Postgres Plus is 5432, the default port for Apache is 8080.

If you need to check what ports you used, it's easy to do - just follow these instructions.

 

Apache

Go to the directory where you installed Apache, and look in the /conf directory. The default install directory is /opt/PostgresPlus/8.3/apache/conf

In httpd.conf you'll see a section that looks like this:

# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to 
# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
#
#Listen 12.34.56.78:80
Listen 8080

Listen tells you the port number apache is running on.

 

Postgres Plus

Go to the directory where you installed Postgres Plus, and look in the /8.3/data directory. The default install directory is /opt/PostgresPlus/8.3/data

In postgresql.conf you'll see a section that looks like this:

#---------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#---------------------------------------------------------------------------
# - Connection Settings -
#listen_addresses = 'localhost'		# what IP address(es) to listen on; 
					# comma-separated list of addresses;
					# defaults to 'localhost', '*' = all
					# (change requires restart)
port = 5432				# (change requires restart)

Port tells you the port number Postgres Plus is running on.

 

Stopping and Starting the Apache and Postgres Plus Services

To Start, Stop and Restart Postgres Plus on Linux, Select Start Database or Stop Database or Restart Database from the Database Server Menu inside the Postgres Plus 8.3 Menu.

 

Note: If you are using an account to login that is different to the account required by the database server, you'll see the following message. Simply enter the password for the account that is authorized to start/stop the database server.

 

 

You can also Start, Stop and Restart Apache, from the phpPgAdmin Server Menu inside the Postgres Plus 8.3 Application Menu.

  <

 

It's easy to connect to the Apache Web Server to see if it's working, simply go to your browser and go to the location http://localhost:8080

If the Web Server is running, you'll see this:

 

 

 

Using pgAdmin III with Postgres Plus

pgAdmin III is a client tool that is bundled with Postgres Plus. It provides a full suite of tools to manage, administer and develop applications on your database.

This is not a full fledged Tutorial on pgAdmin III, rather it takes you through the basics of starting the tool and logging into the database server.

There are some pointers here on how to execute SQL, and how to create database objects like users and databases.

This section is intended to be used in conjunction with tutorials for the installation of other products that need you to add users to Postgres Plus, create databases that are owned by these users, and then create schema objects (like Tables) from scripts (by executing the scripts in the Query Tool)

 

First, you need to start pgAdmin III, by selecting pgAdmin III from Developer/Client Tools Menu inside the Postgres Plus 8.3 Application Menu.

 

 

Once you are connected to your database, you see this panel

 

 

And if you click on the + to the left of your database server you'll see this pane that allows to to manage your database.

 

 

Adding Users

Adding a new user to your database is easy, you simply right click on Logon Roles, and select New Login Role

You will presented with a panel than allows you to name the Login Role (user), and the privileges that this user will have

 

 

Adding Databases

To create a new database, right click on Databases and select New Database

You will then see a panel where you can enter your database options, at a minimum all you need to do is name the database and assign an owner (i.e. the user you created earlier)

 

 

Using the SQL Tool to run scripts

If you have an SQL script that you have been given to run, it's easy to execute this in pgAdmin III, here's a simple script

select * from emp;
	

You need to select the database that you will run this script against, I'm going to use the demo database that is shipped with Postgres Plus in this example.

 

 

go ahead and click on the SQL Icon on the toolbar   

and you'll see this panel here - go ahead and paste your SQL into the Query Tool as below:

 

 

then press the      Execute Query icon to execute your SQL script

You'll see the results of your query in the Output Pane