| Author | Post |
|---|
Keith Moderator
| Joined: | Fri Apr 8th, 2005 |
| Location: | |
| Posts: | 578 |
|
Posted: Sun Oct 15th, 2006 01:37 am |
|
The XAMPP server can be installed on your Windows XP desktop computer as a development server that mirrors your online web server(s). Entire websites can then be developed and tested on your local development server and uploaded to the web server(s) without making any changes to any files. The development server provides a secure and quick development environment where you can make any mistakes, and easily debug them, without compromising the web server(s).
First, download 3 programs.
From the URL:
http://www.apachefriends.org/en/xampp-windows.html#641
download the
XAMPP Windows 1.5.4a Installer
and the
XAMPP Add-Ons/Perl 5.8.8-2.2.3 Installer
Then download EditPadLite from the URL
http://www.editpadlite.com/editpadlite.html
Download the Lite version from the bottom of that page
EditPadLite is the best debug tool you can fall in love with.
Install:
XAMPP Windows 1.5.4a Installer
accept the default to install in the C:Program Files folder
During installation setup Apache and MySQL as sevices. A development server does not need an FTP so do not set up FileZilla as a service, also, do not set up Mercury as a service.
Install:
Perl 5.8.8-2.2.3 Installer
accept the default to install in the C:/Program Files folder
Install:
SetupEditPadLite.exe
accept the default to install in the C:/Program Files folder
Now for the good stuff. The folks at xampp are clueless as to what Perl is or how to use it, or how to do virtual hosting. we're going to fix all that.
First of all let's consider what we want to accomplish. As you should be aware, the domain http://some.com and http://www.some.com are two totally different domains as far as a browser is concerned. The two different domains can exist on two totally different servers, and that is exactly what we are going to do. We're going to put the http://some.com websites on your local development server and the http://www.some.com websites on your live webserver. But this distinction will only apply to the browsers on your local computer, all other browsers will still access http://some.com and http://www.some.com on your live web server. This way you can easily toggle back and forth between accessing files on your develpment and live server simply by adding or removing the "www" from the browser's URL. This can be done because we'll set up the http://some.com domain to resolve to the 127.0.0.1 loopback IP address on your local computer while leaving the http://www.some.com domains resolving to the IP address on your live web server.
First of all, let's doctor the Apache server you've just installed. Open C:/Program Files/xampp/apache/conf/httpd.conf in a text editor such as NotePad (Do NOT edit this file in a word processor like Word or even WordPad).
Find the string
ScriptInterpreterSource registry
on line 368 and REMOVE the # sign at the front of that line
Find the string containing
ScriptAlias /cgi-bin/
on line 323 and ADD a # sign at the front of that line
The ScriptInterpreterSource directive tells Apache to find the Perl Interpreter by asking Windows Registery where it is at. This is IMPORTANT. The first line of cgi scripts contain the path to the Perl Interpreter, we want to be able to leave the path that your live web server will need while letting the development server ignore that path. Xampp does not get it - their install process should have done this for you, now you have to do it.
Open your Windows File Explorer.(Start>Programs>Accessories>Windows Explorer). Click Tools>Folder Options.
Follow these instructions:
1.

2.

3.Enter the CGI extension in the empty field.

4. Select the CGI entry you've just made

5.

6.

7. Enter the word Open in the empty Action: field

8.

9.

10.

11.

12. Select any icon you want

13.

14.

