Monday, May 29, 2006

Create your own development environment - just add water

In the real world you will need a place to try out new web pages before you make them 'live' on the customer facing web site.

Today we're going to build a development environment that allows us to try out dynamic PHP pages on our local machines, with a database thrown in for good measure.

The ingredients we'll need are:

  1. a web server (we'll use Apache)
  2. the PHP interpreter
  3. the database engine (MySQL)
  4. some database management software (phpMyAdmin)
Getting all these things installed and playing nicely together can be a bit of a task. Fortunately there are folks out there who have done it already. One of those, dWebPro, will also run from a stand alone CD which you can give to your customers, relatives and friends.

To save on download times, I've put copies up on the local server - have a look in the dWebPro directory (or go here if you're inside the firewall) and you'll find the following files:
dwebpro_6.5.0.exe       7.9M - the web server
mysql40_package.exe 5.4M - the database software
php4_package.exe 7.5M - the PHP interpreter
phpmyadmin_package.exe 2.9M - database admin software
Download and install each of these in turn on a PC running Microsoft windows and you'll have your very own development environment.

Testing
If you installed with all the default options you can run the web server by clicking on the dWebPro icon on your desktop. After the spash screen you should see the phpMyAdmin screen displayed in the web browser. Note the URL. It doesn't point to a local file but calls http://127.0.0.1:8080/phpMyAdmin/ - you're looking at a page that's being served by a real live web server running on your PC with a local ip address (127.0.0.1, using port 8080).

Using it in anger
Now to try it out for yourself. Copy the form and php pages we created last week into the web server home directory. This should be: C:\DWebPro\deploy\www if you used the default installation.

Now open up the form page by entering it's server address in your browser's address bar. Something like: http://127.0.0.1:8080/testform.html

Submit the form, read the results and take a break.


thanks to David Reeves for "High Purity"

No comments: