A, win10 64 bit build environment apache2.4 + php 7.x

First, download the PHP folder and unzip


 

1. Download: https: //www.php.net/downloads.php, select windows downloads

 

Download the latest version of the .zip file

 

Second, download the Apache folder and unzip


 

Download: http: //httpd.apache.org/download.cgi, find the latest version, select the files for Microsoft Windows

Select ApacheHaus 

 

Select 64-bit, you can download

After unpacking, pay attention to its directory, my directory: D: \ PHP \ Web \ Apache24            D: \ PHP \ Web \ phpcon

If there IIS, it is best to turn off the IIS, the IIS or assigned to other ports, such as 8080, and then install

Find D: \ webServer \ Apache24 \ conf \ httpd.conf file, use Notepad to open, the value Define SRVROOT changed:

Define SRVROOT "D:\php\web\Apache24"
ServerRoot "${SRVROOT}"

 Run as administrator to run cmd.exe, enter the following run

D:\php\web\Apache24\bin\httpd.exe -k install -n apache

start up:

Method one: Locate the D: \ webServer \ Apache \ bin \ ApacheMonitor.exe point Start to start

Method Two: cmd inside run (recommend this method, if an error occurs, you can see what is wrong)

D:\php\web\Apache24\bin\httpd.exe -w -n "apache" -k start 

 

Third, the configuration file httpd.conf


 

1, added after LoadModule ssl_module modules / mod_ssl.so

LoadModule php7_module " D:/php/web/phpcon/php7apache2_4.dll"
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
PHPIniDir " D:/php/web/phpcon"

注意:

(1、php7apache2_4.dll所在的位置

(2、PHPIniDir是指定php.ini所在的位置

(3、注意要把"\"改成"/"

 2、修改ScriptAlias

把ScriptAlias /cgi-bin/ "${SRVROOT}/cgi-bin/"改为以下

ScriptAlias /php/ "D:/php/web/phpcon/"

把<Directory "${SRVROOT}/cgi-bin">改成

<Directory "D:/php/web/phpcon/">

3、修改DocumentRoot的值(指定网站的根目录)我的根目录用了D:/php/web/root

修改以下两处:

DocumentRoot "D:/php/web/root"

<Directory " D:/php/web/root ">

4.修改DirectoryIndex指定默认文档的名称

<IfModule dir_module>

     DirectoryIndex index.html
</IfModule>

换成

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

 

四、步骤四、配置php.ini


1、配置php.ini

  把php目录下的php.ini-production改名为php.ini

打开php.ini

把extension_dir = "./",修改为

extension_dir = "D:\php\web\phpcon\ext"

 


五、测试及问题


 

重启电脑,开启服务,新建一个php文件,并在浏览器中访问

问题:开启服务出错

OS 10048)通常每个套接字地址(协议/网络地址/端口)只允许使用一次。  : AH00072: make_sock: could not bind to address [::]:443
(OS 10048)通常每个套接字地址(协议/网络地址/端口)只允许使用一次。  : AH00072: make_sock: could not bind to address 0.0.0.0:443

 打开D:\php\web\Apache24\conf\extra,做以下操作

再访问,ok!

 

Guess you like

Origin www.cnblogs.com/Mu-Workstation/p/10993012.html