Jump to content

Get Started on the Windows Apache/PHP Stack

What is an application stack?

An application stack consists of:

  • An Operating System that everything runs on (Windows)
  • 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 C:\PostgresPlus\8.3\apache\conf

and open httpd.conf with notepad, 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 C:\Postgres Plus\8.3\data

and open postgresql.conf with notepad, you'll see a section there that looks like this:

#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------

# - Connection Settings -

listen_addresses = '*'		# 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 Stop and Start Services on Windows (and see if they are running) run SERVICES.MSC

 

You'll see the following entry for Postgres Plus, from here you can Start, Stop, Pause and Restart the Service

 

 

You'll see the following entry for the Postgres Plus 8.3 Web Server (Apache), from here you can Start, Stop and Restart the Service

 

 

It's easy to connect to the 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. You do this with

you'll see this menu structure

 

 

When pgAdmin III starts, you will see this panel

 

 

You can optionally turn off "Tip of the Day"

You connect to your Postgres Plus server by right clicking on it and selecting Connect, you need to enter your password.

 

 

Once you are connected, 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 that 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 is a simple script

select * from emp;
	

You need to select the database that you will run this script against. This tutorial will use the demo database that is shipped with Postgres Plus.

 

 

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