简体   繁体   English

如何将较新版本的 php 设为默认?

[英]How to enable newer version of php to be default?

I'm trying to understand how to update my php version in my machine.我正在尝试了解如何在我的机器中更新我的 php 版本。 On the CMD I tried getting the version as shown below.在 CMD 上,我尝试获取如下所示的版本。 I believe this version was installed via XAMPP but now I have uninstalled this program.我相信这个版本是通过 XAMPP 安装的,但现在我已经卸载了这个程序。 When I try to get the version again in the CMD it remains 7.2.26!当我尝试在 CMD 中再次获取该版本时,它仍然是 7.2.26!

C:\Users\name>php -v
PHP 7.2.26 (cli) (built: Dec 17 2019 15:29:44) ( NTS MSVC15 (Visual C++ 2017) x64 )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

I have downloaded a new version, hoping that it would solve it (php v.7.4.8) and added it in C:\php directory (it is the only version available) but the cmd will still return version 7.2.26!我已经下载了一个新版本,希望它能解决它(php v.7.4.8)并将其添加到C:\php目录中(它是唯一可用的版本)但 cmd 仍将返回版本 7.2.26!

Note that when I open the C:\php\php.exe and run phpinfo();请注意,当我打开C:\php\php.exe并运行phpinfo(); the version is 7.4.8.版本是 7.4.8。

My question is how to completely remove php 7.2.26 from my machine.我的问题是如何从我的机器上完全删除 php 7.2.26。 I cannot locate where it is installed!我找不到它的安装位置!

Change System Path variable of your computer which still points to the directory in which old version is installed.更改计算机的系统路径变量,该变量仍指向安装旧版本的目录。

  • Goto My Computer转到我的电脑
  • Right Click, choose Properties右键单击,选择属性
  • Select Advance System Settings Select 高级系统设置
  • Goto Advanced tab转到高级选项卡
  • Click Environment Variables.单击环境变量。
  • Double click on Path in the System Variables list双击系统变量列表中的路径
  • Remove old folder location from the Variable Value field and add new location.从变量值字段中删除旧文件夹位置并添加新位置。
  • Save Settings by clicking OKs单击确定保存设置

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

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