如何更改作曲家使用的PHP版本 [英] How to change PHP version used by composer

查看:61
本文介绍了如何更改作曲家使用的PHP版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

除了要使用WAMP (2 PHP version installed)已安装的版本外,我想在我的计算机上使用另一个版本的php.

I want to use another php version on my machine than the one already installed using WAMP (2 PHP version installed).

  • 安装的作曲家使用PHP 5.6
  • 新项目需要PHP7.0.
  • The composer installed uses PHP 5.6
  • A new project requires PHP7.0.

每当我从WAMP的控制面板中选择PHP 7,然后运行php -v时,它仍会打印PHP5.6 (CLI)...而不是PHP7.

Whenever I choose PHP 7 from the control panel of WAMP and then run php -v it still printing PHP5.6 (CLI)... instead of PHP7.

如何在不重新安装作曲家的情况下使用PHP7?

How can I use PHP7 without reinstalling the composer again?

推荐答案

您可以在不卸载composer的情况下更改其php版本,请按照以下步骤操作:

You can change php version of composer without uninstalling it, follow these steps :

  1. 在cortana中搜索系统环境变量.
  2. 单击环境变量"按钮.
  3. 在系统变量"下,选择路径,然后单击编辑",您将看到一个类似"C:\ wamp \ bin \ php \ php5.6.13"的条目.
  4. 只需将其更改为位于wamp/bin/php7.1.9处的php的文件夹名称,此处php7.1.9为文件夹名称.
  5. 用bin7.1.9替换php5.6.13,它将看起来像"C:\ wamp \ bin \ php \ php7.1.9",只需在所有复选框上单击确定"即可.
  6. 您完成了.
  7. 要进行验证,首先关闭所有cmd窗口,然后打开cmd并键入php -v,按Enter键,您应该会看到php7.1.9.
  8. 如果您没有看到php版本的变化,而只是重新启动PC并在cmd中再次运行php -v,它将起作用.
  1. Search for system environment variables in cortana.
  2. Click on the button "Environment variables".
  3. Under "System variables" select path and click on edit, you will see one entry like this "C:\wamp\bin\php\php5.6.13".
  4. Just change this to the folder name of the php located at your wamp/bin/php7.1.9, here php7.1.9 is folder name.
  5. Replace php5.6.13 with bin7.1.9, it will look like these "C:\wamp\bin\php\php7.1.9", just click ok on all the boxes.
  6. You are done.
  7. To verify, first close all the cmd windows, than open cmd and type php -v, press enter and you should see php7.1.9.
  8. If you don't see change in php version than just restart your pc and run php -v again in cmd , it will work.

这篇关于如何更改作曲家使用的PHP版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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