博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Win7+php7+apache2.4
阅读量:4053 次
发布时间:2019-05-25

本文共 1552 字,大约阅读时间需要 5 分钟。

php7正式版已经发布,性能是php5.4的2倍。博主入手php7 新鲜了一把,下面是解决问题之后成功启动php7的记录。

软硬件要求:

1、电脑必须win7 sp1, .netframework4及以上

一、下载php7和apache2.4

首先下载php7的windows压缩包,到这里下载

Php7 VC14 x86 Thread Safe (2015-Dec-03 21:09:17) zip [20.98MB]

我选择的是php7的这个版本,由于它是vc14编译的,这意味着需要安装vc2015(即vc14)运行时环境,同时需要Apache2.4才可以运行php7 。

1.vc2015到这里下载:

点下载,之后选择vc_redist.x86.exe 下载,运行安装。

需要注意,安装vc14必须开启这3个服务,否则一定会安装失败:

进入服务启动下列服务: windows modules installer、windows update、window defender service

2.Apache2.4到这里下载:Apache 2.4.17 Win32

选择

将php7的windows压缩包、Apache2.4解压,如我的路径是:

D:\web\apache24\

D:\web\php-7.0.0-Win32-VC14-x86\

D:\web\www\ (存放php网站脚本的目录,DocumentRoot.)

二、配置httpd.conf和php.ini :

1.打开apache24/conf/httpd.conf

修改:ServerRoot "D:/web/Apache24"

修改:DocumentRoot "D:/web/www/ "

修改:ScriptAlias /cgi-bin/ "d:/web/Apache24/cgi-bin/"

添加 :(注意phpIniDir项在上面) php7对apache的处理接口

PHPIniDir "D:/web/php-7.0.0-Win32-VC14-x86/"

LoadModule php7_module "D:/web/php-7.0.0-Win32-VC14-x86/php7apache2_4.dll"

添加:php的minetype

<IfModule mime_module>

TypesConfig conf/mime.types

AddType application/x-httpd-php .php

2.配置php.ini。 打开php目录,复制1个php.ini-development ,修改为php.ini。

打开php.ini, 找到 ;extension_dir = "D:/web/php-7.0.0-Win32-VC14-x86/ext" ,把前面的分号去掉。

(必须指定扩展路径,否则php7启动不了。一般开启ext扩展目录之后,就可以成功在命令行启动php7,如果仍然不成功,说明你的php路径没有添加到 环境变量中(或者你的环境变量有旧的php版本使用))

三、把apache24加入windows服务,并启动apache:

Cmd命令行,进入d盘,然后打开目录,运行httpd –k install

D:

Cd D:\web\apache24\

httpd –k install

httpd –k start

这样,apache和php7就启动了。

在D:/web/www/ 创建1个test.php文件

is is my first php.

访问: 实际运行结果

PS: Apache卸载命令:httpd.exe -k uninstall -n Apache2.4

你可能感兴趣的文章
Promise的基本使用
查看>>
coursesa课程 Python 3 programming 统计文件有多少单词
查看>>
coursesa课程 Python 3 programming 输出每一行句子的第三个单词
查看>>
Returning a value from a function
查看>>
coursesa课程 Python 3 programming Functions can call other functions 函数调用另一个函数
查看>>
coursesa课程 Python 3 programming The while Statement
查看>>
course_2_assessment_6
查看>>
coursesa课程 Python 3 programming course_2_assessment_7 多参数函数练习题
查看>>
coursesa课程 Python 3 programming course_2_assessment_8 sorted练习题
查看>>
在unity中建立最小的shader(Minimal Shader)
查看>>
1.3 Debugging of Shaders (调试着色器)
查看>>
关于phpcms中模块_tag.class.php中的pc_tag()方法的含义
查看>>
vsftp 配置具有匿名登录也有系统用户登录,系统用户有管理权限,匿名只有下载权限。
查看>>
linux安装usb wifi接收器
查看>>
多线程使用随机函数需要注意的一点
查看>>
getpeername,getsockname
查看>>
让我做你的下一行Code
查看>>
浅析:setsockopt()改善程序的健壮性
查看>>
关于对象赋值及返回临时对象过程中的构造与析构
查看>>
VS 2005 CRT函数的安全性增强版本
查看>>