简体   繁体   English

在安装Laravel时获取旧的php版本

[英]Getting old php version while installing Laravel

I've installed two xampp in different drives(windows) as follow: 我已经在不同的驱动器(Windows)中安装了两个xampp,如下所示:

Drive G: xampp (php 5.6)
Drive C: xampp (php 7.2)

I've also set environmental variable to php 7 drive in PATH variable. 我还在PATH变量中将环境变量设置为php 7驱动器。 But still getting error during installing latest laravel that: 但是在安装最新的laravel期间仍然出现错误:

This package requires php >=7.0.0 but your PHP version (5.6.35) does not satisfy that requirement.

When I run following command in CMD it also shows php 5.6.3: 当我在CMD中运行以下命令时,它也会显示php 5.6.3:

php -v

System is restarted, CMD is restared, what else I missed or have to do so that I can get latest PHP version? 系统重新启动,CMD重新启动,还有什么我想念或必须做的事才能使我获得最新的PHP版本? The strange thing is that when I run php file in xampp with 7 version it shows PHP 7.2.4 in phpinfo(). 奇怪的是,当我在xampp中使用7版本运行php文件时,它在phpinfo()中显示PHP 7.2.4。

Note: I do need php 5.6 for other old projects that's why I can't delete second xampp. 注意:对于其他旧项目,我确实需要php 5.6,这就是为什么我无法删除第二个xampp的原因。

在此处输入图片说明

I am not sure which windows you are using but as i think it is window 10 我不确定您使用的是哪个窗口,但我认为这是窗口10

Make Sure you are adding PATH in your case C:\\xampp\\php in system variables instead of user variables 确保在案例C:\\xampp\\php在系统变量而不是用户变量中添加PATH

and try to run ECHO %PATH% in cmd and check if there is path added for PHP 7 not 5.6 并尝试在cmd中运行ECHO %PATH%并检查是否为PHP 7(不是5.6)添加了路径

If your using linux just update your default php 如果您使用的是Linux,则只需更新默认的PHP

sudo update-alternatives --set php /usr/bin/php7.2

If your using any other operating system then check how to set default version. 如果您使用任何其他操作系统,请检查如何设置默认版本。

For windows: 对于Windows:

Download php from http://php.net/downloads.php and extract it to C:\\xampp\\php7.2 and set this path. http://php.net/downloads.php下载php,并将其解压缩到C:\\ xampp \\ php7.2并设置此路径。

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

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