Home  >  Article  >  php教程  >  win10本地搭建apache+php+mysql运行环境

win10本地搭建apache+php+mysql运行环境

WBOY
WBOYOriginal
2016-07-21 14:52:581236browse

首先下载所需软件:

Vc2015:https://www.microsoft.com/zh-CN/download/details.aspx?id=48145

Vc2012:http://www.microsoft.com/zh-CN/download/details.aspx?id=30679

Apache2.4:http://www.apachelounge.com/download

PHP:http://windows.php.net/download (下载线程安全版的,即Thread Safe)

Mysql:https://downloads.mariadb.com/archives/mysql-5.5/mysql-5.5.27-win32.msi

 

安装并配置Apache

Apache版本:Apache2.4.16

解压目录:D:\PHP\Apache24

安装Apache2.4.16,需要先安装Visual C++ Redistributable for Visual Studio 2015运行库

 

(1).下载回来的是解压文件,解压好放到要安装的位置。

(2).打开Apache24\conf下httpd.conf 文件,修改以下关键位置:

ServerRoot  “D:/PHP/Apache24”(即Apache的安装位置);

DocumentRoot  “D:/PHP/Apache24/htdocs” (Apache默认的网站根目录,可根据自己的   喜好调整)

修改根目录的选项:

修改前

    Options Indexes FollowSymLinks
    AllowOverride null
    Require all granted

修改后

    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted

#ServerName www.example.com:80 => ServerName 127.0.0.1:80 (去掉前面的#)

DirectoryIndex index.html => DirectoryIndex index.html index.php index.htm (我们添加了  index.php index.htm)

ScriptAlias /cgi-bin/ "c:/Apache24/cgi-bin/"改为

ScriptAlias /cgi-bin/ "d:/PHP/Apache24/cgi-bin/"

=> 

(3).打开cmd,并输入以下命令行

d: 回车

cd PHP\Apache24\bin 调到Apache24中bin目录下

httpd 回车 如果没有任何提示表示启动成功

 

如果想在服务中添加Apache24,则以管理员身份 运行cmd,并输入以下命令

d: 回车

cd PHP\Apache24\bin 回车

httpd.exe -k install 回车

(4).打开浏览器输入“http://localhost/”进行测试,显示”It works!”证明配置成功。

 

安装并配置PHP

PHP版本:php5.6.14

安装目录:D:\PHP\php56

安装php5.6.14需要先安装Visual C++ Redistributable for Visual Studio 2012运行库

 

(1).下载回来的是解压文件,解压好放到要安装的位置;

(2).复制份php.ini-development,并改名为php.ini

(3).让Apache24加载PHP模块,打开Apache24\conf\httpd.conf,在最后加上

LoadModule php5_module "D:/PHP/php56/php5apache2_4.dll"

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

PHPIniDir "D:/PHP/php56" (告诉apache php.ini的位置)

(4).开启几个常用php扩展,打开php.ini文件,修改以下内容:

;extension_dir = "ext" => extension_dir = "D:/PHP/php56/ext"(去掉分号)

;extension=php_mbstring.dll => extension=php_mbstring.dll

;extension=php_mysql.dll => extension=php_mysql.dll

;extension=php_mysqli.dll => extension=php_mysqli.dll

注意:win下要开启curl扩展,libeay32.dll和ssleay32.dll必须放到PATH环境变量包含的目录下   

(5).重启Apache服务器

 

安装Mysql

Mysql版本:mysql5.6.27

点击文件直接安装即可。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn