The most detailed win7 manually build PHP Environment: apache2.4.23+php7.0.11

Source: Internet
Author: User
Tags php download vc runtime

The most detailed win7 manually build PHP Environment: apache2.4.23+php7.0.11

? Download Resources (APACHE24,PHP7,PHPSTORM9)

? Modifying the Apache24 configuration file

? Install and launch Apache service

? Modify php7.0.11 configuration file

Pre-Configuration Description: The computer needs to have a VC runtime environment, otherwise it will prompt the computer lost VCRUNTIME140.dll(because the version needs to VC14 compile, in order to avoid installation failure, you can first install Vc_redist.x86.exe or VC_ Redist.x64.exe), if the computer has a newer version of the. NETFramework, then there is no problem.

Address: 64-bit version, 32-bit version

1. Download resources (APACHE24,PHP7,PHPSTORM9)

1.1 php Download:

Http://windows.php.net/download (official website)

http://download.csdn.net/detail/sinat_31719925/9734797 (i downloaded the version)

Here is the php-7.0.11-win32-vc14-x64 (64-bit thread-safe version ). Note You must download thread-safe

1.2 Apache HTTP Server (apache24) Download:

http://www.apachelounge.com/download/(official website)

http://download.csdn.net/detail/sinat_31719925/9734773 (i downloaded the version)

http://download.csdn.net/detail/sinat_31719925/9734784 (based on the revised version of this tutorial)

The download here is Httpd-2.4.23-win64-vc14

1.3 Unzip Httpd-2.4.23-win64-vc14.zip and php-7.0.11-win32-vc14-x64.zip to the specified directory respectively:

Here unzip to the E-drive:

2.Apache HTTP Server(apache24) configuration

Use the editor (here with Sublime3) to open the httpd.conf file in the E:\Apache24\conf directory

2.1 Modifying the root directory of Apache: ServerRoot "E:/apache24"

2.2 Modify the domain name configuration: ServerName 127.0.0.1:80 (Note: Remove the # before the ServerName)

2.3 Modify the site root directory (two lines) configuration DocumentRoot "E:/apache24/workspace/www"

(Note: The WWW folder is the root directory of the Web site, you need to create it, otherwise it will error.) Also, the No. 246 line needs to be modified as shown)

www folder built by itself, the path is:

2.4 Configuration Welcome page (home), DirectoryIndex index.html change to DirectoryIndex index.php index.html index.htm

123 <IfModule dir_module>     DirectoryIndex index.php index.html index.htm</IfModule> 

As follows:

2.5 Loading PHP modules

Add the following #loadmodule xml2enc_module modules/mod_xml2enc.so

12345 #load php moduleLOadModule php7_module "E:/Php7/php7apache2_4.dll"AddHandler application/x-httpd-php .php#指定php.ini的位置(注意:需要把E:/Php7下的php.ini-development 重命名为 php.ini)PHPIniDir "E:/Php7"

As follows:

Code Description: Load PHP in module mode, indicating the location of PHP configuration file php.ini.

2.6 The last step, check that just configured there is no mistake, in the DOS window ("win+r" shortcut key input cmd) into the Apache installation directory Apache24/bin input:httpd.exe-t

If shown, the Apache configuration file has been modified (the 2.1-2.5 operation is correct):

If wrong, you will be prompted the first few lines of error.

3. Install and start Apache:

3.1. Installation Services: Enter the DOS window ("win+r" shortcut key input cmd). Go to Apache installation directory Apache24/bin enter httpd.exe-k Install

(Note:httpd.exe-k install-n is wrong,httpd.exe-k install or httpd.exe-k install-n service name is right, if you press httpd.exe-k install-n

Register apache2.4 Service, although can register, but later will because this causes unable to start the service, the author is because this causes unable to start Apache, card here two days. Shy,,)

The image above shows the registration Apache service is successful, you can go to the service of the system to see.

Note: Errors reported here must is corrected before the service can be started. It's not an error, it's a hint. If there is an error below this line, fix the error and start again!

If you want to delete the service, you can continue to look, otherwise you can skip the following:

After successfully installing the service, you can see the Apache2.4 in the system service, if you want to remove this service, go to Apache installation directory E:\Apache24\bin,

Method One: You can enter the command in the DOS window: SC Delete Service name (service name in the properties of the service, you can refer to)

Method Two (recommended): By deleting the service command: httpd.exe-k uninstall-n Apache2.4 (service name)

3.2. Start Service: Enter the E:\Apache24\bin directory in the DOS window, input httpd.exe-k start or net start apache2.4

Or to the Apache installation directory E:\Apache24\bin Double-click ApacheMonitor.exe, and then click Start, then you can see in the system service apache2.4 service is started

If startup fails during the start of the service, you can refer to the blog post: Troubleshoot issues that apache/php cannot start

Typically 80 port occupancy issues, resolve:

12345678 # 查找占用80端口的进程pid netstat -ano|find ":80"   # 假设该进程pid为2013,查看进程名称: tasklist /fi "pid eq 2013"# 杀掉该进程命令 taskkill /f /pid 2013 

3.3 Enter http://localhost/in the browser if the following information appears, the configuration is successful (Thinking Focus Blog Park: xiezhidong.cnblogs.com):

We have specified a custom working path in Apache, as follows:

Moreover, we have placed a test.php file in the path,

Then, you can test Apache to load the PHP interpreter successfully by typing: http://localhost/index.php in the browser URL:

3.php7.0.11 Configuration

3.1 Open the php.ini file in the E:\PHP7 directory with the editor, change extension_dir = "ext" to extension_dir = "E:/php7/ext" (Note to remove the preceding semicolon)

3.2 Open (That is, remove the preceding semicolon) the module used to connect to the database (Mysql)

Extension=php_mysql.dll

As follows:

3.3. Configuring environment Variables for PHP7 (can be skipped)

By the way to configure the environment variable to facilitate the installation of pear later, or DOS window operation will first find the installation directory:

① Right-click My Computer-Properties-advanced-environment variable ② find the path, and at the end, add your PHP directory and the classpath of the class library, including the previous ";" For example; E:\PHP7; E:\Php7\ext③ Click on the "new" button of the system variable and enter "PHPRC" in "Variable name", enter the directory where the php.ini file is located in the variable value (for example:E:\PHP7), this step is for Windows to find php.ini.

Tags: php reprint

The most detailed win7 manually build PHP Environment: apache2.4.23+php7.0.11

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.