Você está na página 1de 8

Installation guide for Apache webserver, MySQL, PHP 5, PHPMyAdmin en Ruby On Rails

by: Wietse Veenstra - http://www.wietseveenstra.nl/blog


last update: January 3rd, 2007

Contents:

1. Preparation/download files
2. Apache HTTPD Web Server 2.2.3
3. MySQL 5.0.27
4. PHP 5.2.0
5. PHPMyAdmin 2.9.1.1
6. Ruby On Rails 1.8.5-21
1. Preparation/download files

Create a new folder on your desktop and give it the name 'Server'. First we are going to download al the
essential files into this folder from the internet. Go to the links mentioned below and download the files to
the new folder:

Applications:
Apache HTTP Webserver (v2.2.3):
homepage: http://www.apache.org/
downloadpage: http://httpd.apache.org/download.cgi
filename: apache_2.2.3-win32-x86-no_ssl.msi [4,327kb]

MySQL (v5.0.27):
homepage: http://www.mysql.com/
downloadpage: http://dev.mysql.com/downloads/mysql/5.0.html
filename: Windows (x86) -> mysql-5.0.27-win32.zip [41,260kb]

PHP (v5.2.0):
homepage: http://www.php.net/
downloadpage: http://www.php.net/downloads.php
filename: php-5.2.0-Win32.zip [9,433kb]

PHPMyAdmin (v2.9.1.1):
homepage: http://www.phpmyadmin.net/
downloadpage: http://www.phpmyadmin.net/home_page/downloads.php
filename: phpMyAdmin-2.9.1.1-english.zip [1,167kb]

Ruby On Rails (v1.8.5-21):


homepage: http://www.rubyonrails.org/
downloadpage: http://rubyforge.org/frs/?group_id=167
filename: ruby185-21.exe [26,997kb]

Extra's:
Ruby On Rails - Apache configuration files:
downloadpage: http://www.apachelounge.com/download/
filename: mod_fcgid-2.0-w32.zip [22kb]

Visual C++ 2005 Redistributable Package:


downloadpage: www.microsoft.com/downloads/details.aspx?familyid=32BC1BEE-A3F9-4C13-9C99-
220B62A191EE&displaylang=en
filename: vcredist_x86.exe [2,624kb]

References:
PHP CHM guide:
downloadpage: http://www.php.net/download-docs.php
filename: php_manual_nl.chm [6,916kb]

MySQL CHM guide:


downloadpage: http://dev.mysql.com/get/Downloads/Manual/manual.chm/from/pick
filename: manual.chm [3,627kb]

Also create a folder where your projects will be saved, for example c:\webroot\.
Apache HTTP Web Server 2.2.3

WARNING FOR SKYPE USERS!: Skype needs to be shut down temporarily before installing Apache because it will
conflict with Apache during it’s installation. If Skype keeps running, the next error will occur during the installation of
Apache: “make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, Shutting down.". This will
result in a non-startable Apache after installation. After the installation of Apache, Skype can be run normally again.

First we are going to install Apache. To do this, you need to open the file named'apache_2.2.3-win32-x86-
no_ssl.msi' in the 'Server' folder. The installation of Apache is fairly simple. You can click on the 'next'
button until you will see this screen:

After inserting the correct data (this can be anything), you click ‘next’ again. Choose for the 'Typical' setup
type. The standard Destination Folder in program files is a good location to install so click the ‘next’ button
once again to start the installation. Your firewall possibly gives a security warning when Apache tries to
connect. Grant Apache access.

Click on the ‘finish’ button when the installation has finished. To test if the installation went correctly you can
open a browser window (e.g.: Internet Explorer, Firefox, Opera, etc). Typ 'http://localhost/' (without quotes)
in the address bar. With a successful installation you should see ‘It Works’ on your screen now.

The next thing you need to do is to make sure that Apache will know where you store your project files. To
achieve you have to make some adjustments in the Apache configuration file called ‘httpd.conf’ : go to Start
> Programs > Apache HTTP Server 2.2.3 > Configure Apache Server > ‘edit the Apache httpd.conf
configuration file’. Now the config file will be opened with Notepad. Find this line ‘DocumentRoot
“C:/Program Files/Apache Group/Apache2/htdocs”’ and change this into ‘DocumentRoot “C:/webroot”’
(notice the forward-slash instead of the backslash!). Also change this line ‘<Directory "C:/Program
Files/Apache Group/Apache2/htdocs">’ into ‘C:/webroot’. Finally you have to change this line
‘DirectoryIndex index.html’ into ‘DirectoryIndex index.html index.html.var index.php’.

The only thing that needs to be done before Apache is installed completely is a server restart. You do this by
going to Start > Programs > Apache HTTP Server 2.2.3 > Control Apache Server > and choosing ‘Restart’.
MySQL 5.0.27

Now it’s time to install MySQL. Unzip the file called ‘mysql-5.0.27-win32.zip’ into the ‘Server’ folder. The file
‘Setup.exe’ has appeared. Open this file. The installation will start and you will be shown a welcome screen.
Click ‘next’, choose the ‘typical’ installation method and click on the ‘next’ button again. Click ‘install’ to start
the installation.

After the installation you will see a screen where you can register or login on the MySQL.com website.
Choose ‘Skip Sign-Up’ and click ‘next’. After this the setup wizard is finished installing MySQL. Click ‘finish’.

