PHP (cli) 版本与我安装的 XAMPP 版本不匹配 [英] PHP (cli) version doesn't match XAMPP version I installed

查看:14
本文介绍了PHP (cli) 版本与我安装的 XAMPP 版本不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我安装了 XAMPP 用于在我的 Windows 7 机器上进行本地开发.老实说,我根本不认为 PHP 是事先安装的.我安装了最新版本的 XAMPP 并配置为 php 5.6.24.我创建了一些虚拟主机,一切似乎都正常.

Recently I installed XAMPP for doing local development on my Windows 7 machine. I honestly didn't think PHP was installed at all before hand. I installed the latest version of XAMPP and configured for php 5.6.24. I created some virtual hosts and everything seemed to work.

我遇到了一个问题,我需要确认我使用的是哪个版本的 PHP,所以我打开了我的命令行并输入了 php -v.出于某种原因,它报告我正在使用 PHP 5.4.25.确切的行是 PHP 5.4.25 (cli) (built: Feb 5 2014 21:19:58)

I was having an issue and I needed to confirm which version of PHP I was using so I opened up my command line and typed php -v. For some reason it is reporting I'm using PHP 5.4.25. The exact line is PHP 5.4.25 (cli) (built: Feb 5 2014 21:19:58)

我不记得使用过这个版本(我最近安装了 Visual Studio Community,这有关系吗?).我也不明白为什么我的 CLI 报告一个版本,而 XAMPP 应该安装了另一个版本.我错过了什么吗?我需要为最新版本的 Grav CMS 运行一些 gpm 命令,但是当我这样做时,它说它至少需要 5.5.9.

I don't recall using this version (I had Visual Studio Community installed recently, is that related?). I don't understand either why my CLI is reporting one version, when XAMPP supposedly installed another version. Am I missing something? I need to run some gpm commands for the latest version of Grav CMS but when I do it says it required at least 5.5.9.

推荐答案

可以安装多个版本的php.

It is possible to have multiple versions of php installed.

您需要确保您正在执行 XAMPP 附带的 php-cli.

You will want to ensure that you are executing the php-cli that came with XAMPP.

听起来您安装了另一个版本的 php,并且在您的 PATH 中,因此当您运行 php 时,该版本会被加载.

It sounds like you have another version of php installed and is in your PATH so that when you run php that version is loaded.

您可以使用 where 命令找出正在加载的文件.从终端类型:where php

You can use the where command to find out what file is being loaded. From the terminal type: where php

  • 我不是 windows 人,但在 linux 上有一个 which 命令.显然这是windows的命令.这是关于它的SO帖子:在Windows 命令行?
  • I am not a windows guy but there is a which command on linux. Apparently this is the command for windows. Here is a SO post about it: Is there an equivalent of 'which' on the Windows command line?

无论如何,您可能希望删除该 php 文件并可能在其位置为 XAMPP 版本的 php-cli

Anyways, you may want to remove that php file and possibly create a symbolic link in its place for the XAMPP version of php-cli

如果您删除/重命名文件并且新的 php-cli 不在您的路径中,您可能会收到错误,因为系统不知道 php 是什么是.

If you remove/rename the file and the new php-cli is not in your path, you will probably get an error as the system will not know what php is.

这篇关于PHP (cli) 版本与我安装的 XAMPP 版本不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