Php+apache+mysql Environment Construction under window

Source: Internet
Author: User
Tags phpinfo win32

Tools/Materials
    • php-5.5.10-win32-vc11-x64.zip:http://windows.php.net/download/

    • httpd-2.4.7-win64-vc11.zip:http://www.apachelounge.com/download/

    • mysql-5.6.16-winx64.zip:http://dev.mysql.com/downloads/mysql/
Method/Step

First, installation configuration Apache2.4.7 (Httpd-2.4.7-win64-vc11.zip)

1. Unzip the downloaded installation package: Httpd-2.4.7-win64-vc11.zip put it in its own installation directory (my directory D:\phpEnv\Apache24)

2. Then modify the http.conf (D:\phpEnv\Apache24\conf\http.conf) configuration file-use Notepad to open the line

(1) Modify the root path of the ServerRoot Apache:

(37 lines) ServerRoot "C:/apache24" changed to =>serverroot "D:/phpenv/apache24"

(2) modify servername your host name:

(217 lines) SERVERNAMEWWW.EXAMPLE.COM:80 removes the previous #, which is required when launching Apache from the command line.

(3) modify DocumentRoot Apache access to the home folder directory, is the location of PHP, HTML code files. Apache default path is under Htdocs (D:\phpEnv\Apache24\htdocs), there will be a simple entry file index.html. This path can be modified on its own, and I will configure it in my own new folder, www (D:\phpEnv\www).

(247 lines) DocumentRoot "C:/apache24/htdocs"

<directory "C:/apache24/htdocs" >

Change to =

DocumentRoot "D:\phpEnv\www"

<directory "D:\phpEnv\www" >

(4) Modify the Portal file configuration: DirectoryIndex generally we are index.php, index.html, index.htm as the portal for Web projects. Apache Default portal only index.html need to add the other two support, of course, the settings of this portal file can be increased or decreased according to their own needs, if the requirements are more stringent can only write a index.php, so that the entry in the project can only be index.php

(274 lines) <IfModuledir_module>

Directoryindexindex.html

</IfModule>

Change to =

<IfModuledir_module>

DirectoryIndex index.php index.htm index.html

</IfModule>

(5) set the Serverscript directory:

(358 lines) scriptalias/cgi-bin/"c:/apache24/cgi-bin/" to = = scriptalias/cgi-bin/"D:/phpenv/apache24/cgi-bin"

(6) (380 lines)

<directory "C:/apache24/cgi-bin" >

AllowOverride None

Options None

Require all granted

</Directory>

Change to =

<directory "D:/phpenv/apache24/cgi-bin" >

AllowOverride None

Options None

Require all granted

</Directory>

3. You can start Apache next.

Start---Run, enter cmd, and open a command prompt. Then enter the D:\phpEnv\Apache24\bin directory to enter httpd enter.

You can test without an error (Keep the command window open).

Put the index.html in the Apache24\htdocs directory in the D:\phpEnv\www directory, access to the browser will appear "It works" that the Apache has been properly installed and started. You can also write a simple index.html file or open it yourself.

4. Add Apache to the window service startup and set it to boot

Close the HTTPD service first (Close the command window)

Reopen a new command window into the D:\phpEnv\Apache24\bin directory:

The command to add the HTTP service is: Httpd.exe-kinstall-n "ServiceName" ServiceName is the name of the service, I added: Httpd.exe-k install-n "Apache24" After the command succeeds, you will be prompted to see the Apache24 Service in the Window service startup item.

Then click on to start, if you do not want to set up the boot, you can also modify the startup type to Manual.

If you want to uninstall this service, first stop the service and then enter Httpd.exe-k uninstall-n "Apache24" to uninstall the service.

Of course, you can also start Apache by D:\phpEnv\Apache24\bin the ApacheMonitor.exe below, and there's not much to say.

So the Apache configuration is basically done.