Don't you wish xampp had done this for you the way other installations for Perl do?
If your live web server still uses the .pl extension go through all of the above steps to also create a file association for PL.
Now we are ready to set up Virtual Host tables for Apache. Open C/:Program Files/xampp/apache/conf/extra/httpd-vhosts.conf in a text editor such as NotePad .
Change line 19 by removing the ## signs fom the front of the line and edit that line to read
NameVirtualHost 127.0.0.1
Now let's create a Virtual Host table for some.com. First of all, we'll use the path structure that is identical to one on a live web server (use your web server's actual path instead), /home/httpd/vhosts/some.com/httpdocs. Below the two examples already in httpd-vhosts.conf we'll add:
<VirtualHost some.com>
ServerAdmin me@some.com
DocumentRoot "C:/home/httpd/vhosts/some.com/httpdocs"
<Directory "C:/home/httpd/vhosts/some.com/httpdocs">
Options Indexes FollowSymLinks MultiViews ExecCGI Includes
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ServerName some.com
</VirtualHost>
A table for one of your websites would of course have the name of that website and the correct path on the live server (with the Windows C: in the front of the path)
Create other tables for other websites. You can add as many tables and websites as you want.
As you may have guessed, you also need to create the path structure on your computer that you've used in these tables and put your site's files in the folder you've indicated.
You now need to tell your browsers to find some.com on the local server instead of the live web server. Luckily all computer have built-in DNS server, it's called the "host" file. Browsers always read the host file before trying to resolve a domain, if the host file contains an entry, the browser uses it instead of asking the WWW DNS server system to resolve the domain. Using the Windows File Explorer navigate to C:/Windows/system32/drivers/etc. You will see a file named hosts . The file does not have an extension. Single click to select the file, right mouse over it and select Open. A window will open, select Notepad. Once the file is open you need to add an entry on a new line. If we were doing editwrx.com the line would be
127.0.0.1 some.com
There is a TAB between the IP address 127.0.0.1 and the domain name. Add as many IP/domains as you want to this file, each one on a separate line. If you later want to turn off this internal routing for a domain either remove the entry or just place a # pound sign in the front of the line to comment the line.
Each time you change the hosts file you must close all instances of the browser and reopen the browser for the change to take effect. The browser reads this file and cache's it's contents while it is opening.
Now, make a desktop icon for EditPadLite. Right mouse over the icon and select Properties. Either click Find Target and find apache's error log, or just fill in the info. The Target field and Start In fields both begin and end with double quote

Copy that icon to the Quick Lanch tray or to the Start Menu, you'll use it!! Just click the icon and it open with the Apache error log. EditPadLite is a unique editor. You can leave it open and ask it to reload from the file by tapping the 4 key. Unlike most editors it can open any size file and display any length of line.
THAT'S ALL!!
Last edited on Tue Oct 17th, 2006 01:13 am by Keith |
vee Member
| Joined: | Mon Oct 9th, 2006 |
| Location: | |
| Posts: | 13 |
|
Posted: Tue Oct 17th, 2006 03:50 am |
|
Hi Keith
Done! All seems to be working nicely now. Thank you very much for the help.
I had to go through this a few times before I got what was going on. Most interesting though.
In addition I can now access phpmyadmin ok (localhost/phpmyadmin), create a database ok and configure/run a test php script put in the some.com htdocs directory ok (connects to the newly created database without problem) - so everything seems to be working fine.
However, what exactly is the base-dir directive that I need to put in and why?
Many thanks
Vee
Last edited on Wed Oct 18th, 2006 12:53 am by vee |
Keith Moderator
| Joined: | Fri Apr 8th, 2005 |
| Location: | |
| Posts: | 578 |
|
Posted: Wed Oct 18th, 2006 11:07 pm |
|
Vee
If you created some.com as a VirtualHost you can
http://some.com/phpmyadmin
and configure and create data bases there.
You can create a http://some.com/info.php with
<html><HEAD></HEAD><body>
<?php phpinfo(); ?>
</body></html>
to get the php info
or create http://some.com/include.php with
<html><head></head><body>
<?php include("this.txt") ?>
</body></html>
and include this.txt if it exists in the same folder as include.php
Substitute one of your own VirtualHost domains for some.com in the above examples.
Forget the open base dir stuff, that's for a production server, not a development server. Also, like I said before, forget localhost entirely, forget you ever heard of it, it is entirely irrelevant to anything you need to do.
|
vee Member
| Joined: | Mon Oct 9th, 2006 |
| Location: | |
| Posts: | 13 |
|
Posted: Thu Oct 19th, 2006 02:00 am |
|
Hi Keith
Yep - getting the hang of it now! Thanks again for a great tutorial.
Now for a couple of days rest... ;-)
Vee
|
vee Member
| Joined: | Mon Oct 9th, 2006 |
| Location: | |
| Posts: | 13 |
|
Posted: Wed Nov 8th, 2006 12:37 pm |
|
Hi Keith
Did you also figure out how to get imagemagick to work with xampp? (useful for demonstrating the gallery function). Doesn't seem to be installed by default.
Many thanks
Vee
|
Keith Moderator
| Joined: | Fri Apr 8th, 2005 |
| Location: | |
| Posts: | 578 |
|
Posted: Wed Nov 8th, 2006 07:04 pm |
|
I ran into the same problem. XAMPP has some of the Perl Modules for ImageMagick but I don't think it has all of them. I tried doing a full install of the ImageMagick Perl modules and a reinstall of ImageMagick itself but XAMPP still could not find the modules, or the modules could not find ImageMagick, I'm not sure which.
I finally gave up and uninstalled XAMPP and installed Apache and Perl the way they are supposed to be installed. I don't use PHP or MySQL so it was the logical solution for me.
|
vee Member
| Joined: | Mon Oct 9th, 2006 |
| Location: | |
| Posts: | 13 |
|
Posted: Thu Nov 9th, 2006 07:17 pm |
|
OK - thanks anyway!
Vee
|
 Current time is 05:10 pm | |
|