Tuesday, February 15, 2005

Setting up a WAMP Server

Originally from http://www.sitewip.com/wamp/

Overview
This document is intended to walk you through the steps to create a full development server on your win32 system. I have tried to include all the steps I used to create a system that will allow you to develop on your local machine and match 95% of actual environment you will experience on a live *nix server.

I have completed this on Windows 95, Windows 98, Windows 2000 Professional +, and Windows XP (both home and professional). Windows 95 & 98 will require you to start the services listed below manually as they do not have a "Services" system like the others.

Required Downloads
The following is a list of the requirements for installing your system. 98% of all software we will discuss will be Open Source (free). Please support Open SourceYou should download these files and store them on your system in a place easy to find later. Once you have all these programs you are ready for the next step. This document will assume you have a c:\disks\ directory and create a new directory for each download ex: c:\disks\mysql\, c:\disks\php\, etc..

MySQL
Site: http://www.mysql.com/
Documentation: http://www.mysql.com/doc/en/index.html
Download: http://www.mysql.com/downloads/index.html (Production release)
The MySQL database server is the world's most popular open source database. Its architecture makes it extremely fast and easy to customize. Extensive reuse of code within the software and a minimalistic approach to producing functionally-rich features has resulted in a database management system unmatched in speed, compactness, stability and ease of deployment. The unique separation of the core server from the table handler makes it possible to run with strict transaction control or with ultra-fast transactionless disk access, whichever is most appropriate for the situation.

PHP
Site: http://www.php.net/
Documentation: http://www.php.net/manual/en/
Download: http://www.php.net/downloads.php (Latest stable version of PHP - Windows Binaries - Zip version not installer Example: PHP 4.3.2 zip package)
PHP is an HTML-embedded scripting language. Much of its syntax is borrowed from C, Java and Perl with a couple of unique PHP-specific features thrown in. The goal of the language is to allow web developers to write dynamically generated pages quickly.

Apache
Site: http://httpd.apache.org/
Documentation: http://httpd.apache.org/docs/
Download: http://httpd.apache.org/download.cgi (Latest version of Apache Windows Version 1.3.xx - Win32 Binary (MSI Installer) EX: Apache 1.3.28)
The Apache HTTP Server Project is an effort to develop and maintain an open-source HTTP server for modern operating systems including UNIX and Windows NT. The goal of this project is to provide a secure, efficient and extensible server that provides HTTP services in sync with the current HTTP standards.Apache has been the most popular web server on the Internet since April of 1996. The July 2003 Netcraft Web Server Survey found that 63% of the web sites on the Internet are using Apache, thus making it more widely used than all other web servers combined.

phpMyAdmin
Site: http://www.phpmyadmin.net
Download: http://www.phpmyadmin.net/ (Downloads Section)
phpMyAdmin is a tool written in PHP intended to handle the administration of MySQL over the WWW. Currently it can create and drop databases, create/drop/alter tables, delete/edit/add fields, execute any SQL statement, manage keys on fields.

Optional Downloads
The following is a list of the optional conponents for your system.
Zend Optimizer
Site: http://www.zend.com/store/products/zend-optimizer.php
Download: http://www.zend.com/store/products/zend-optimizer.php (Free Download)
The Zend Optimizer is a free application that runs the files encoded by the Zend Encoder and Zend SafeGuard Suite, while enhancing the running speed of PHP applications.

Development Tools
The following is a list of development tools that will help you a great deal. If you already have your favorites then stay with them, this is a list of my favorites.

FileZilla
Site: http://filezilla.sourceforge.net/
Documentation: http://filezilla.sourceforge.net/documentation/
Download: http://sourceforge.net/project/showfiles.php?group_id=21558 (Newest Version)
FileZilla is a fast FTP client for Windows with a lot of features. FileZilla Server is a reliable FTP server.

WebDrive
Site: http://www.webdrive.com/products/webdrive/index.html
Documentation: http://www.webdrive.com/support/webdrive/webhelp/webdrive.htm
Download: http://www.webdrive.com/download/index.html (Newest Version)
WebDrive is not free, but in my opinion is one of the greatest time saver tools I have for web development. This tool allow you to map a remote FTP drive to your local drive letter. This allows you to edit files live while online. No more download, modify, upload, view, etc..WebDrive integrates your web or FTP server into the Windows file system by mapping it to a drive letter. This enables you to connect to the server and perform familiar file operations like copy, move, and directory functions with the Windows explorer. Using simple drag and drop, you can transfer individual or multiple files - even entire directory structures. WebDrive offers FTP client functionality that's feature-rich and easy to use.

