Install WAMP (Apache, MySQL, and PHP) in Windows.

Source: Internet
Author: User
Tags php error php file upload
Document directory
  • Preparations before installation

LAMP (Linux + Apache + MySQL + PHP) architecture is currently the world's most popular environment for small and medium-sized website services. Its ease of use and security have been recognized by the majority of users. Many users of Windows operating systems want Web developers who want to use the "AMP" server environment. This article describes how to install Apache, MySQL, and PHP server environments in Windows.

 

I have adopted the Windows 7 Ultimate Operating System and passed the test on Windows XP Professional and Windows 2003 Server systems, theoretically, it supports all Windows operating systems with NT 2000 and above, including 2003, XP, 2008, Vista, 7, and 4.0.

Preparations before installation

First, download the latest installation program from the official software websites:

  1. Apache HTTP Server 2.2.17
    Download Page: http://httpd.apache.org/download.cgi
    Http://www.apache.org/dist/httpd/binaries/win32/
  2. PHP 5.3.5(VC6 x86 Thread Safe)
    Download Page: http://php.net/downloads.php
    Http://windows.php.net/download/
  3. MySQL Community Server 5.5.8
    Download Page: http://www.mysql.com/downloads/mysql/

For Apache HTTP Server, we download the latest version of MSI installation package, which is No SSL version (OpenSSL is webpage encrypted transmission, which is not required.

For PHP, click to go to the Windows Version Download Page.

Because we are using the Apache 2 Environment (rather than IIS), we chose the latest version of the MSI installation package for VC6.

MySQL Community Server we select 32-bit or 64-bit to download the latest MSI installation package based on the computer's CPU processor parameters.

The three software installation packages have been downloaded.

Step 1, Install Apache HTTP Server.

Set "localhost" for Network Domain and Server Name, and "Administrator's Email Address" to the Administrator's Email Address.

Destination Folder: Enter the custom installation path of Apache HTTP Server. The figure shows the installation path of the author.

Step 2, Install PHP.

Destination Folder: Enter the custom PHP installation path. The figure shows the installation path of the author.

Web Server Setup, here we select "Apache 2.2.x Module" to be mounted on Apache HTTP Server for use. (The php5apache2_2.dll file will be installed in the PHP installation directory)

In "Apache Configuration Directory", select the correct Apache Configuration file path.

Click "Extensions" to install all components.

Step 3, Install MySQL Community Server.

Click Custom installation type.

Set Location to the custom MySQL Community Server installation path. The figure shows the installation path of the author.

MySQL Enterprise Edition features, skipped. Click Finish to enter the MySQL Configuration Wizard.

Select "Detailed Configuration", that is, Detailed Configuration.

Select "Developer Machine", that is, the Machine used for development. "Server Machine" is used for Server configuration, and "Dedicated MySQL Server Machine" is used to run MySQL services for all computer resource users.

Select "Multifunctional Database ".

InnoDB Tablespace Settings, select the custom MySQL database data file storage location. The figure shows the path selected by the author.

Select "demo-support (DSS)/OLAP" and set the maximum number of user connections for the MySQL server.

Use the MySQL service through the TCP/IP network and use the default configuration.

Set the MySQL database Character Set, select "Manual Selected Default Character Set/Collation", and adjust "Character Set" to "utf8 ".

Set the MySQL service in Windows. uncheck "Launch the MySQL Server automatically", which means to automatically start the MySQL service without starting the system.

MySQL Service Security Options. Enter the custom administrator password in "root password.

Prepare application settings and click Execute.

So far, MySQL Community Server has been installed.

Step 4, Configure the WAMP Integration Environment.

Find the location of the Apache HTTP Server Configuration File "httpd. conf" (in the conf folder under the installation directory) and open it with a text editor (such as Notepad, which I use EmEditor.

Find a line starting with "DocumentRoot", which is the path of the Web root directory in quotation marks. We will change it to a custom directory path.

At the same time, locate the line starting with "<Directory" and change the path in the quotation marks to the path of the custom Web Directory.

Locate the region starting with "LoadModule" and add the following two lines of code. "H:/Program Files/PHP" is the PHP installation path. Modify the path as needed. (H:/Program Files/PHP is the author's PHP installation path)

12 LoadModule php5_module "C:/Program Files/PHP/php5apache2_2.dll" PHPIniDir "C:/Program Files/PHP"

Locate the region starting with "AddType", which is used to identify the website file type. Add the following two lines of code.

12 AddType application/x-httpd-php .php AddType application/x-httpd-php .html

Find the line "<IfModule dir_module>", "DirectoryIndex" is the file name on the detail page, and add "index. php default. php" before index.html. Use spaces to separate them.

Open the "run" dialog box and run "services. msc ".

In the "service" list, locate "Apache2.2" and "MySQL", and open the Properties dialog box, set "Start type" to "Manual", and click OK.

Create a new command line file and enter the following four commands. Enable "Apache2.2" and "MySQL" services after the service is stopped.

You can use this command line file to operate the WAMP environment switch in the future.

So far, the WAMP website environment has been installed successfully and basic configuration has been completed.

Step 5, Further configuration before the WAMP environment is officially put into use.

The following settings do not affect basic PHP + MySQL development. To support more advanced features, follow these steps.

  1. PHP error prompt
    Function: when PHP processes an error in the server script file, it sends a detailed error message to the HTTP output.
    Step: Open the PHP installation directory and open the php. ini configuration file in the text editor. Find "display_errors = Off", change it to "display_errors = On", and save the settings.
  2. Enable short_open_tag
    Function: enables the PHP code label abbreviation function.
    Step: Open the PHP installation directory and open the php. ini configuration file in the text editor. Find "short_open_tag = Off", change it to "short_open_tag = On", and save it.
  3. Modify the default time zone of PHP
    Function: Let PHP know the default time zone of the server. If this parameter is not set, an error is reported for functions such as date () and gmdate.
    Step: Open the PHP installation directory and open the php. ini configuration file in the text editor. Find "; date. timezone =", change it to "date. timezone = UTC", and save it.
  4. Modify the PHP file upload size limit
    Step: Open the PHP installation directory and open the php. ini configuration file in the text editor. Change "2 M" in "upload_max_filesize = 2 M" to the desired number and save it. (The value is too large or invalid, so the default value is 2 M automatically ).

Now, the WAMP website environment is ready for use.

Appendix: WAMP environment configuration Common Errors and Solutions
  1. An error occurred while loading the dynamic link library at PHP startup: Unable to load dynamic library
    Description: The startup process fails when a fatal error is reported because the DLL does not exist or the file is incorrect. Common error files such as php_oci8.dll.
    Solution: After Zend Core is installed, restart the Apache service. (Zend Core: http://www.zend.com /)
  2. MySQL Service Startup error: Can't connect to MySQL server on 'localhost' (10061)
    Description: Due to Windows environment compatibility limitations, the localhost cannot be resolved, leading to a fatal error and startup failure.
    Solution: Open the MySQL installation directory and open the my. ini configuration file in the text editor. Find the "[mysqld]" group, add "bind-address = 127.0.0.1" to it, save it, and restart the MySQL service.
Appendix: PhpMyAdmin Installation

The download page is http://www.phpmyadmin.net/home_page/downloads.php.

Download the multi-language ZIP package (the image is phpmyadmin-3.3.9-all-languages.zip "). After the download is complete, decompress the package to the Web root directory and rename it "phpmyadmin ".

After clicking enter, copy the file "config. sample. inc. php" to "config. inc. php" and open it in a text editor. Add the following two lines of code in the area starting with "$ cfg ['servers']": the user name and password of the MySQL environment.

12 $cfg['Servers'][$i]['user'] = 'root'; $cfg['Servers'][$i]['password'] = 'root';

Change "$ cfg ['servers'] [$ I] ['auth _ type'] = 'cookies';" to "config ", indicates that the user name and password are read from the configuration file to access phpMyAdmin.

So far, the phpMyAdmin Database Management Program has been installed.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.