Setting Up a Development Server Environment

At the time I wrote this Foxserv was the best solution for getting a development environment up and running. Since then I have changed my opinion and would recommend apachefriends' XAMPP package under Windows. The full XAMPP package comes with (in my opinion) too many things for a development server (such as a mail server etc) so I think it is better to get the XAMPP-lite package which can just be unpacked and run. The Apachefriends documentation is good enough that I don't have to rehash this guide again, but will leave the old version here for reference in case anyone still wants to read it.

Introduction

A lot of the other virtual workshops that I have written require that you have access to a PHP enabled web server or a MySQL server and command line client software (or both). While some people may already have access to such an environment or want to learn how to set one up themselves, others would just like somewhere to learn the other skills in the workshops. So in order to provide this environment without having to become a server administrator, we're going to look at installing an all-in-one solution that bundles several server programs into one easy to install package. Called Foxserv, this is a perfect solution for a test or learning server as everything has been integrated for you.

What's in Foxserv?

Foxserv bundles a web server (Apache) with a database (MySQL) and several web development languages (Perl, PHP and Python).

Getting the Foxserv installer

The FoxServ installer is available from their sourceforge site. The version at the time of writing is 3.0 and thus the following instructions are for that package. If you are using a modem it may be worth downloading individual components of foxserv (depending on what you require) rather than the whole bundle.

Starting the Install

As with most Windows software you begin the installation by double clicking the .exe file, in this case the FoxServ2.1.exe file. The first screen the installer will present loads the installer program itself.....

Starting FoxServ Setup

.....quickly followed by a standard welcome screen.....

Firs Setup Screen

....just click Next >. This will produce a dialog box asking where you want to install foxserv.

Install Destination

Click through the next screen as well which asks if you want to create program groups etc. There is no reason not to keep the defaults unless you have a specific method of storing menu items, but then if you do, you'll be used to making custom choices.

final setup prompt

.....click Next and FoxServ will start to install.

install progress

This installation may take a while as all the packages are uncompressed. Once finished, and if everything has gone well, you will be asked for several bits of information that will be put into several configuration files. Starting with your e-mail address:

e-mail addresss dialog box

...if you are planning to use this in any 'real' environment, you need to enter an actual working e-mail address. Click the OK button. Next is the port that we want Apache to listen on (each network service uses a different port to stop all the programs getting confused as to which one deals with traffic). The default is 80 and that shoulfd be fine.

port choice

It's worth noting that you should, if you haven't already done so, disable any other web servers that you may have running (such as IIS). Next you will be offered the chance to set up an adminstration account for MySQL.

You can set this to whatever you want (we'll need to use these values again soon though). Finally you will be asked (on Windows NT / 2000/ XP) which services you would like installed.

services install

Choose all of them. This is new to FoxServ 3.0 as you had to create the service by hand before. This also starts the apache monitor and winmysqlamin programs and puts them in the taskbar. I don't personally use these tools so I tend to close them if they are running.

Getting it Working

As we carry on, the instructions will differ slightly for Windows 9x/ME users and those using an operating system based in the NT codebase (that's Windows NT4, 2000 and XP). This is because the latter can runs some of the FoxServ components as Services, which are programs that are started automatically when the PC starts and then run in the background and thus we don't have to start and stop these components manually.

FoxServ Control Panel

Start the FoxServ Control Menu by selecting Start /Programs / FoxServ /FoxServ Control Panel.

FoxServ Control, Panel All the functions of FoxServ can be controlled from this menu.

FoxServ Directory Just shows you where FoxServ is installed.
Start FoxServThis starts any service that is not running and also starts the WinMySQLadmin tool. Note: Apache and MySQL each will start an instance in a Command Prompt window
Apache Shutdown Fairly straightforward....
MySQL Shutdown Likewise....
Install n Service These buttons wont work on Win 9x / ME
Visit LocalhostThis will open a browser at the root of your webserver, i.e. http://localhost/
Visit FoxServThis will open a browser at theFoxServ website.
View DocumentationThis will launch the documentaiton in a new browser window.

In the previous versions of Foxserv the Windows NT4, 2000 and XP users had to install the services by hand. This is thankfully no longer the case, but there are still some other bits and pieces that need to be tidied up post installation.

Tidying Up Post-Installation

There are a some things that should be done after installation - the first is to add the directories in which MySQL and Perl are installed to the Windows Environmental Path, secondly add a root password to MySQL and setup acahe to serve SSI files. These will be explained below.

Adding to the Environmental Path

The environmental path is all the locations that Windows will look in to find the requested program to execute. To get our MySQL installation working in the same manner used in the virtual workshops we need to add the MySQL directory to the path (and we may as well add Perl while we're at it).

NT / 2000 / XP

Right clicking on the 'My Computer' icon on the desktop will bring up a dialog box. Select the Advanced tab and then the Environmental Variables button. If there is an existing PATH variable then add a semicolon and the directories which contain MySQL and Perl executable files, seperated by another semi-colon:

C:\foxserv\mysql\bin;C:\foxserv\perl\bin

Apply and save this change and then test if it has worked by typing mysql -V and/or perl -V at the command line.

9x / ME

The easiest thing to do here is to edit the AUTOEXEC.BAT file and add the MySQL and PERL directory to the path there.

SET PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\FOXSERV\MYSQL\BIN;C:\FOXSERV\PERL\BIN

You will have to reboot your PC and then test if it has worked by typing mysql -V and/or perl -V at the command line.

Adding a root password to MySQL

While the MySQL server no longer installs without a Root password, I have not been able to find what this password is. This is obviously not good so we we use the admin user that we created as part of the install to set a root password.

At a command line start MySQL as the user you specified above:

> mysql -u <user> -p 

You will now be asked for the password, enter that and you will be faced with the MySQL command line prompt. Don't concern yourself with this too much at this point (Read the MySQL series if you want to learn more), simply copy the following command to set the new root password (where new_password is of your choosing):

mysql> SET PASSWORD FOR root@localhost=PASSWORD('new_password');

This will have set the passowrd for the localhost, but I noticed that the password is also not set for the root@'%' user (root loging in from any remote location) so repeat the command like so:

mysql> SET PASSWORD FOR root@'%'=PASSWORD('new_password');

Quit MySQL and then try logging as the root user:

> mysql -u root -p
Enter password:

...and you should log in.

It should be noted that the FoxServ package provides a program called 'mysqlfront'. This is a graphical way to manipulate the databases and may be quicker once you have clearly understood the command line version.

Adding .shtml to Apache

I noticed when I upgraded apache wasn't serving files with an SHTML extension properly (despite having entries in the configuration file). Thus if you want to use Server Side Includes then you'll need to do the following.

Open the c:\foxserv\apache\conf\httpd.conf file. This is where the apache server settings are stored. Browse down until you find the line:

AddOutputFilter INCLUDES .shtml

We need to add a line above that:

AddType text/html .shtml
AddOutputFilter INCLUDES .shtml

Save the file and restart Apache from the Services controller under the Control Panel (NT) or Control Panel/Administrative Tools (Win2000, XP). This Services Controller list all the services (including Apache and MySQL) and is used to start, stop, restart and control the startup status of servies. Windows 9x /ME users should shutdown and restart Apache from the FoxServ control panel.

Warnings and Disclaimers

This Virtual Workshop has been written aimed at those who wish to have a learning or test environment to develop the skills covered in the other workshops. However it is obvious that once installed Foxserv could be used for live systems thus there would appear to be 3 broad uses.

1) Standalone - Installed on a machine for personal skills development only, the database will never be used for real. This program is perfect for this.

2) On an Internal Network -For use by a small group of people, not accessible by the Internet at large. This should be OK, but check with those responsible for running your network.

3) Live on the Internet - Accessible by everyone. This is NOT recommended unless you learn a lot more about the programs and the security issues involved. The ONlamp.com website would be a good place to start learning more. I cannot provide individual help setting up this service..... well unless there is a consultants fee involved of course ;-).

I will also not be held responsible should any important data go missing as I only recommend this minimal setup for development or testing.

In this section

Related Reading

Related Books

Beginning PHP5, Apache, and MySQL Web Development

Related Ads