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.

Lastest 10 Threads - view all

LAMP on a mac

Posted By: bay of islands at 21:08:12 on Friday the 14th of September 2007

just thought I'd stick this in here, took me a while to get mySql, PHP, Apache all going on a mac, then I found this site, mamp.info, which installs everything onto a mac (os x) really really easily. you can even switch between php 4 / 5 with a button. just my recommendation if anyone is trying to do all this on a mac.

Reply to this comment

Help with mysql and php

Posted By: Chris at 21:19:53 on Wednesday the 25th of October 2006

Hi I am new to php, mysql and apache. I have a book which I have read and learnt quite a bit from. I currently have a connection to mysql without a password but when I get onto the section which adds a pass I cannot get access from the php site but I can access it at the commant prompt. Here is the php script and here is my acc details: "should be a < here"?php

$domain = "localhost"; $user = "mike"; #note "MIKE" is unacceptable $password = "testpass";

$conn = mysql_connect( $domain, $user, $password );

if($conn) { $msg = "Congratulations $user, You connected to MySQL"; }

?>

"should be a < here"html>

"should be a < here"head> "should be a < here"title>Connecting user"should be a < here"/title> "should be a < here"/head>

"should be a < here"body> "should be a < here"h3> "should be a < here"?php echo( $msg ); ?> "should be a < here"/h3> "should be a < here"/body>

"should be a < here"/html>

I can log in using the command promts typing in: mysql -u root -p password: testpass

I have done the thing that grants all privileges: grant all privileges on *.* to mike@localhost identified by "testpass" with grant option;

The "should be a < here" is in place because if it is there when i post this message it actually runs the script. Sorry if it is difficult to understand.

Help would be appreciated :)

Reply to this comment

Re: Help with mysql and php

Posted By: keith at 00:51:55 on Thursday the 26th of October 2006

.., I can't see enough to solve the problem BUT couple of things to try.

1) put an else statement with print mysql_error();

as part of the connection

2) it may be a problem with mysql libraries and what your setup is. I.e. IIRC php built against mysql 3.23.x cannot connect to 4.1.x and above server

HTH

K

Reply to this comment

Re: Help with mysql and php

Posted By: Chris at 11:19:06 on Thursday the 26th of October 2006

My book doesn't go over mysql_error() so how would I plant it into my code.

Thanks.

Reply to this comment

Re: Help with mysql and php

Posted By: keith at 12:02:01 on Thursday the 26th of October 2006

if you read Part 3 of my php series there's a para on mysql_error();

Reply to this comment

Re: Help with mysql and php

Posted By: Chris at 17:58:20 on Friday the 27th of October 2006

This message came up when I tried to connect with the mysql_error implemented. What does it mean?

Client does not support authentication protocol requested by server; consider upgrading MySQL client

Thanks

Reply to this comment

Re: Help with mysql and php

Posted By: keith at 21:46:33 on Friday the 27th of October 2006

...sounds like the client problem i mentioned. What i'd do is dump ot any info from the database (see pt6) then uninstall everything and use XAMPP which I talk about above. That does work all together

Reply to this comment

Re: Help with mysql and php

Posted By: Chris at 22:29:38 on Friday the 27th of October 2006

How do you dump out any info out of the database? And what is pg6? or pg6, where can I find the link to that?

Thanks

Reply to this comment

Re: Help with mysql and php

Posted By: Chris at 11:24:42 on Thursday the 26th of October 2006

Also I am using php5.0.0-win32, mysql-4.1.20-win32 and apache_1.3.31-win32-x86-no_src. Are these compatable with eachother because the book says to use these. Is it right?

Thanks.

Reply to this comment

Help with mysql and php

Posted By: Chris at 21:19:44 on Wednesday the 25th of October 2006

Hi I am new to php, mysql and apache. I have a book which I have read and learnt quite a bit from. I currently have a connection to mysql without a password but when I get onto the section which adds a pass I cannot get access from the php site but I can access it at the commant prompt. Here is the php script and here is my acc details: "should be a < here"?php

$domain = "localhost"; $user = "mike"; #note "MIKE" is unacceptable $password = "testpass";

$conn = mysql_connect( $domain, $user, $password );

if($conn) { $msg = "Congratulations $user, You connected to MySQL"; }

?>

"should be a < here"html>

"should be a < here"head> "should be a < here"title>Connecting user"should be a < here"/title> "should be a < here"/head>

"should be a < here"body> "should be a < here"h3> "should be a < here"?php echo( $msg ); ?> "should be a < here"/h3> "should be a < here"/body>

"should be a < here"/html>

I can log in using the command promts typing in: mysql -u root -p password: testpass

I have done the thing that grants all privileges: grant all privileges on *.* to mike@localhost identified by "testpass" with grant option;

The "should be a < here" is in place because if it is there when i post this message it actually runs the script. Sorry if it is difficult to understand.

Help would be appreciated :)