PuTTY
Site: http://www.chiark.greenend.org.uk/~sgtatham/putty/
Documentation: http://www.chiark.greenend.org.uk/~sgtatham/putty/docs.html
Download: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html (Newest Version)
PuTTY is a free implementation of Telnet and SSH for Win32 platforms, along with an xterm terminal emulator. It is written and maintained primarily by Simon Tatham.

Shell Utils
Download: shell_tools.zip
This is a collection of shell tools that allow you to type unix style commends on your win32 system. While it is allways recommended you use the build in functions of PHP, there are times when you need to make a shell call. These tools will allow the command to run and will preform the task correctly (if applicable), and if not (ex: chmod) will not return an error.

TortoiseCVS
Site: http://www.tortoisecvs.org/
Documentation: http://www.tortoisecvs.org/support.shtml
Download: http://www.tortoisecvs.org/download.shtml (Stable Version)
This software is ONLY valuable if you are developing using a CVS server.TortoiseCVS is an extension for Microsoft Windows Explorer that makes using CVS fun and easy. Features include: coloured icons, tight integration with SSH, and context-menu interactivity.

7-Zip
Site: http://www.7-zip.org/
Documentation: http://www.7-zip.org/support.html
Download: http://www.7-zip.org/download.html (7-Zip for Windows 98/ME/NT/2000/XP)
I do not use this program, I use WinZip but this is a free product so I am listing it.7-Zip is a file archiver with the highest compression ratio. The program supports 7z, ZIP, RAR, CAB, GZIP, BZIP2 and TAR formats. Compression ratio in the new 7z format is 30-50% better than ratio in ZIP format. 7-Zip has powerful command line version.

WinSCP
Site: http://winscp.sourceforge.net/eng/index.php
Documentation: http://winscp.sourceforge.net/eng/docs/
Download: http://winscp.sourceforge.net/eng/download.php (Latest Version)
This is a great and secure alternative to FTP. WinSCP is an open source SFTP client for Windows using SSH. Legacy SCP protocol is also supported. Its main function is the safe copying of files between a local and a remote computer. Beyond this basic function, WinSCP manages some other actions with files.

Install MySQL
Installing MySQL should be very quick and painless. The install program should take care of everything you need.

The MySQL database server is the world's most popular open source database. Its architecture makes it extremely fast and easy to customize. Extensive reuse of code within the software and a minimalistic approach to producing functionally-rich features has resulted in a database management system unmatched in speed, compactness, stability and ease of deployment. The unique separation of the core server from the storage engine makes it possible to run with strict transaction control or with ultra-fast transactionless disk access, whichever is most appropriate for the situation.

The MySQL database server is available without a license fee under the GNU General Public License (GPL). Commercial non GPL licenses are available for users who prefer not to be restricted by the terms of the GPL.

  1. Unzip the install file. EX: c:\disks\mysql\mysql-4.0.14b-win.zip
  2. Run setup.exe (leave destination c:\mysql, unless you want to move it.)
  3. Select Typical install, or custom if you wish to see / change options
  4. Let Install finish.
  5. Run c:\mysql\bin\winmysqladmin.exe, and set your username and password for this tool. This will start the mysql service.
  6. Reboot your computer
  7. Open 'Services' located in control panel Administrative Tools. You will should see mysql listed.
  8. Open a command prompt Start Programs Accessories Command Prompt
  9. Change Directory to the MySQL bin directory (c:\mysql\bin\)
  10. We are not going to change your root passwordType mysqladmin -uroot password ex: mysqladmin -uroot password secret.Make a note of this password. It will be your superuser root access password for MySQL.

You are all finished installing MySQL !!

Install PHP
We will now install and configure your PHP.

PHP is an HTML-embedded scripting language. Much of its syntax is borrowed from C, Java and Perl with a couple of unique PHP-specific features thrown in. The goal of the language is to allow web developers to write dynamically generated pages quickly.

PHP stands for PHP: Hypertext Preprocessor. This confuses many people because the first word of the acronym is the acronym. This type of acronym is called a recursive acronym.

  1. Unzip the install file. EX: c:\disks\php\php-4.3.2-Win32.zip
  2. Create the php directory c:\php
  3. Copy the contents of the zip file into c:\php, the php.exe program should be in c:\php\
  4. Copy the contents of the dll directory to your system32 directory (ex: c:\winnt\system32)
  5. Copy 'php4ts.dll' to your system32 directory (ex: c:\winnt\system32)
  6. Copy c:\php\php.ini-dist to c:\php\php.ini and open this file in a text editer.
  7. Locate the section for "Paths and Directories" and change the ;include_path = to 'include_path = ".;/php/pear"'
    This will set the path for PHP to look for files. First it will look in the current directory and this will also allow you to use PEAR tools.
  8. Locate the 'register_globals' variable and insure it is set to 'register_globals = On'. NOTE: For a production server it is safer to have this set to off, but for development I have found many times that other programmers do not code for this, so I must keep it on.
  9. Locate the 'extension_dir' variable and insure that it is set to 'extension_dir = C:/php/extensions/', this will allow PHP to find the extentions.
  10. Locate the 'SMTP' varable and modify this to your needs. This is the server that will send out emails in PHP. In most cases you can set this to you mail server for your web host, in other cases you may need to set this to the server of your ISP.
  11. Move c:\php\php.ini to your windows directory ex: c:\winnt

