简体   繁体   English

无法使用Apache 2.4从PHP5切换到PHP7

[英]Unable to switch from PHP5 to PHP7 using Apache 2.4

I recently downloaded the latest version of AppServ ( Appserv8 ) for Windows. 我最近下载了适用于Windows的最新版AppServ( Appserv8 )。 It installs Apache 2.4 , MySQL 5.7 and both version of PHP5 and PHP7 . 它安装Apache 2.4MySQL 5.7以及PHP5PHP7两个版本。 After installing, the used version of PHP is 5. 安装后,使用的PHP版本为5。

I've tried to switch the version using the script " PHP Version Switch " provided with the installation but it seems not working. 我尝试使用随安装提供的脚本“ PHP Version Switch ”来切换版本,但它似乎无法正常工作。

I've tried to manually edit the http.conf file in Apache24 folder but without results. 我试图手动编辑http.conf文件Apache24文件夹,但没有结果。

With these lines Apache starts normally with PHP5: 使用这些行,Apache通常使用PHP5启动:

LoadModule php5_module C:/AppServ/php5/php5apache2_4.dll
PHPIniDir "C:/AppServ/php5/"

If I edit with: 如果我编辑:

LoadModule php7_module C:/AppServ/php7/php7apache2_4.dll
PHPIniDir "C:/AppServ/php7/"

When I try to start Apache, I obtain the following error: 当我尝试启动Apache时,我收到以下错误:

httpd.exe: Syntax error on line 180 of C:/Appserv/Apache24/conf/httpd.conf: Cannot load C:/Appserv/php7/php7apache2_4.dll into server: Impossibile trovare il modulo specificato.

(Part of the error is in italian: unable to find the specified module) (部分错误是意大利语:无法找到指定的模块)

Note that the dll is in the folder as specified in the path. 请注意,dll位于路径中指定的文件夹中。 I'm stuck with this error and I don't know where I have to modify configuration file (if is this the problem). 我坚持这个错误,我不知道我在哪里修改配置文件(如果这是问题)。

EDIT1: Somewhere I've found this discussion in which the author explain that, because of a dependencies of Visual C++, the DLL can be not readable. EDIT1:在某个地方我发现了这个讨论 ,其中作者解释说,由于Visual C ++的依赖性,DLL可能无法读取。 I checked my system, I cleaned it from multiple installation of Microsoft Visual C++ redistributable and I tried to install x64 or x86 versions. 我检查了我的系统,我从多个Microsoft Visual C ++可再发行组件安装中清除它,我尝试安装x64或x86版本。

With the x86 version, I have the previous problem. 使用x86版本,我遇到了上一个问题。 With the x64 version, I can't start Apache because of a missing dll: it should be because apache is x86 version (I'm not sure of this). 使用x64版本,由于缺少dll,我无法启动Apache:应该是因为apache是​​x86版本(我不确定)。

EDIT2: As suggested from @chugadie, I tried to use dependencywalker to trace dependencies. EDIT2:正如@chugadie所建议的,我试图使用dependencywalker来跟踪依赖关系。 I found several missing files with prefix API-MS-WIN-CRT . 我找到了几个带有前缀API-MS-WIN-CRT丢失文件。 Now I'm trying to fix but I have several problems with dll which are x86 and x64. 现在我正在尝试修复但是我有几个问题,dll是x86和x64。 I think the best way is to reinstall all components in x64 architecture. 我认为最好的方法是在x64架构中重新安装所有组件。

Any help is very appreciated. 非常感谢任何帮助。

On AppServ folder on Start Menu (or Win Key + S) you must sear for PHP Version Switch and it will request admin privileges (if you deny it, it won't work), then it will show a cmd console rquesting you the PHP version to set on Apache, press 7 to switch PHP 7 or press 5 to switch PHP5. 在开始菜单(或Win键+ S)上的AppServ文件夹上,您必须为PHP版本开关搜索并且它将请求管理员权限(如果您拒绝它,它将无法工作),那么它将显示一个cmd控制台,请求您使用PHP要在Apache上设置的版本,按7切换PHP 7或按5切换PHP5。

If you did this and it won't work you should undo changes you did it on AppServ files. 如果您这样做并且它将无法工作,您应该撤消在AppServ文件上执行的更改。

I had the same problem with happy end. 幸福的结局让我遇到了同样的问题。 My solution: 我的解决方案

  1. Install https://www.microsoft.com/en-hk/download/details.aspx?id=40784 安装https://www.microsoft.com/en-hk/download/details.aspx?id=40784
  2. When you install appserv you will see the "Visual C ++ Redistributable" window then push "uninstall" button. 安装appserv时,您将看到“Visual C ++ Redistributable”窗口,然后按“卸载”按钮。
  3. You Install appserv and finish. 您安装appserv并完成。

Arrivederci e buona fortuna. Arrivederci e buona fortuna。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM