在 WAMP 中使用 PHP 7
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34153047/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Using PHP 7 with WAMP
提问by tyd01
My OS is Windows 10 Pro x64 and I have installed VC14
packages x86 and x64.
我的操作系统是 Windows 10 Pro x64,我已经安装了VC14
x86 和 x64 软件包。
I have added a php7.0.0 directory to wamp/bin/php
, copied files php.ini
, phpForApache.ini
and wampserver.conf
, and modified the directories and php extensions in these files.
我添加了一个php7.0.0目录wamp/bin/php
,复制的文件php.ini
,phpForApache.ini
并且wampserver.conf
这些文件,并修改了目录和PHP扩展。
There is my wampserver.conf
:
有我的wampserver.conf
:
<?php
$phpConf['phpIniDir'] = '.';
$phpConf['phpExeDir'] = '.';
$phpConf['phpConfFile'] = 'php.ini';
//PHP 7 needs Apache 2.4.x and doesn't works with Apache 2.2.x
$phpConf['apache']['2.4']['LoadModuleName'] = 'php7_module';
$phpConf['apache']['2.4']['LoadModuleFile'] = 'php7apache2_4.dll';
$phpConf['apache']['2.4']['AddModule'] = '';
?>
It is correctly read by WAMP because when I select the php7.0.0 version, the Apache httpd.conf gets this line:
它被 WAMP 正确读取,因为当我选择 php7.0.0 版本时,Apache httpd.conf 得到这一行:
LoadModule php7_module "c:/wamp/bin/php/php7.0.0/php7apache2_4.dll"
The path is correct and the dll file exists, but the Apache service doesn't start and if I check Apache extensions, the php7_module is indicated as not found (red square).
路径正确,dll 文件存在,但 Apache 服务未启动,如果我检查 Apache 扩展,则 php7_module 显示为未找到(红色方块)。
If I check apache error log, the only reported one is
如果我检查 apache 错误日志,唯一报告的是
[Tue Dec 08 11:02:14.021018 2015] [core:warn] [pid 5008:tid 516] AH00098: pid file C:/wamp/bin/apache/apache2.4.9/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Tue Dec 08 11:02:14.021018 2015] [core:warn] [pid 5008:tid 516] AH00098:pid 文件 C:/wamp/bin/apache/apache2.4.9/logs/httpd.pid 被覆盖 -- 不洁关机以前的Apache运行?
Does anyone who has successfully run PHP 7 in WAMP server know a fix for this problem? Thank you.
在 WAMP 服务器中成功运行 PHP 7 的任何人都知道解决此问题的方法吗?谢谢你。
采纳答案by tyd01
There is the answer :
答案是:
I was running with the last official wampserver which seems to be not compatible with php7 (I have made some tests on 4 computers with the same result of my problem).
我正在运行最后一个官方 wampserver,它似乎与 php7 不兼容(我在 4 台计算机上进行了一些测试,结果与我的问题相同)。
One of my colleague give me this link: http://forum.wampserver.com/read.php?1,126455with some tutorials to update wampserver to unofficial new versions. Following this indications I have updated folders wamp/scripts and wamp/lang. After that apache start normally using php 7.
我的一位同事给了我这个链接:http: //forum.wampserver.com/read.php?1,126455 以及一些将 wampserver 更新到非官方新版本的教程。按照这个指示,我更新了文件夹 wamp/scripts 和 wamp/lang。之后apache正常启动使用php 7。
PS : it seems to be some errors with certain php functions. One more fix is to update some other wampserver files, the details are on the link up. But for the moment I haven't got this errors.
PS:某些php函数似乎有一些错误。另一种解决方法是更新一些其他 wampserver 文件,详细信息在链接上。但目前我还没有遇到这个错误。
Thank you to all the people who are coming on this page and giving me some help.
感谢所有来到这个页面并给我一些帮助的人。
I hope in the future some other developers will found answers here.
我希望将来其他一些开发人员能在这里找到答案。
回答by Mwangi Thiga
回答by Ariart
I just fix the same error earlier. All links are from the french wampserver forum, maybe the same links can be find in english.
我只是更早地修复了相同的错误。所有链接均来自法语 wampserver 论坛,也许相同的链接可以在英文中找到。
First, follow all steps that are discribed here (otomatic's response, it works fine for me with the php7.0.0 release) : http://forum.wampserver.com/read.php?1,133587,133587#msg-133618
首先,按照此处描述的所有步骤进行操作(otomatic 的响应,它对我来说在 php7.0.0 版本中运行良好):http: //forum.wampserver.com/read.php?1,133587,133587#msg-133618
care about to update your wampserver version following these steps :(if you don't run a 3.0 wampserver ) http://forum.wampserver.com/read.php?1,126455
关心按照以下步骤更新您的 wampserver 版本:(如果您不运行 3.0 wampserver )http://forum.wampserver.com/read.php?1,126455
Don't forget to install all packages at step 20 (both x86 and x64) in the wampserver forum's CONSEILS DE DEPANNAGE section: forum.wampserver.com/read.php?1,88043
不要忘记在 wampserver 论坛的 CONSEILS DE DEPANNAGE 部分的第 20 步(x86 和 x64)安装所有软件包:forum.wampserver.com/read.php?1,88043
After that, some symbolic's links can be missing with a php7 dll. So, you have to add some lines in wamp/scripts/config.inc.php (view otomatic's #msg-135093 in the first link) : forum.wampserver.com/read.php?1,133587,133587#msg-133618
之后,php7 dll 可能会丢失一些符号链接。因此,您必须在 wamp/scripts/config.inc.php 中添加一些行(在第一个链接中查看 otomatic 的 #msg-135093):forum.wampserver.com/read.php?1,133587,133587#msg-133618
I hope that could help you.
我希望这可以帮助你。
回答by novecentonove
I found out the trick for the Version 3.0 + LEFT click (instead right click) to the Wamp icon tray e choose the PHP Version.
我发现了版本 3.0 + 向 Wamp 图标托盘左键单击(而不是右键单击)的技巧,然后选择 PHP 版本。