You are all finished installing PHP!!

Install Apache
We will now install and configure your Apache.

The Apache HTTP Server Project is an effort to develop and maintain an open-source HTTP server for modern operating systems including UNIX and Windows NT. The goal of this project is to provide a secure, efficient and extensible server that provides HTTP services in sync with the current HTTP standards.

Apache has been the most popular web server on the Internet since April of 1996. The July 2003 Netcraft Web Server Survey found that 63% of the web sites on the Internet are using Apache, thus making it more widely used than all other web servers combined.

  1. Run the install program located in your download directory (ex: c:\disks\apache\apache_1.3.28-win32-x86-no_src.msi)
  2. When prompted for 'Server Information' enter the name of the computer in the domain and server names. Enter your email address in the email address line.
    If you are unsure of your computer name you should find it in your 'Network Identification' tab of your system properties
  3. Select 'Complete' for the install type.
  4. You should now see Apache listed in your services.
  5. To test your install open a browser and enter the address 'http:///' and you will see a welcome page from apache. ex: (http://my-computer/)
  6. Create a working directory for web sites. If you work with only one server you can have this match the live server you use, or you can set your own. I use c:\www this way I can backup one directory and have all my working web sites. ex: (c:\www)
  7. Open the httpd.conf file in your apache install directory. (C:\Program Files\Apache Group\Apache\conf)
    This file control your web server and allows you to create web sites. We will simply update your working directory.
    Locate 'DocumentRoot' and update this to your web root directory we just created. ex:
    DocumentRoot "C:/www"
    Locate

    Directory "C:/Program Files/Apache Group/Apache/htdocs"

    and update this to match the same as above. ex:

    Directory "C:/www"

    Locate 'DirectoryIndex' and add 'index.php, index.php3' the end of the line. (ex: DirectoryIndex index.php, index.php3, index.html)
  8. At the very bottom of this file add the following lines.

    # Load PHP & USE vhost.conf for domains
    LoadModule php4_module "C:\php\sapi\php4apache.dll"
    AddModule mod_php4.c
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php .php3
    #include conf/vhost.conf

    This section will tell Apache to process all .php & .php3 files through PHP and in advanced features we can setup new domains on this web server. You can add different extensions for PHP if you wish, but for now this should work.
  9. From your 'Services' program restart Apache. NOTE: All changes to php.ini or httpd.conf REQUIRE your to restart apache for them to go into effect.
  10. Create a file named 'phpinfo.php' in your new web root (ex: c:\www) and add the following code to the file. This program will help you to text and find important information your server.


    Point your browser to http://your_server_name/phpinfo.php and you should see the phpinfo screen. This will tell you that you have apache working with PHP.

Congratulation you are all finished installing Apache!!

Install phpMyAdmin
Installing phpMyAdmin should be very simple and will test to insure PHP, MySQL, and Apache are all talking.

phpMyAdmin is a tool written in PHP intended to handle the administration of MySQL over the WWW. Currently it can create and drop databases, create/drop/alter tables, delete/edit/add fields, execute any SQL statement, manage keys on fields.

  1. Unzip the install file. EX: c:\disks\phpmyadmin\phpMyAdmin-2.5.3-rc2-php.zip
  2. Create a directory in your web root named 'phpMyAdmin'. I recommend keeping the same case as listed as modt live web servers do as well. (ex: c:\www\phpMyAdmin\).
  3. Copy the contents of the zip into this new folder.
  4. Edit the c:\www\phpMyAdmin\config.inc.php file and modify

    $cfg['Servers'][$i]['password']='';

    to

    $cfg['Servers'][$i]['password']='YOURPASSWORDHERE';

    This is the password your created when intalling MySQL.
  5. Point your browser to http:///phpMyAdmin/ (ex: http://my-computer/phpMyAdmin/)

You are all finished installing phpMyAdmin !!

Resource Links
These links have been invaluable resources and are my favorites.
*** HotScriptsHotScripts is one of the best resources for open source PHP code.
*** SourceForgeSourceForge is one of the best resources for all types of open source code.
*** PHP ClassesPHP Classes has a great resource of Open Source PHP classes.

Help & Tutorial Links

Developer ShedDevShed has a user run forum.

Copyright © 2003 Amalla International, All rights reserved.
http://www.amalla.com/

No comments: