WAMP Server Install: Difference between revisions
m (Added WIMP link) |
m (Formatting and Meta) |
||
Line 1: | Line 1: | ||
'''Windows, Apache, MySQL and PHP ([http://www.wikipedia.org/wiki/WAMP WAMP]) install guide for a Windows 2008 64bit server.''' | '''Windows, Apache, MySQL and PHP ([http://www.wikipedia.org/wiki/WAMP WAMP]) install guide for a Windows 2008 64bit server.''' | ||
For Windows, IIS, MySQL and PHP (WIMP) see http://blogs.iis.net/bills/archive/2006/09/19/How-to-install-PHP-on-IIS7-_2800_RC1_2900_.aspx | For Windows, IIS, MySQL and PHP (WIMP) see http://blogs.iis.net/bills/archive/2006/09/19/How-to-install-PHP-on-IIS7-_2800_RC1_2900_.aspx | ||
Line 8: | Line 9: | ||
There are numerous [http://en.wikipedia.org/wiki/Comparison_of_WAMPs install bundles] that can supposedly do the job for you, they're always a little out of date, and [http://www.php.net/manual/en/install.windows.php none are endorsed by PHP]. I'm not saying don't consider them, but just do it in a well thought out way. | There are numerous [http://en.wikipedia.org/wiki/Comparison_of_WAMPs install bundles] that can supposedly do the job for you, they're always a little out of date, and [http://www.php.net/manual/en/install.windows.php none are endorsed by PHP]. I'm not saying don't consider them, but just do it in a well thought out way. | ||
= Downloads = | == Downloads == | ||
The following are required to complete an installation. | The following are required to complete an installation. | ||
== Apache == | === Apache === | ||
Don't download Apache from apache.org, these have not been compiled with the latest Microsoft Visual Studio compiler (VC10), and so do not have the improvements in stability and performance that that provide, and more importantly, are not compatible with the latest VC9 compiled PHP binaries (so will restrict you to older versions). | Don't download Apache from apache.org, these have not been compiled with the latest Microsoft Visual Studio compiler (VC10), and so do not have the improvements in stability and performance that that provide, and more importantly, are not compatible with the latest VC9 compiled PHP binaries (so will restrict you to older versions). | ||
Line 24: | Line 25: | ||
** Rename <code> vcredist_x86.exe </code> to <code> vcredist_x86-2010.exe </code> | ** Rename <code> vcredist_x86.exe </code> to <code> vcredist_x86-2010.exe </code> | ||
== PHP == | === PHP === | ||
Download the latest thread-safe ZIP package from http://windows.php.net/download/ | Download the latest thread-safe ZIP package from http://windows.php.net/download/ | ||
* '''PHP VC9 x86 Thread Safe''' | * '''PHP VC9 x86 Thread Safe''' | ||
Line 33: | Line 34: | ||
** Rename <code> vcredist_x86.exe </code> to <code> vcredist_x86-2008.exe </code> | ** Rename <code> vcredist_x86.exe </code> to <code> vcredist_x86-2008.exe </code> | ||
== MySQL == | === MySQL === | ||
Download the compete package from http://www.mysql.com/downloads/installer/ | Download the compete package from http://www.mysql.com/downloads/installer/ | ||
* '''MySQL Installer''' | * '''MySQL Installer''' | ||
Line 41: | Line 42: | ||
Prerequisites which also need to be downloaded... | Prerequisites which also need to be downloaded... | ||
* '''.NET Framework v4.0''', from http://go.microsoft.com/fwlink?LinkId=181012 (ignore any additional guff that Microsoft suggest you | * '''.NET Framework v4.0''', from http://go.microsoft.com/fwlink?LinkId=181012 (ignore any additional guff that Microsoft suggest you download). | ||
** EG <code> dotNetFx40_Client_setup.exe </code> | ** EG <code> dotNetFx40_Client_setup.exe </code> | ||
** Note that this is just a downloader, it doesn't actually include .NET, if the machine you are installing to doesn't have internet access, download from here http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=24872 instead, EG <code> dotNetFx40_Client_x86_x64.exe </code> | ** Note that this is just a downloader, it doesn't actually include .NET, if the machine you are installing to doesn't have internet access, download from here http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=24872 instead, EG <code> dotNetFx40_Client_x86_x64.exe </code> | ||
= Installation = | == Installation == | ||
If installing on a Virtual Machine, take a Snapshot 1st, and maybe even at regular intervals once you're happy each component is properly installed. | If installing on a Virtual Machine, take a Snapshot 1st, and maybe even at regular intervals once you're happy each component is properly installed. | ||
This procedure assumes you already have a fully working Windows 2008 server, and will install software files to the C:\ drive, with data and website files being located on D:\. | This procedure assumes you already have a fully working Windows 2008 server, and will install software files to the C:\ drive, with data and website files being located on D:\. | ||
== Pre-Requisite Components == | === Pre-Requisite Components === | ||
# Install Microsoft Visual C++ Redistributable Packages | # Install Microsoft Visual C++ Redistributable Packages | ||
#* <code> vcredist_x86-2008.exe </code> | #* <code> vcredist_x86-2008.exe </code> | ||
Line 59: | Line 60: | ||
# Perform a Windows Update to ensure all components are up to date | # Perform a Windows Update to ensure all components are up to date | ||
== MySQL == | === MySQL === | ||
* <code> mysql-installer-5.5.23.0.msi </code> | * <code> mysql-installer-5.5.23.0.msi </code> | ||
# Select '''Install MySQL Products''' and click '''Next''' | # Select '''Install MySQL Products''' and click '''Next''' | ||
Line 88: | Line 89: | ||
## Assuming the service starts, delete <code>C:\ProgramData\MySQL\MySQL Server 5.5\data-old\</code> | ## Assuming the service starts, delete <code>C:\ProgramData\MySQL\MySQL Server 5.5\data-old\</code> | ||
== Apache == | === Apache === | ||
* <code> httpd-2.4.2-win32.zip </code> | * <code> httpd-2.4.2-win32.zip </code> | ||
# Uncompress the file, and move the <code>Apache24</code> folder to <code>C:\Program Files (x86)\</code> | # Uncompress the file, and move the <code>Apache24</code> folder to <code>C:\Program Files (x86)\</code> | ||
Line 104: | Line 105: | ||
# You should now be able to browse to the server (http://yourserver), and get a basic "It works!" page back, in case of errors, double check your config file, and check the Windows Application log | # You should now be able to browse to the server (http://yourserver), and get a basic "It works!" page back, in case of errors, double check your config file, and check the Windows Application log | ||
== PHP == | === PHP === | ||
* <code> php-5.4.0-Win32-VC9-x86.zip </code> | * <code> php-5.4.0-Win32-VC9-x86.zip </code> | ||
# Uncompress the file, move the resultant folder to <code> C:\Program Files (x86)\ </code>, and rename to <code>PHP</code> | # Uncompress the file, move the resultant folder to <code> C:\Program Files (x86)\ </code>, and rename to <code>PHP</code> | ||
Line 119: | Line 120: | ||
# Restart the Apache, in case of errors, double check your config file, and check the Windows Application log | # Restart the Apache, in case of errors, double check your config file, and check the Windows Application log | ||
= Testing and Troubleshooting = | == Testing and Troubleshooting == | ||
In order to test your install, you need 3 files in your <code>D:\Apache\htdocs</code> folder | In order to test your install, you need 3 files in your <code>D:\Apache\htdocs</code> folder | ||
* '''<code>index.html</code>''' | * '''<code>index.html</code>''' |
Revision as of 15:35, 16 May 2012
Windows, Apache, MySQL and PHP (WAMP) install guide for a Windows 2008 64bit server.
For Windows, IIS, MySQL and PHP (WIMP) see http://blogs.iis.net/bills/archive/2006/09/19/How-to-install-PHP-on-IIS7-_2800_RC1_2900_.aspx
Whilst this guide intends to be as generic as possible, it is disingenuous to suggest that you can blindly follow the procedures below, for different versions of the software components than were used here, and expect it all to work. I have included the install package filenames that I used, which normally exactly identifies the variant and version I've used (Microsoft supplied packages are the exception, as they like to keep to guessing).
Installing LAMP takes seconds (well minutes), installing WAMP constantly reminds you that you're trying to fit a round peg into a square hole, and that it would probably be quicker and easier to learn Linux (its what made me first tinker with Ubuntu).
There are numerous install bundles that can supposedly do the job for you, they're always a little out of date, and none are endorsed by PHP. I'm not saying don't consider them, but just do it in a well thought out way.
Downloads
The following are required to complete an installation.
Apache
Don't download Apache from apache.org, these have not been compiled with the latest Microsoft Visual Studio compiler (VC10), and so do not have the improvements in stability and performance that that provide, and more importantly, are not compatible with the latest VC9 compiled PHP binaries (so will restrict you to older versions).
Download the latest required installers from http://www.apachelounge.com/download/
- Apache 2.4 Win32 binary
- EG
httpd-2.4.2-win32.zip
- EG
- PHP Handler (needs to be the right version for version of PHP)
- EG
php5apache2_4.dll-php-5.4-win32.zip
- EG
Prerequisites which also need to be downloaded...
- Microsoft Visual C++ 2010 SP1 Redistributable Package (x86) (VC10), from http://www.microsoft.com/download/en/details.aspx?id=8328
- Rename
vcredist_x86.exe
tovcredist_x86-2010.exe
- Rename
PHP
Download the latest thread-safe ZIP package from http://windows.php.net/download/
- PHP VC9 x86 Thread Safe
- EG
php-5.4.0-Win32-VC9-x86.zip
- EG
Prerequisites which also need to be downloaded...
- Microsoft Visual C++ 2008 SP1 Redistributable Package (x86) (VC9), from http://www.microsoft.com/download/en/details.aspx?id=8328
- Rename
vcredist_x86.exe
tovcredist_x86-2008.exe
- Rename
MySQL
Download the compete package from http://www.mysql.com/downloads/installer/
- MySQL Installer
- EG
mysql-installer-5.5.23.0.msi
- EG
Note that whilst the page states its a 32bit package, on installing the core MySQL Server will be 64bit.
Prerequisites which also need to be downloaded...
- .NET Framework v4.0, from http://go.microsoft.com/fwlink?LinkId=181012 (ignore any additional guff that Microsoft suggest you download).
- EG
dotNetFx40_Client_setup.exe
- Note that this is just a downloader, it doesn't actually include .NET, if the machine you are installing to doesn't have internet access, download from here http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=24872 instead, EG
dotNetFx40_Client_x86_x64.exe
- EG
Installation
If installing on a Virtual Machine, take a Snapshot 1st, and maybe even at regular intervals once you're happy each component is properly installed.
This procedure assumes you already have a fully working Windows 2008 server, and will install software files to the C:\ drive, with data and website files being located on D:\.
Pre-Requisite Components
- Install Microsoft Visual C++ Redistributable Packages
vcredist_x86-2008.exe
vcredist_x86-2010.exe
- Install Microsoft .NET Framework 4.0
- Either
dotNetFx40_Client_setup.exe
(donwloader) - Or
dotNetFx40_Client_x86_x64.exe
(full-fat installer)
- Either
- Perform a Windows Update to ensure all components are up to date
MySQL
mysql-installer-5.5.23.0.msi
- Select Install MySQL Products and click Next
- Accept the GPL and click Next
- Check for newer updates (if you have internet access)
- Select the Custom setup type, and click Next
- Tick MySQL Server to install the core database components
- Tick 'MySQL Workbench to install the GUI admin console (optional, can be installed on local desktop instead, if at all)
- Tick MySQL Connectors / Connector/NET to install the .NET connector (required for PowerShell support, PHP installs its own connector)
- Confirm pre-requisites are met and click Next
- Click Next for installation to complete
- Click Next to proceed with MySQL Server configuration to take place
- Select Server Machine
- Enable TCP/IP networking only if remote database connections are required (a remote MySQL Workbench session requires this)
- Leave Create Windows Service checked
- Enter a good root password
- Click Next and Finish to exit installer
- Move databases to seperate drive (optional)
- Create new folder
- EG
D:\MySQL\data
- EG
- Stop the database service, MySQL55
- Edit the config file
C:\ProgramData\MySQL\MySQL Server 5.5\my.ini
- Change the
datadir
parameter appropriately- EG
datadir="D:\MySQL\data\"
- EG
- Copy the contents of
C:\ProgramData\MySQL\MySQL Server 5.5\data\
accross toD:\MySQL\data\
- Rename
C:\ProgramData\MySQL\MySQL Server 5.5\data\
toC:\ProgramData\MySQL\MySQL Server 5.5\data-old\
- Start the database service
- Assuming the service starts, delete
C:\ProgramData\MySQL\MySQL Server 5.5\data-old\
- Create new folder
Apache
httpd-2.4.2-win32.zip
- Uncompress the file, and move the
Apache24
folder toC:\Program Files (x86)\
- Create a folder for your web root, and copy across the
C:\Program Files (x86)\Apache24\htdocs\index.html
fileD:\Apache\htdocs
- Edit the
C:\Program Files (x86)\Apache24\conf\http.conf
and change- NOTE: Apache paths must use
/
as folder seperators, not\
!! ServerRoot "C:/Program Files (x86)/Apache24"
ServerAdmin admin@domain.com
(to something appropriate for your environment)DocumentRoot "D:/Apache/htdocs"
<Directory "D:/Apache/htdocs">
(should matchDocumentRoot
directive)
- NOTE: Apache paths must use
- Install as a service, from a command prompt...
cd "c:\Program Files (x86)\Apache24\bin"
httpd.exe -k install
- You should now be able to browse to the server (http://yourserver), and get a basic "It works!" page back, in case of errors, double check your config file, and check the Windows Application log
PHP
php-5.4.0-Win32-VC9-x86.zip
- Uncompress the file, move the resultant folder to
C:\Program Files (x86)\
, and rename toPHP
- Extract the
php5apache2_4.dll
file fromphp5apache2_4.dll-php-5.4-win32.zip
and move toC:\Program Files (x86)\PHP\
- Rename
C:\Program Files (x86)\PHP\php.ini-production
toC:\Program Files (x86)\PHP\php.ini
- Update the PHP config (
C:\Program Files (x86)\PHP\php.ini
)extension_dir = "C:\Program Files (x86)\PHP\ext"
date.timezone = Europe/London
- use the appropriate location from http://php.net/date.timezone
- Update the Apache config (
C:\Program Files (x86)\Apache24\conf\http.conf
), add the following# PHP Handler
LoadModule php5_module "C:/Program Files (x86)/PHP/php5apache2_4.dll"
AddHandler application/x-httpd-php .php
PHPIniDir "C:/Program Files (x86)/PHP"
- Restart the Apache, in case of errors, double check your config file, and check the Windows Application log
Testing and Troubleshooting
In order to test your install, you need 3 files in your D:\Apache\htdocs
folder
index.html
- Comes with Apache, copy across from
C:/Program Files (x86)/Apache24/htdocs
if it doesn't exist
- Comes with Apache, copy across from
phpinfo.php
- Create the file, with the following single line contents:
<?php phpinfo(); ?>
- Create the file, with the following single line contents:
mysqltest.php
- Create the file with contents as per PHP MySQL Test Script
In each of the following tests there are really only two places to look for errors if they don't appear in the browser window...
- Apache log -
C:\Program Files (x86)\Apache24\logs\error.log
- Windows System and Application Event Logs - Found in Server Manager | Diagnostics
- Browse to http://yourserver
- You should get a basic It Works! page, this will confirm that Apache is installed and working
- If not, check that the Apache service is started, and for any errors in the Windows System and Application event logs
- Browse to http://yourserver/phpinfo.php
- You should get a page detailing the PHP install
- Check that that there is a section for
mysql
(notmysqlnd
), which confirms that the MySQL module is being loaded. If not, in a Command prompt, cd to"C:\Program Files (x86)\PHP"
and runphp -m
which will confirm which modules are being loaded, and hopefully an error as to whymysql
isn't.
- Check that that there is a section for
- If not, check the Apache error log
- You should get a page detailing the PHP install
- Browse to http://yourserver/mysqltest.php and enter the password for your MySQL root account
- You should get a page listing the default databases
- If not, check the MySQL service is started (if not check the Windows System Event Logs)