Reply to this comment

Access denied problem

Posted By: George at 23:15:46 on Tuesday the 14th of September 2004

It seems that my 'mySQL' doesn't want to give me any access. After installing I was prompted to set up a user name and password, but they don't seem to work. I checked with the .ini file and the username and pw are there and i'm using them correctly, but i still am not able to get access. An oddity that i noticed is that when i check out the databases there doesn't seem to be a mySQL database only a 'test' data base. How can i gain access to my databases? btw i'm using mySQL 4.0.20a

Reply to this comment

Re: Access denied problem

Posted By: keith at 23:18:03 on Tuesday the 14th of September 2004

....the test database is the probably the only one that you have permissions to view. I'd try setting the root password via mysqladmin.... or search the mysql site for how to reset the root password

Reply to this comment

User and Password

Posted By: Mike at 23:52:04 on Friday the 26th of March 2004

I seem to have set up a root user and password since I can use these values to connect using phpmyadmin. However, when using the command line I can access the mysql prompt without having to give any user or password. At the c:\ promt I just type 'myaql\bin\mysql' and the mysql prompt is there. Any suggestions?

Reply to this comment

Re: User and Password

Posted By: Keith at 00:21:09 on Saturday the 27th of March 2004

....just because you get the prompt doesn;t mean that you have permissions over the databases though. You can start the program, but all that does is allow you to type commands. Whether the commands work is a different matter....?

Reply to this comment

Reading.php 2

Posted By: Chandesh Parekh at 17:09:04 on Monday the 1st of December 2003

Hi - Further to my earlier problem of not being able to view .php files, I can view them now, but strangly, only when I press enter twice! So - 1. go to http://localhost/test.php 'enter' returns 404 error; 2. 'enter' again (without changing anything) & page comes up! Tests for php, using phpinfo(), and mySQL connectivity come back positive, BUT only when I press enter twice!

Any ideas?

Thanx.

Reply to this comment

Re: Reading.php 2

Posted By: keith at 10:42:35 on Tuesday the 2nd of December 2003

...it doesn;t sound like a server problem, more like there is a web proxy in the way somewhere and it is needing two attempts to cache the file (and returning a 404 as a timeout). Problem being I'm notsure why you would have a web cache running locally.

What I would try (if you can) is accessing the web server from another machien or even via IP address to se if you have better luck and then you may be able to trace the problem better.....

Reply to this comment

Re: Reading.php 2

Posted By: Andrew at 13:25:20 on Sunday the 7th of December 2003

This is a common problem which I have just had with IIS (which totaly failed me) But damnit, I can't remember for the life of me how I fixed it. Are you using an NTFS drive? Permissions miught be screwed. Other than that I can't think of anything.

Reply to this comment

Re: Re: Reading.php 2

Posted By: Chandesh at 15:38:13 on Wednesday the 10th of December 2003

Hi Keith, Nope, running FAT32. I've had a peek at some of the php forums & it seems a lot of users have trouble running Apache2 on XP Home. But, no-one has any solutions. I did read on the apache site that XP SP1 should sort out the problem but it hasn't done so. It seems to be some incompatability issue with some XP Home releases! I'll give 1.3 a go & see what happens.

Thanx again for your time & help.

p.s. just thought of something - unlikely, but would XP's firewall have anything to do with it?

Reply to this comment

Re: Reading.php 2

Posted By: keith at 17:36:21 on Monday the 22nd of December 2003

...you replied to Andrew's comment so I never got the notification :-(. Only just noticed your question when doing some 'gardening' of posts from students asking me to do their work for them ;-)

Anyway... I didn't know about XP home having problems as a server (which is a shame). I doubt (but wouldn't be certain) about XPs firewall being to blame as it should trust localhost traffic to itself.

In terms of development, if things are still struggling along, you might consider a linux system (if you have an old machine lying around) which are really easy to setup nowadays and work really well on even old equipment. I run a test server on an old p133 with 64MB ram and that works fine.

K

Reply to this comment

Reading .php?

Posted By: Chandesh Parekh at 17:39:10 on Saturday the 22nd of November 2003

Hi - I'm a beginner in the world of PHP. I've just installed Foxserv on my pc & there's a slight hiccup - Although my browser can read the index.html file in the www folder, it returns a 404 error for the phpinfo.php file, even though it is present in the folder. I have checked the httpd.conf file for php & this is what I found - AddType application/x-httpd-php .php .php3 - According to everything I've read, this should allow my browser to see php files. So, I'm not sure what the problem is! Help! BTW, great tutorials - gave me the confidence I needed for php. Thanx.

Reply to this comment


Post a Comment or Question

Name
Email
URL (optional)
Title of Comment
Comment
HTML Allowed:
a,code,strong,em
I would like to be e-mailed any response to my comment.

In this section

Related Reading

Related Books

Beginning PHP5, Apache, and MySQL Web Development

Related Ads