本文介绍了WAMP 服务器在 Windows 10 上无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚将操作系统升级到 Windows 10,但遇到了一个非典型问题.我使用 WAMP 服务器并且 PHP 不起作用,尽管在任何地方都没有显示错误.

我尝试更新 vcredist 或更改端口,但问题仍然存在.

解决方案

Windows 10 并未安装所有较旧的 MSVC 运行时.

您还必须安装缺少的任何一个.

VC2017 (VC15) 向后兼容 VC2015 (VC14).这意味着,可以在 VC15 二进制文件中使用 VC14 模块.因为这个兼容性Redistributable的版本号是14.1x.xx,在你安装了Redistributable VC2017之后,VC2015被移除了,但是你仍然可以使用VC14.

2017 年 4 月更新

大多数 MSVC 运行时现在都可用 来自这个微软页面

您实际需要运行 WAMPServer 或 Aapche 的上述哪个版本将取决于您运行的 WAMPServer 版本,但安装所有这些版本不会造成任何伤害,因为它们已被任何已编译的软件使用使用 Microsoft 编译器.

如果您在 Windows 10 64 位上使用 WAMPServer 64 位,则需要安装这些库的 32 位和 64 位版本.

在检查您拥有所有运行时库之后,不幸的是,有时您可能还需要重新安装 Apache 和 MYSQL 服务以升级到 Windows 10(几乎总是)错过了一个事实,即您有 2 个正在运行的服务,升级后应该更换它们,即 wampapachewampmysqld

您需要做的就是使用 wampmanager 菜单系统执行此操作:

左键点击 wampmanager ->阿帕奇->服务 ->安装服务左键单击 wampmanager ->MySQL ->服务 ->安装服务

然后

左键点击 wampmanager ->启动所有服务

其他信息

还要记住,要解释 PHP,代码必须存在于具有 .php 扩展名的文件中.如果您使用 notepad 作为编辑器,则会在文件名中添加 .txt,因此如果您保存 tst.php,它实际上会保存为 tst.php.txt,因此不会运行.得到一个像样的编辑器 notepad++ 会做得很好,而且是免费的.

还有包含 php 代码的 .html.htm 文件将不会执行 php 代码,因为这些文件不会传递给 PHP 解释器,因为它们不会有 .php 扩展名.

使用资源管理器

不要在 Windows 资源管理器中双击脚本文件名.这适用于测试纯 HTML 页面或 HTML + Javascript 页面,但如果页面中有 PHP 代码则不起作用但是这样做不是通过 Apache 进行的,而是 Apache 看到的是<?php 标记,因此知道将此代码传递给 PHP 解释器.

你必须在浏览器地址栏中输入脚本文件名,就好像它是一个真实的网站一样,因为它当然是

例如localhost/project1/test.php

I just upgraded my OS to Windows 10 and I have an atypical problem.I use WAMP server and PHP doesn't work, although no error is displayed anywhere.

I tried to update vcredist or to change ports, but the problem persists.

解决方案

Windows 10 does not come with all the older MSVC Runtimes installed.

You will also have to install any of these that are missing.

VC2017 (VC15) is backward compatible to VC2015 (VC14). That means, a VC14 module can be used inside a VC15 binary. Because this compatibility the version number of the Redistributable is 14.1x.xx and after you install the Redistributable VC2017, VC2015 is removed but you can still use VC14.

UPDATE April 2017

Most of the MSVC runtimes are now available from this microsoft page

Which versions of the above you actually need to run WAMPServer, or rather Aapche, will depend upon the version of WAMPServer you are running, but installing all of them can do no harm as they are used by any software that has been compiled with the Microsoft compilers.

If you are using WAMPServer 64bit on Windows 10 64bit, you will need to install BOTH the 32 and 64bit versions of these libraries.

After you have checked you have all the runtime libraries, you may also need to re-install the Apache and MYSQL services as the upgrade to Windows 10 unfortunately sometimes (pretty much always) misses the fact that you have 2 services running that should be replaced after the upgrade i.e. wampapache and wampmysqld

All you need to do is, using the wampmanager menus system do this :

left click wampmanager -> Apache -> Services -> Install Service

left click wampmanager -> MySQL -> Services -> Install Service

Then

left click wampmanager -> Start All Services

Additional info

Also remember that for PHP to be interpreted, the code must exist in a file with a .php extension. If you are using notepad as an editor, that will add a .txt to a filename, so if you save tst.php it will actually get saved as tst.php.txt and therefore will not run. Get a decent editor notepad++ will do a great job and is free.

Also files with the .html or .htm that contain php code will not execute the php code as these files are not passed to the PHP interpreter, because they dont have the .php extension.

Using Explorer

Dont double click on the script file name in Windows Explorer. This works to test pure HTML pages, or HTML + Javascript pages, but it does not work if the page has PHP code in it However doing this does not go via Apache, and it is Apache that see's the <?php tags and therefore know to pass this code to the PHP interpreter.

You must enter the script file name into the browser address bar, as if it were a real web site, because of course it is

For example localhost/project1/test.php

这篇关于WAMP 服务器在 Windows 10 上无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 09:53