如何在 Windows 10 上升级 php 版本
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39417152/
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
How to upgrade php version on Windows 10
提问by ThomH
I'm trying to get my Laravel project to work. But when I use composer update it says the following:
我正在努力让我的 Laravel 项目工作。但是当我使用 composer update 时,它会显示以下内容:
This package requires php >=5.6.4 but your PHP version (5.5.12) does not satisfy that requirement.
此软件包需要 php >=5.6.4,但您的 PHP 版本 (5.5.12) 不满足该要求。
I'm using WAMP which runs php version 7.0.4 this is also confirmed in the browser if I echo the php version. But when I use php -vin the console it shows that I'm using PHP version 5.5.12 (cli).
我正在使用运行 php 版本 7.0.4 的 WAMP,如果我回显 php 版本,这也会在浏览器中得到确认。但是当我在控制台中使用php -v时,它显示我使用的是 PHP 版本 5.5.12 (cli)。
I've searched a bit around on google and I found out that it uses my windows PHP version instead of my webserver's version. But I couldn't find out how to update my PHP version on Windows.
我在谷歌上搜索了一下,发现它使用的是我的 Windows PHP 版本而不是我的网络服务器版本。但是我不知道如何在 Windows 上更新我的 PHP 版本。
My PATH contents are as shown in the following image
我的PATH内容如下图所示
回答by Moe Ismail Alhakeem
You can uninstall composer, and while re-installing it will ask you to point at your PHP directory which is going to be C:\wamp64\bin\php (usually) at that point you can choose which PHP version you would want to use. good luck.
您可以卸载composer,在重新安装时它会要求您指向您的PHP目录,该目录将是C:\wamp64\bin\php(通常),此时您可以选择要使用的PHP版本. 祝你好运。
回答by Huzaib Shafi
This means you have yet another installation of PHP
in your system. Check your Programs
in Control Panel
and remove such installation.
这意味着您的系统中还有另一个安装PHP
。签Programs
入Control Panel
并删除此类安装。
However, you can modify your PATH
environment variable as well. Procedure
但是,您也可以修改PATH
环境变量。程序
Just remove the path that points to any PHP
installation directory.
只需删除指向任何PHP
安装目录的路径。
Else, otherwise, if you are unsure about changing the PATH
variable (which can lead to serious problems if not set well), you can just delete the directory that the PATH
variable points to.... (I mean the PHP
directory)
否则,如果您不确定是否更改PATH
变量(如果设置不当可能会导致严重问题),您可以删除PATH
变量指向的PHP
目录......(我的意思是目录)
The totally better solution is to add the path of your PHP7
bin directory at the beginning of the PATH
variable. You should also make available composer
in this PHP7
bin directory.
更好的解决方案是PHP7
在PATH
变量的开头添加bin 目录的路径。您还应该composer
在此PHP7
bin 目录中提供。
Such as, replace the C:\php
in your path with C:\wamp\bin\php7
or whatever the location of the PHP7
path is..
例如,用C:\php
路径的C:\wamp\bin\php7
任何位置替换PHP7
路径中的 ..
回答by alexanderesmar
if you had installed before xampp/wampp and composer globally you might had added php to you environment path to call it where ever you want, and now you want that composer use the new xampp with php the you recently installed, so go to system>advance tab> environment variable> maybe in PATH then search if you have something like C:\xampp\php
and edit to your new php location.
如果您在 xampp/wampp 和 composer 全局之前安装过,您可能已经将 php 添加到您的环境路径中以在您想要的任何地方调用它,现在您希望该 composer 使用新的 xampp 和您最近安装的 php,所以转到系统>高级选项卡> 环境变量> 可能在 PATH 中,然后搜索是否有类似的内容C:\xampp\php
并编辑到新的 php 位置。
I had multiple versions off xampp for testing and composer globaly instaled for php 7.2
我有多个版本的 xampp 用于测试和 Composer globaly 为 php 7.2 安装