Terry.Li-彬

虚其心,可解天下之问;专其心,可治天下之学;静其心,可悟天下之理;恒其心,可成天下之业。

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  143 随笔 :: 344 文章 :: 130 评论 :: 0 Trackbacks

Index :

The Pre-Requisites :

  1. Apache HTTP Server (2.2.11)
    The best open source webserver. You need this to turn your humble computer to a powerful webserver to execute your applications.
    Download Apache 2.2.11 (with no mod ssl) (20916)
  2. PHP 5.3  – Download PHP 5.3.0 (VC6 Thread safe) (19493)
  3. MySQL 5.1.36   Goto Download page
  4. PHPMyAdmin 3.2.0.1
    PHPMyAdmin Download Page  | Direct Download PHPMyAdmin 3.2.0.1 (4702)

The above downloads are compatible with Windows 7/Vista/Vista SP1 (32 bit OS).
Before starting this tutorial. Please Turn off UAC (User Access Control) in Vista. Trust me you will get fed up on how many times it`ll popup while installing this environment.

Step 1 : Install Apache

  1. First create a New Folder in C:\ and name it as server.
  2. Start the installation, and follow the onscreen instructions as shown in the screencast.
    The settings for Server Information are given below.
    Apache 2.2.11 Settings

    Apache 2.2.11 Settings

  3. Choose Custom Installation and specify the install path as C:\server\apache\
  4. Once Installation is complete, verify the installation by clicking on the Apache Icon in the taskbar, as shown in the screencast. You can also verify your installation of Apache by opening http://localhost/ in your browser.
  5. Congratulations for a successful installation of Apache. We still have to configure Apache, we will do it in the coming steps.

STEP 2 : Install & Configure PHP 5.3

  1. Extract PHP package

    Now to install PHP5. Open the zip file & Extract all your files to C:\server\php. Navigate to C:\server\php

  2. Rename php.ini- file

    Search for the file, php.ini-development and rename it to php.ini

    EDIT php.ini

    Open up php.ini using any text-editor. (Notepad, Wordpad, Preferrably Dreamweaver). There are 2 edits in this file

  3. Edit 1

    Find extension_dir = "./" and replace it with (Please note the slashes)
    extension_dir = "C:/server/php/ext"

    Edit 2

    Now in the following edit, you just have to uncomment (by removing the “; – semicolon”) from the extension to activate it. So here are the extensions to be uncommented. Search for each one them and remove the semicolon ;

    ;extension=php_gd2.dll

    ;extension=php_mbstring.dll

    ;extension=php_mysql.dll

    ;extension=php_mysqli.dll

    The First extension enables the Image GD library of PHP.
    The Second enables mbstring.
    The Third and forth enables us to use MySQL database.

    Save the php.ini file.

  4. Adding PHP Environmental Variables in the System path

    Great ! Now we have to add tell the computer to start php everytime the computer reboots. So, Navigate to your Start->Control Panel->System->Advanced System Settings then go to the advanced tab, Click on the Environmental Variablesbutton, then scroll down in system variables to find PATH, Edit it Add the following Code to it, as shown below in the image, C:\server\php;

    PHP Environmental Variables

    PHP Environmental Variables

  5. You MUST MUST MUST reboot a windows box after setting the Path variable (step 2). If you move on past that point without rebooting – logging off is NOT enough – apache will have trouble finding your mySQL extensions.
  6. Finally, Step 2 is over !. Now we have PHP configured. Lets move on to configuring Apache.

STEP 3 : Configure Apache 2.2.11

  1. Now navigate to C:\server\Apache\conf

    Edit httpd.conf

    Some users had reported that they weren`t able to edit httpd.conf in VISTA using Notepad. Try using Dreamweaver or any other editor to edit the *.conf files. If you are still not able to open httpd.conf file in any text editor, you can try the following solutions

    1. Try different text editor
    2. Stop Apache server from the taskbar and then try to edit
    3. You should have administrative previliges. Try disabling UAC
    4. If none of the above work. Reboot your computer in safe mode and then try to edit httpd.conf

    The above is applicable for all *.conf files

    Okay, brace yourself, we got 5 Edits in this file. No big deal, pretty simple search and replace text.

    Edit 1

    Search for
    #LoadModule rewrite_module modules/mod_rewrite.so
    Replace with
    LoadModule rewrite_module modules/mod_rewrite.so

    Edit 2

    Add the following below the previous edit

    #PHP5
    LoadModule php5_module "C:/server/php/php5apache2_2.dll"
    PHPIniDir "C:/server/php"

    Edit 3

    Search
    AddType application/x-gzip .gz .tgz
    Add the following below the searched line

    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps

    Edit 4

    Search for
    DirectoryIndex index.html
    Replace with
    DirectoryIndex index.html index.php

    Edit 5

    Search for
    #Include conf/extra/httpd-vhosts.conf
    Replace withinclude conf/extra/httpd-vhosts.conf

  2. Now navigate to C:\server\Apache\conf\extra

    Edit httpd-vhosts.conf

  3. Replace  all the text inside with
    01.<virtualhost *:80>
    02.DocumentRoot "C:/Server/www/myserver.dev/public_html"
    03.ServerName myserver.dev
    04.ServerAlias www.myserver.dev
    05.<directory "C:/Server/www/myserver.dev/public_html">
    06.AllowOverride All
    07.Options Indexes FollowSymLinks
    08.Order allow,deny
    09.Allow from all
    10.</directory>
    11.</virtualhost>
  4. Restart the Apache Webserver

    If you have followed perfectly you`ll see that Apache has restarted perfectly.

Step 4 : Testing our Apache + PHP

  1. Create Directories to store your web files

    1. Firstly lets make the required Directories. Create a New Folder insideC:\server.
    2. Inside the C:\server folder, create folder called www
    3. inside C:\server\www\ create myserver.dev
    4. and then finally create public_html folder inside yourC:\server\www\myserver.dev\

    Follow this structure C:\server\www\myserver.dev\public_html\
    This is where you will be putting all your html,script etc files to be accessed by your webserver.

  2. Create index.php

    Open up notepad, type in the following code and save the file as index.php insideC\:server\www\myserver.dev\public_html\ as shown in the above picture.

    1. <?php
    2. //index.php
    3. phpinfo();
    4. ?>

    Please note the file name, it is index.php. Many a times, Notepad saves it asindex.php.txt, while saving, don`t forget to mention the type as All Files, this way Notepad will save it as index.php.