Now you arrive at the Configuration Wizard. Click ‘next’ and choose the ‘Standard Configuration’, as this is a
new MySQL installation. Users who are upgrading a previous installation of MySQL have to choose the
‘Detailed Configuration’.

In the next screen you have to choose ‘Install As Windows Service’. Check the checkboxes ‘Launch the
MySQL Server automatically’ and ‘Include Bin Directory in Windows PATH’ (see screenshot below).

After clicking ‘next’ you will be asked to insert a ‘root password’ twice. Type your password twice and click
on ‘next’ again. Then click on ‘execute’ to start the configuration of MySQL and choose ‘finish’ after the
configuration to close the wizard.

To check if everything went as planned go to Start > MySQL > MySQL Server 5.0 > MySQL Command Line
Client. A DOS screen appears. Type your ‘root password’ and press the enter key. If the installation went as
planned, you will see this screen:
PHP 5.2.0

For the installation of PHP you need to unzip the file‘php-5.2.0-Win32.zip’ into the folder ‘C:\php’. Open this
folder and copy the file ‘php.ini.dist’. Paste the file directly into the same folder and rename it to ‘php.ini’.
Open the file with Notepad (or another text editor of your choice). Change the line‘short_open_tag = On’ to
‘short_open_tag = Off’. Also change the line‘error_reporting = E_ALL & ~E_NOTICE’ to ‘error_reporting =
E_ALL’. Then change the line‘extension_dir = "./"’ to‘extension_dir = "c:\php\ext\"’. After changing these
lines you have to find the ‘extensions’ part and delete the‘;’ before the lines‘extension=php_mbstring.dll’
and ‘extension=php_mysql.dll’. This will ensure that PHP recognizes MySQL.

Now you will have to add the following lines at the bottom of the ‘httpd.conf’ Apache configuration file:

httpd.conf
<Directory "c:/php/">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>

ScriptAlias /php/ “c:/php/”


AddType application/x-httpd-php .php
Action application/x-httpd-php “/php/php-cgi.exe”
SetEnv PHPRC “C:/php”

Finally you have to add PHP to the Windows startup configuration. This can be done by opening Start >
Configuration Screen > System. On this page, go to the ‘advanced’ tab. Click on the button called
‘Environment variables’ and select the variable ‘Path’ under ‘System variables’. Choose ‘edit’ and insert
‘;C:\php’ (without quotes) at the end of this line. Click ‘ok’ and choose ‘New’. The name of the new variable
is ‘PHPRC’ and the value ‘C:\php’. Now click ‘ok’ until all screens are closed. You need to restart your
computer now.

In order to test whether the installation of PHP went successfully, you have to create the next file in the
webroot folder you created earlier with the following content:

phpinfo.php
<?php
phpinfo();
?>
When you browse to ‘localhost’ in your favorite browser and open the file you just created, you will see a
screen as shown below:

HINT: Print the information on this page (multiple pages). When you run into an error when you are working on your
PHP files you can use this as a reference to check the configuration of your PHP-installation.

It is advisable to delete this file after testing because it contains useful information about your configuration
for hackers.
PHPMyAdmin 2.9.1.1

The next victim is PHPMyAdmin. Unzip the ‘phpMyAdmin-2.9.1.1-english.zip’ file into your webroot folder.
Browse to your webroot folder and rename the folder‘phpMyAdmin-2.9.1.1-english’ to ‘phpMyAdmin-
2.9.1.1’. Now open this folder and copy the file ‘config.sample.inc.php’ . Directly paste the file back into the
folder and rename it to ‘config.inc.php’. Open this file and change the line ‘$cfg['Servers'][$i]['auth_type'] =
'cookie';’ to ‘$cfg['Servers'][$i]['auth_type'] = 'config';’.

Now delete the following lines:

config.inc.php
$cfg['Servers'][$i]['controluser'] = 'pmausr';
$cfg['Servers'][$i]['controlpass'] = 'pmapass';

Finally add these lines under the ‘$i++;’ part:

config.inc.php
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'typ hier uw wachtwoord voor mysql';

Save the file. You are now ready to use PHPMyAdmin via your localhost.
Ruby On Rails 1.8.5-21

The installation of Ruby On Rails is the easiest one during this guide. Open the file ‘ruby185-21.exe’ which
is located in the ‘server’ folder. And now you can keep clicking on the ‘next’ button until the installation is
finished.

Now it’s time to put Ruby on it’s Rails. To do this you need to open a command screen via Start > Run and
type ‘cmd’ (without quotes). In the command window, run the next line:

gem install rails --remote --include-dependencies

After a while the installation of Ruby On Rails is finished.

At this time it’s still needed to start the WEBrick server of Ruby On Rails manually before you can test your
Ruby projects. Next we are going to install a plugin for Apache to resolve this. Apache will then open all your
Ruby projects automatically.

Unzip the ‘mod_fcgid-2.0-w32.zip’ into the server folder. There will be 3 new files in this folder now. First,
copy the ‘mod_fcgid.so’ to the ‘C:\Program Files\Apache Software Foundation\Apache2.2\modules’ folder.
Next copy the second file, named ‘httpd.exe.manifest’ into the‘C:\Program Files\Apache Software
Foundation\Apache2.2\bin’ folder. Now run the ‘vcredist_x86.exe’ from your server folder to install the
Microsoft Visual C++ plugin as this is needed. Finally add the line ‘LoadModule fcgid_module
modules/mod_fcgid.so’ to your Apache configuration file ‘httpd.conf’.

Restart your Apache server and you are ready to start working on your projects!

Você também pode gostar