Apache,php,mysql installation, configuration

Source: Internet
Author: User
Tags mssqlserver phpinfo vc9 win32 root access

Apache

1. Download

The Apache version number is 2.2.22. It is best to download the MSI installation file. is: http://www.apache.org/dist/httpd/binaries/win32/

If you want to download the 2.4.4 version, you can go to http://www.anindya.com/apache-http-server-2-4-4-and-2-2-24-x86-32-bit-and-x64-64-bit-windows-installers/

2. Installation

Next installation. Note The default installation, which is configured with a port of 80. This conflicts with the port of the reporting Services Configuration Manager tool for IIS and MSSQLSERVER. There are 2 ways to solve

(1) Modify the Apache port.

Open \apache2.2\conf\httpd.conf, search for "Listen 80", and change 80 to 8080.

(2) Shut down the IIS server:

Control Panel-Administrative Tools-Services-world Wide WEB Publishing Service, stop and then disable

Modify the ports of the MSSQLServer reporting Services Configuration Manager tool:

Start-microsoft SQL Server r2-Configuration Tool-reporting Services Configuration Manager-pop-up dialog box, click Connect-click Web Service url-Change the TCP port to 8082 or another port, click Apply.

Attention:

    • Shutting down the IIS server requires a restart of the machine to free up port 80 because the service process that IIS resides in Svchost.exe not only contains IIS services, but also contains many other services. The IIS service is shut down and the svchost process is not shut down, so the 80 port is still occupied by the process.
    • It is best to modify the Apache installation path so that it does not contain spaces in the directory tree, so that in the configuration of PHP is not prone to problems, or when configuring httpd.conf, if it contains spaces, the Apache service will fail to start.

3. Start the service

After the Apache installation succeeds, the default is to add a service in Control Panel services: apache2.2. We can use the command line to manipulate the startup shutdown service:

Cmd.exe->cd the bin directory under the Apache root directory

(1) Install service

Httpd.exe-k Install-n apache2.2

(2) Uninstall service

Httpd.exe-k Uninstall-n apache2.2

(3) Start service

net start apache2.2

(4) Stop service

net stop apache2.2

Configuration

(1) Now start to configure the Apache server, so that it better serve us, in fact, if not configured, your installation directory under the Apache2.2\htdocs folder is the default root directory of the site, put files on it can be. Locate the foundation\apache2.2\conf under the installation directory "C:\Program Files (x86) \apache software httpd.conf", locate DocumentRoot, and place the source directory "c:/ Program Files (x86)/apache software Foundation/apache2.2/htdocs "modified to new directory" C:/Program Files (x86)/apache software Foundation/wwwpages ". Notice that the backslash "\" is changed to a forward slash "/".

(2) Find "DirectoryIndex", DirectoryIndex (directory index, that is, in the case of a directory only, the default display of the file name), you can add a lot, the system will be based on the left-to-right order of priority display, separated by a single half-width space. I changed the default value of "index.html" to "mypage.html phpinfo.php".

(3) Look for "# This should is changed to whatever you set DocumentRoot to." The "Directory" node under content. Change its value "C:/Program files (x86)/apache software Foundation/apache2.2/htdocs" to the modified Web root directory "C:/Program Files (x86)/apache Software Foundation/wwwpages ". Notice that the backslash "\" is changed to a forward slash "/".

(4) configuration is complete.

Php

1. Download

Download PHP version 5.3.*, be careful not to download too new or too old version to avoid and Apache cannot work together. Download the. zip package and unzip it. As: http://windows.php.net/download/, select Download VC9 x86 Thread safe version.

2. Installation

(1) Decompression Php-5.3.25-win32-vc9-x86.zip, for easy configuration, put it in Apache installation directory C:\Program Files (x86) \apache Software Foundation, Modify the directory name php-5.3.25-win32-vc9-x86->php5.3.25.

(2) Locate the Php.ini-development file in the php5.3.3 directory with the same name as PHP.ini.

3. Configuration

Configure the Apache server to support parsing of PHP files:

(1) Open C:\Program files (x86) \apache software foundation\apache2.2\conf\httpd.conf file,

Find the #loadmodule vhost_alias_module modules/mod_vhost_alias.so, followed by the following code, notice that the backslash "\" in the path is replaced by a slash "/".

LoadModule php5_module "C:/Program Files (x86)/apache software Foundation/php5.3.25/php5apache2_2.dll"
Phpinidir "C:/Program Files (x86)/apache software foundation/php5.3.25"

The first line is to load PHP as a module, and the second line indicates the location of the PHP configuration file php.ini.

Locate AddType application/x-gzip. gz. tgz, and add the code after it:

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

Here is the ability to execute PHP files that are capable of executing PHP file types, i.e.. PHP and. html files.

Note this place:

    • Add the Code LoadModule Front, do not add "#" number, adding "#" is the meaning of the comment
    • C:/Program Files (x86)/apache software Foundation/php5.3.25/php5apache2_2.dll contains spaces, starting with the Apache Discovery report error when it is configured first. The line that the error points to is exactly the line. The reason is that "if you have a space, Apache will think that you use LoadModule when using >2 parameters, and this command parameter can only be 2". I have added double quotation marks to this parameter and found that Apache can start normally. But to make sure Apache works, it's a good idea to place PHP in a directory tree that doesn't contain spaces.
    • If the Apache fails to start, in order to be able to see the specific failure reason, it is best to start the bin directory under the Apache:cmd.exe->apache root directory using the command line and execute httpd.exe-w-K start.
    • The Php5apache.dll file and Apache version correspond to the following, "Do not download too new or too old version, to avoid and Apache do not work together" is important.
      • Php5apache.dll is only available for Apache version 1;
      • Php5apache2.dll only applicable to apache2.0.* version;
      • Php5apache2_2.dll is suitable for apache2.2.* or above version;
    • Above, see http://www.juziku.com/beston/wiki/1762.htm.

(2) Open the php.ini file under the php5.3.25 folder, find the Extension_dir, copy the path "C:/Program files (x86)/apache software Foundation/php5.3.25/ext ", replace the original"./"and put the"; "in front of the line Remove (the semicolon is a comment for the INI file). Notice that the backslash "\" in the path is replaced by a slash "/".

(3) Restart the Apache service.

(4) Create a Foundation\apache2.2\htdocs file under the Apache Web site root directory C:\Program files (x86) \apache software phpinfo.php:

<?phpphpinfo ();? >

Open http://localhost:8080/phpinfo.php in the browser.

Mysql

1. Configure PHP to support MySQL first

(1) Open the php.ini file under the php5.3.25 folder to find "Extension=php_mysql.dll" and "Extension=php_mysqli.dll". Remove the ";" before the two, and PHP now supports MySQL.

(2) Restart Apache and refresh the http://localhost:8080/phpinfo.php. Search for "MySQL" in the Web page and you can see that the MySQL and mysqli modules are loaded on the page.

2. Download

Download MySQL version 5.1.51.

3. Installation

Note: Go to the installation steps listed in "Http://wenku.baidu.com/view/7b9bbdc1aa00b52acfc7ca5f.html"

(1) Double-click Install, choose "Custom" installation method, modify the installation path for Apache and PHP in the same directory: "C:\Program Files (x86) \apache software foundation\mysql5.1.51\".

(2) Note: Click "MySQL server datafiles" under "MySQL server", note the directory where the data is stored, the default is: "C:\ProgramData\MySQL\MySQL server 5.1\". I changed it to E-disk: "E:\ProgramData\MySQL\MySQL Server 5.1\".

(3) Developer Component selected: Click developer Components, select "This Feature,and all Subfeatures,will is installed on the local hard dri Ver ".

(4) Start the installation, after the installation is complete, on the last page, keep the "Configure the MySQL Server now" check box in the default selected state. In the page that appears later, leave the detailed Configuration selected by default. Next page, select the server type, there are three options to choose from: "Developer Machine (Development test class, MySQL occupies very little resources)", "Server machine (server type, MySQL takes up more resources)", "dedicated MySQL server machine (dedicated database server, MySQL occupies all available resources) ", keep the default selection" Developer machine "

(5) After that, select the purpose of the database, "multifunctional database (General purpose)", "Transactional database only (server type, focus on transaction Processing)", "non-transactional Database only (non-transactional type, simpler, mainly to do some monitoring, counting, support for MyISAM data types is limited to non-transactional). Leave the default selection.