STEP 5 : Installing and Configuring MySQL5

  1. Lets start by unpacking the zip & start the installation. Select Typical, click Next

    MySQL 1

  2. Click Next after reviewing where you are installing

    MySQL 2

  3. Skip the Sign-up.

    MySQL 3

  4. Install SQL, Now time to configure SQL. Its pretty simple, if you follow the onscreen instructions.

    MySQL

  5. Now just follow the following images.

    Instance Wizard Start

    Instance Wizard Start

    Detailed Configuration

    Detailed Configuration

    Developer Machine

    Developer Machine

    Multifunctional Database

    Multifunctional Database

    InnoDB

    InnoDB

    DSS

    DSS

    Enable TCP/IP Working and PORT no

    Enable TCP/IP Working and PORT no

    Standard Char Set

    Standard Char Set

    MySQL As Windows Service

    MySQL As Windows Service

    User Name and Password = root

    User Name and Password = root

    Execute

    Execute

  6. Finally click on Execute and let mysql configure everything.

    During the MySQL installation and configuration,if you have missed any step or have not configured properly, then you can run the MySQL Server Instance Config Wizard which can be accessed via ‘Start->All Programs->MySQL’.
    *If MySQL Instance Wizard does not complete the final step, reboot your computer and configure again.*

  7. Test MySQL along with Apache+PHP

    Now to test whether MYSQL & PHP along with APACHE are working fine, restart the webserver, i.e click on the apache icon in your taskbar (near time in the taskbar/startbar) and restart the webservice.

    After it has restarted (green play icon will be displayed), point your favourite web browser to http://localhost.

    PHP 5.3.0....nice

    PHP 5.3.0....nice

    If you are able to see the above page, then you have successfully configured Apache+PHP5. To verify whether MySQL5 has been installed, scroll down the page until you come across mysql & mysqli heading as shown below.

    mysql and mysqli are extensions for MySQL

    mysql and mysqli are extensions for MySQL

  8. Woohoo ! Congratulations ! You have successfully installed Apache2.2.11+PHP5.2.9+MySQL5.1.34 on your system. *sigh*

STEP 6 : Installing and Configuring PhpMyAdmin 3

  1. Extract the PhpMyAdmin 3 package

    This is an optional ! You can use your webserver without it as well.
    Extract all the files inside the phpMyAdmin-3.2.0.1-all-languages.zip to aC:\phpmyadmin. Now navigate inside C:\phpmyadmin you`ll see another folder namedphpMyAdmin-3.2.0.1-all-languages (even if the name is something else), rename this folder to pma. Cut this renamed pma folder and paste it insideC:\server\www\myserver.dev\public_html

  2. Now If you have followed everything properly, when you point your web browser tohttp://www.myserver.dev/pma/index.php you will see a login screen or the following screen.
    If you get the login screen, the username | password is root | root.

STEP 7 : Making Windows recognize myserver.devOptional

Editing hosts file

Navigate to C:\Windows\System32\drivers\etc
Open up hosts in notepad/wordpad/dreamweaver any text editor and add the following

1. 127.0.0.1   myserver.dev
2. 127.0.0.1   www.myserver.dev

Conclusion

Thank you for reading this tutorial, hope you guys enjoyed :)
There is a screencast based on this tutorial, so do check it out Screencast #1 : Installing Apache 2.2, PHP 5.3, MySQL 5.1 & PHPMyAdmin 3.2 for Windows 7/Vista

If you are having any trouble, feel free to post a comment.

posted on 2011-06-02 11:17 礼物 阅读(620) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。

网站导航: