简单,可复制

点点滴滴,尽在文中

  :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
  430 随笔 :: 0 文章 :: 507 评论 :: 0 引用

公告

apache2.4下载和安装

下载apache2.4

https://www.apachelounge.com/download/VC11/

提取解压目录Apache24到d:/dev/Apache24

修改d:/dev/Apache24/conf/httpd.conf

ServerRoot "d:/dev/Apache24"

DocumentRoot "d:/dev/Apache24/htdocs"
<Directory "d:/dev/Apache24/htdocs">

 

在D:\dev\Apache24\bin启动cmd,执行

httpd -k install 

httpd -k start

如提示msvcr110.dll丢失,请下载并安装VC++ 2012运行库:https://www.microsoft.com/zh-CN/download/details.aspx?id=30679

访问http://localhost/检查是否安装成功

 

php5.5下载和配置

 http://windows.php.net/downloads/releases/archives/  php-5.5.9-Win32-VC11-x64.zip

解压到D:\dev\php-5.5.9-Win32-VC11-x64

拷贝php.ini-development到php.ini

修改php.ini

设置扩展支持目录

extension_dir = "D:/dev/php-5.5.9-Win32-VC11-x64/ext"

打开常见扩展

extension=php_bz2.dll
extension=php_curl.dll
extension=php_gd2.dll
extension=php_mbstring.dll
extension=php_mysql.dll

配置环境变量,设置

PHP_HOME   D:\dev\php-5.5.9-Win32-VC11-x64

修改PATH,追加%PHP_HOME%

测试是否安装成功   php -v

如提示msvcr110.dll丢失,请下载并安装VC++ 2012运行库:https://www.microsoft.com/zh-CN/download/details.aspx?id=30679

 

php7.1下载和配置

http://windows.php.net/downloads/releases/archives/  php-7.1.4-Win32-VC14-x64.zip

解压到D:\dev\php-7.1.4-Win32-VC14-x64.zip

配置和安装参考php5.5的配置

 

mysql5.7下载和配置

https://dev.mysql.com/downloads/mysql/  下载mysql-5.7.18-winx64.zip

解压到D:/dev/mysql-5.7.18-winx64

在mysql安装目录,创建my.ini

[mysqld]
basedir=D:/dev/mysql-5.7.18-winx64
datadir=D:/dev/mysql-5.7.18-winx64/data

 

初始化mysql  

bin\mysqld --defaults-file=D:/dev/mysql-5.7.18-winx64/my.ini --initialize-insecure

如提示msvcr120.dll丢失,请下载并安装VC++ 2013运行库: https://www.microsoft.com/zh-cn/download/details.aspx?id=40784

安装服务并启动
bin\mysqld -install
net start MySQL

测试mysql是否可以登陆
bin\mysql -uroot

设置root账户的密码为123456
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY '123456' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;

修改环境变量
MYSQL_HOME D:/dev/mysql-5.7.18-winx64
PATH 追加 %MYSQL_HOME%/bin

 

php5.5(php7.1)和apache2.4的集成

php5.5和php7.1都支持apahce2.4,集成的方法都是一致的,这里以php5.5为例。

 

支持 PHP 解析

修改apache安装目录conf下的httpd.conf,在LoadModule内部, 追加(或更改为)如下配置:

LoadModule php5_module "D:/dev/php-5.5.9-Win32-VC11-x64/php5apache2_4.dll"
PHPIniDir "D:/dev/php-5.5.9-Win32-VC11-x64"
AddType application/x-httpd-php .php

如果是php7,配置应该是:

LoadModule php7_module "D:/dev/php-7.1.5-Win32-VC14-x64/php7apache2_4.dll"
PHPIniDir "D:/dev/php-7.1.5-Win32-VC14-x64"
AddType application/x-httpd-php .php

 

加入index.php作为首页

DirectoryIndex index.html index.php

重启apache  httpd -k restart

在D:\dev\Apache24\htdocs创建phpinfo.php

<?php
phpinfo();
?>

访问http://localhost/phpinfo.php,测试是否配置成功。

 

虚拟主机

修改C:\Windows\System32\drivers\etc\hosts

加入127.0.0.1 local.test.com

修改apache安装目录conf下的httpd.conf,搜索到"# Virtual hosts”部分,加入(或更改为)如下配置:

<Directory />
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>

Include conf/extra/httpd-vhosts.conf
修改httpd-vhosts.conf,加入

<VirtualHost *:80>
  DocumentRoot C:/dev/svn/test
  ServerName local.test.com
  #下面三行可选
  #ServerAdmin admin@local.test.com
  #ErrorLog "logs/local.test.com-error.log"
  #CustomLog "logs/local.test.com-access.log" common
</VirtualHost>

创建C:/dev/svn/test目录,创建phpinfo.php

<?php
phpinfo();
?>

重启apache  httpd -k restart

访问http://local.test.com/phpinfo 

 

posted on 2017-05-23 15:25 ggjucheng 阅读(...) 评论(...) 编辑 收藏