PHP(CLI)版本与我安装的XAMPP版本不匹配 [英] PHP (cli) version doesn't match XAMPP version I installed
问题描述
最近,我在Windows 7计算机上安装了XAMPP以便进行本地开发.老实说,我认为根本没有安装过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,这有关吗?).我也不明白为什么XAMPP应该安装另一个版本时,我的CLI为什么报告一个版本.我想念什么吗?我需要为最新版本的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屋!