php 安装 XAMPP 时出错:Windows 找不到 -n
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39343698/
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
Error installing XAMPP: Windows cannot find -n
提问by chainboost
I've been trying to install XAMPP for quite some time now, but every time, at the end of the installation, it says:
我已经尝试安装 XAMPP 已经有一段时间了,但每次在安装结束时,它都会说:
Windows cannot find "-n"
Windows 找不到“-n”
And after that, it says:
在那之后,它说:
Problem running post-install step. Installation failed (php.exe) Perhaps you have to install Visual C++ 2008 package.
运行安装后步骤时出现问题。安装失败 (php.exe) 也许您必须安装 Visual C++ 2008 包。
I have Visual C++ 2008 package and it still says this. What do I do now? I have Windows 10 64-bit for anyone wondering.
我有 Visual C++ 2008 包,它仍然这么说。现在我该怎么做?我有 64 位 Windows 10 供任何想知道的人使用。
采纳答案by chainboost
I installed it in the root of my C: drive and it worked. Strange that previously I could just install it in my program files folder and that everything works...
我将它安装在我的 C: 驱动器的根目录中并且它工作正常。奇怪的是,以前我可以将它安装在我的程序文件文件夹中,并且一切正常......
回答by riorio
Had the same problem when I tried to install xampp in a folder with spaces in its name (some folder example)
当我尝试在名称中带有空格的文件夹中安装 xampp 时遇到了同样的问题(一些文件夹示例)
It was solved after I reinstalled xampp in a folder that has no space in its name, E.g. c:/xampp
我在名称中没有空格的文件夹中重新安装了 xampp 后解决了这个问题,例如 c:/xampp
回答by Jibril
Change your registry settings.
更改您的注册表设置。
- Open Registry Editor by pressing Windows+ Rkey combination, type in
regedit
and press Enter.- If prompted by UAC, click on Yes to continue.
- Go to
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
- In right-side pane, look for a
EnableLUA
and set the value to 0 and close Registry Editor.- Restart your computer.
- 按Windows+R组合键打开注册表编辑器,输入
regedit
并按 Enter。- 如果 UAC 提示,请单击是继续。
- 去
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
- 在右侧窗格中,查找 a
EnableLUA
并将值设置为 0 并关闭注册表编辑器。- 重启你的电脑。
Source:windows10update.com
Then type in XAMPP shell:
然后在 XAMPP shell 中输入:
setup_xampp.bat
回答by José Andrés
That error could be shown if you already had an older version of XAMPP installed to the default folder (C:\xampp) and you try to install a new version in a specific custom folder. Just go to the Windows Control Panel, Add or Remove programs and uninstall the old installation of XAMPP.
如果您已经将旧版本的 XAMPP 安装到默认文件夹 (C:\xampp) 并且您尝试在特定自定义文件夹中安装新版本,则可能会显示该错误。只需转到 Windows 控制面板,添加或删除程序并卸载旧的 XAMPP 安装。
回答by cg_coder
I can confirm using Windows 10, that the "Windows cannot find -n" message is indeed based on the fact that you are installing XAMPP in a folder which is not c:\xampp.
我可以确认使用 Windows 10,“Windows 找不到 -n”消息确实基于您在不是 c:\xampp 的文件夹中安装 XAMPP 的事实。
That is rather a huge oversight for those who distribute XAMPP, they should allow relative paths.
对于分发 XAMPP 的人来说,这是一个相当大的疏忽,他们应该允许相对路径。
I was trying to set XAMPP in c:\webservers\xampp\ because I'm working with multiple versions of servers for testing and development and well, there goes that idea.
我试图在 c:\webservers\xampp\ 中设置 XAMPP,因为我正在使用多个版本的服务器进行测试和开发,嗯,有这个想法。
Of course, in the end, I could always just do it myself, and get each bundle I need such as APACHE, mySQL, etc.. And that would mean, not relying on XAMPP.
当然,最后,我总是可以自己做,并获得我需要的每个包,例如 APACHE、mySQL 等。这意味着,不依赖于 XAMPP。
Anyways, it's a rather stupid flaw, but it is what it is, and it's free, so, you pay for what you get! :)
无论如何,这是一个相当愚蠢的缺陷,但它就是这样,而且它是免费的,所以,你为所得到的付出代价!:)
回答by Bram Vanroy
An alternative to the current answers: I found that installing in a folder with a dash also didn't seem to work for me. E.g. C:\xampp-test\
would still give an error. Changing it to C:\xampptest\
solved the issue.
当前答案的替代方法:我发现在带有破折号的文件夹中安装似乎对我也不起作用。例如C:\xampp-test\
仍然会出错。更改它以C:\xampptest\
解决问题。
回答by Vivek Athalye
I ran setup_xamp.bat
once (w/o admin rights) and it did some configuration for XAMPP but that did not help. When I executed setup_xamp.bat
again with admin rights, it gave a message "nothing to do!".
我跑了setup_xamp.bat
一次(没有管理员权限),它为 XAMPP 做了一些配置,但这没有帮助。当我setup_xamp.bat
再次以管理员权限执行时,它给出了一条消息“无事可做!”。
While looking at the Apache config I realized it is trying to listen on port 80and I already had IIS listening on that port. Which was causing the problem.
在查看 Apache 配置时,我意识到它正在尝试侦听端口80,而我已经让 IIS 侦听了该端口。这导致了问题。
So I changed httpd.conf
to use a different port 8765 (change needed at 2 places)
所以我改为httpd.conf
使用不同的端口 8765(需要在 2 个地方进行更改)
Also changed httpd-ssl.conf
to use a different port 8766 (change needed at 3 places)
也更改httpd-ssl.conf
为使用不同的端口 8766(需要在 3 个地方更改)
Then in XAMPP Control panel > Config > Services and Port Settings > specified same port number for Apache.
然后在 XAMPP 控制面板 > 配置 > 服务和端口设置 > 为 Apache 指定相同的端口号。
Once that was done I was able to start Apache without any error.
完成后,我就可以毫无错误地启动 Apache。