Second, installation configuration php5.5.10 (Php-5.5.10-win32-vc11-x64.zip)

1, unzip the downloaded Php-5.5.10-win32-vc11-x64.zip to the installation directory my Yes (D:\phpEnv\php)

2. Copy the Php.ini-development file in the directory and rename it to php.ini he is a PHP configuration file

3. Add PHP support for Apache service

Open Apache configuration file http.conf at the end of the add

# PHP5 Support

Loadmodulephp5_module D:/phpenv/php/php5apache2_4.dll

addtypeapplication/x-httpd-php. php. html. htm

# Configure Thepath to PHP.ini

Phpinidir "d:/phpenv/php"

Here I add below the LoadModule

Add the time to ensure that your Php5apache2_4.dll file does exist php5.5 earlier version of the file does not have this, but the high-point version is already available, you can open the PHP installation directory to find this file

Phpinidir "d:/phpenv/php" This is your PHP root directory.

4. Restart the Apache server.

5. Test. Delete other files in www, create a new index.php, the content is <?php phpinfo ();?> Save, access the information that appears in PHP indicates that PHP has been successfully installed.

Note:

Some common configuration changes in PHP: (D:\phpEnv\php\php.ini)

Settings for time zone: Date.timezone = Asia/shanghai

Error Reporting level: Error_reporting = E_all This can all be opened in development mode.

Three, installation configuration mysql5.6.16 (Mysql-5.6.16-winx64.zip)

1. Install MySQL

64-bit MySQL temporarily did not find the MSI installation package, so directly extracted to the installation directory, and then configure the relevant environment variables, modify the configuration file, Add window service on the line, here is not detailed. Here put my configuration file for everyone to refer to the following:

[Mysqld]

Loose-default-character-set = UTF8

Basedir = d:/program/mysql-5.6

DataDir = D:/program/mysql-5.6/data

Port = 3306

Sql_mode=no_engine_substitution,strict_trans_tables

Character_set_server = UTF8

[Client]

Loose-default-character-set = UTF8

Note: Basedir is the root directory of MySQL and DataDir is the data storage directory for MySQL. I'm not going to explain anything else.

After installing MySQL, there is no graphical user interface, you can install a navicat for MySQL and other software, this will look more convenient.

2, after the installation of MySQL, add MySQL support for PHP

Open PHP configuration file php.ini (D:\phpEnv\php\php.ini)

(1) (721 lines); Extension_dir = "ext", remove the front ";" and change to Extension_dir = "D:\phpEnv\php\ext" to open PHP extension support, Ext folder has a lot of PHP extension support. dll files, interested students can look.

(2) then the MySQL extension that opens PHP

(875, 876 lines) remove the front ";"

Extension=php_mysql.dll

Extension=php_mysqli.dll

Of course you can also open 881 rows of Php_pdo_mysql.dll enable PHP PDO support I usually use this.

Note: There are many expansion options in lines No. 863 through No. 888, what you need to use, and remove the previous ";" You can do it. Of course if you want to add additional extension support such as Redis support, PHP itself may not provide the corresponding DLL files, you need to find the appropriate version of the DLL to add to the Ext folder, and then add a extension= in the configuration file ...

When you are finished, restart Apache

You can see it when you visit phpinfo.

Iv. Summary:

PHP environment installed on the internet has a lot of information, their own in contact with PHP is also shaking the check, in their own computer also installed many times, the beginning of the time also with the integration of software packages, WAMP, Appserv and so on, later PHP version upgrade, found to want to upgrade the integration package PHP is very troublesome, Therefore, it is strongly recommended that you do a separate configuration under the environment to better understand the connection between Apache, PHP, and MySQL.

Precautions
    • Install the computer to support VC11

    • The number of profile lines involved may vary slightly depending on the version or individual changes

      Reprinted from Http://jingyan.baidu.com/article/9faa723152c5d6473d28cb47.html.

Php+apache+mysql Environment Construction under window

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.