Introduction
Are you tired of installers? Do you think you are badass enough to install a WAMP server manually? THEN THIS TUTORIAL IS FOR YOU!
MySQL Installation
Downloading
Download the latest win32-zip file here.
Extract the ZIP content into c:\webserv\mysql
Configuration
Copy my-medium.ini
as my.ini
in the MySQL folder.
Setting up a password for root
My attempt to define a password through my.ini was unsuccessful because mysqld --install --defaults-file=c:\webserv\mysql\my.ini
didn’t work. (Ref 1, Ref 2)
If you want to set a password for root, you need to install MySQL Workbench and create a new server instance from Server Administration and set the password for root from there (after installing the service).
Installing the MySQL service
Open command prompt cmd.exe
with administrator rights (otherwise you will get “access denied” error) and install the service (Ref):
mysqld --install
net start mysql
To remove the service:
net stop mysql
mysqld --remove
Optional stuff
PHP Installation
Downloading
You need to download “VC9 x86 Thread Safe” version of PHP because Apache is threaded.
Exctract the content into c:\webserv\php
Configuration
Copy php-development.ini
as php.ini
in the PHP folder.
Open up php.ini
, find and replace these:
include_path = ".;C:\webserv\php\pear\;c:\webserv\php\includes"
date.timezone = "Europe/Istanbul"
(List of supported timezones)session.save_path = "C:\webserv\tmp"
(Don’t forget create the foldertmp
inc:\webserv
)display_errors = On
extension_dir = "ext"
Go to the extension section and uncomment these lines (this is required for connecting to the MySQL server):
extension=php_mysql.dll
extension=php_mysqli.dll
Extras (you should enable these too):
extension=php_gd2.dll
extension=php_curl.dll
extension=php_mbstring.dll
Apache (httpd) Installation
Downloading
We have to download from this site because Apache doesn’t give out binary-zip versions.
Download the one similar to httpd-2.4.x-win32.zip
and put it into c:\webserv\apache
.
Configuration
Open up c:\webserv\apache\conf\httpd.conf
and follow the instructions below:
(If you can’t find the given setting in the file, put it at the end of the file.)
Renaming paths and PHP settings are mandatory.
The PHP ZIP file you download may not have the required Apache module for your PHP version, that's why you need to download the Apache PHP module for your version
For example if your Apache version is 2.4 and PHP version is 5.4.9: You need to download this file: php5apache2_4.dll-php-5.4-win32.zip
. Open the ZIP file, select the folder with your PHP version in it and put the DLL under c:\webserv\php
Rename folder paths
Replace every c:/Apache24
with c:/webserv/apache
.
/
, not backslash \
!And no trailing slashes!
PHP settings
Add this line to the end of the LoadModule section.
LoadModule php5_module C:/webserv/php/php5apache2_4.dll
If you download httpd version 2.4, you need to use php5apache2_4.dll
.
Add these directives to the end of the file: (1st statement manages .php files so that they will run through PHP. 2nd statement defines the path of php.ini
.)
AddHandler application/x-httpd-php .php
PHPIniDir "C:/webserv/php"
Enable .htaccess
If you want your .htaccess to work, find this line:
<Directory "c:/webserv/www">
Go few lines below and find this line:
AllowOverride None
Replace None
with All
(optional) ServerName
Uncomment ServerName and put your own website’s adresss (e.g. ServerName example.com
) or you will get a warning every time you restart httpd.
Change example.com
with localhost
if you are working locally.
(optional) Modules that should be activated
Find this line and uncomment it.
#LoadModule rewrite_module modules/mod_rewrite.so
(optional) GZip’ping pages, scripts and stylesheets
<FilesMatch "\.(html|php|css|js)$">
SetOutputFilter DEFLATE
</FilesMatch>
(optional) Cache for images
<FilesMatch "\.(gif|jpe?g|png)$">
Header set Cache-Control public
ExpiresActive On
ExpiresDefault "access plus 3 months"
</FilesMatch>
(optional) Make everybody except localhost download files with 25kB/s
Download the latest DLL file and put the DLL file in c:\webserv\apache\modules
.
Add this at the end of the LoadModule section:
LoadModule bw_module modules/mod_bw.dll
Add these lines at the end of the file:
BandWidthModule On
ForceBandWidthModule On
BandWidth localhost 0
BandWidth 192.168.1.33 0
BandWidth all 25600
Installing the service
Install and start the Apache service with the commands below: (Ref)
httpd -k install
httpd -k start
PhpMyAdmin Installation
Downloading PMA
Download the latest ZIP and put the contents into c:\webserv\phpmyadmin
Configuring
Copy config.sample.inc.php
as config.inc.php
and open it.
Change the blowfish secret:
$cfg['blowfish_secret'] = 'your_secret';
Even if you don’t have a password for root, PMA still doesn’t let you log in. If you want login without a password, change false
to true
:
$cfg['Servers'][$i]['AllowNoPassword'] = false;
Configuring for Apache
Go to c:\webserv\apache\conf
and create a file named phpmyadmin.conf
. Copy the code below to the file and save it:
Alias /phpmyadmin C:/webserv/phpmyadmin
<Directory C:/webserv/phpmyadmin>
Options Indexes FollowSymLinks
DirectoryIndex index.php
<IfModule mod_php5.c>
AddType application/x-httpd-php .php
php_flag magic_quotes_gpc Off
php_flag track_vars On
php_flag register_globals Off
php_value include_path .
</IfModule>
Require local
</Directory>
and add this line to httpd.conf
:
Include conf/phpmyadmin.conf
Restart Apache server with httpd -k restart
aaaaaaand done! Now you can visit http://localhost/phpmyadmin
and enjoy your freshly installed PMA!
My tutorial is over! Thanks for reading it and good job if you got no errors!
If you have any questions please comment below or contact me on Twitter or Github. Have a nice day :)
Other stuff
MySQL client
System settings
To be able to type commands like these httpd -k start
or mysql --install
you need to add these paths to the system variable PATH
.
c:\webserv\mysql\bin
c:\webserv\php
c:\webserv\apache\bin
Comments
Show comments this time only or Show comments for next 7 days