(6) Configure InnoDB tablespace, select a storage space for the database file, the default is the MySQL installation path. If modified, to remember the location, the reload to choose the same place, otherwise it may cause database corruption, I created a innodbdata folder in the "E:\ProgramData\MySQL\MySQL Server 5.1\" directory, the path is modified to "E : \programdata\mysql\mysql Server 5.1\innodbdata ".

(7) Configure the number of simultaneous connections MySQL can have, "decision Support (DSS)/olap (20 or so)", "Online Transaction Processing (OLTP) (500 or so)", "Manual Setting (manually set, lose a number yourself) ", select" Decision Support (DSS)/olap ".

(8) Whether to enable TCP/IP connection, set the port, if not enabled, you can only access the MySQL database on your own machine. Select Enable, and tick "ADD firewall exception for this port" to support the firewall. Leave the option "Enable Strict Mode" By default so that MySQL does not allow small syntax errors, which can reduce the likelihood of harmful data entering the database.

(9) The MySQL default database language encoding is set, the first is the Latin code, the second is a multi-byte universal UTF8 encoding, is not our universal encoding, here Select a third, and then character set there select "GBK", when using MySQL, Run the "SET NAMES GBK;" Before executing the data manipulation command. (Run once on the line, GBK can be replaced with other values, depending on the settings here), you can normally use Chinese characters (or other text), otherwise it will not be normal display of Chinese characters.

(10) Choose whether to install MySQL as a Windows service, you can also specify the service name (the identity name), whether to add the MySQL bin directory to Windows PATH (after joining, you can directly use the file under the bin, instead of indicating the directory name, such as connection, "Mysql.exe-uusername-ppassword;" You can, without pointing out the full address of the Mysql.exe, is convenient). Select All

(11) Set the default root user (super Admin) password (default is empty), if you want to modify, fill in the new password here (if it is re-installed, and have already set a password, here to change the password may be error, please leave blank, and will "Modify Security Settings" The previous tick is removed, and the password is changed after the installation configuration is complete). "Enable root access from remote machines (whether to allow root users to log on to other machines, if it is safe, do not tick, if it is convenient, tick it)". Finally "Create an Anonymous account (create a new anonymous user, anonymous users can connect to the database, unable to manipulate data, including queries)", generally do not tick.

(12) After confirming the error, press "Execute" to make the setting effective.

* Here is a common mistake, is not "Start service", generally appear in the previous installation of MySQL server, the solution, the first to ensure that the previous installation of the MySQL server completely uninstalled; if not, check whether the previous password has been modified as described in the previous step , according to the above operation; if still not, the MySQL installation directory under the Data folder Backup, and then delete, after the installation is completed, will install the generated Data folder removed, the backup Data folder back, and then restart the MySQL service can be, in this case, You may need to check the database and fix it once to prevent data errors.

(13) Test: Write a file "mysqltest.php" to "C:\Program files (x86) \apache software Foundation\apache2.2\htdocs" Directory

<?php$mycon=mysql_connect ("localhost", "root", "password of the root account you set"); if ($mycon) {    echo "connect successfully!";} else {    echo "Connect failed!";}    ? >

Open "http://localhost:8080/mysqltest.php" in the browser. If "Connect successfully!" is displayed, the configuration is successful.

* If it appears

Warning:mysql_connect () [Function.mysql-connect]: [2002] connection attempt (trying to connect via tcp:/because the connecting party does not respond correctly after a period of time or the connected host is not responding) /localhost:3306) in xxx\mycon.php on line 2
Warning:mysql_connect () [Function.mysql-connect]: The connection attempt failed because the connecting party did not reply correctly after a period of time or the connected host did not respond. In E:\apache\htdocs\mycon.php on line 2
The C:\WINDOWS\system32\drivers\etc\hosts file needs to be modified. Open with Notepad, modify
# 127.0.0.1 localhost

Remove the # Save. If you cannot modify it, copy it to another place and paste it back.

Reference:

1. Win7 under apache2.2.16+php5.3.3+mysql5.1.51 Installation and configuration diagram (http://wenku.baidu.com/view/7b9bbdc1aa00b52acfc7ca5f.html)

2. Apache Configuration httpd.conf (http://www.juziku.com/beston/wiki/1762.htm)

3. PHP Installation configuration under Windows (http://www.cnblogs.com/tigertall/archive/2010/01/28/1658869.html)

Apache,php,mysql installation, configuration

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.