本文介绍了如何更改作曲家使用的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 :
- 在cortana中搜索系统环境变量.
- 单击环境变量"按钮.
- 在系统变量"下,选择路径,然后单击编辑",您将看到一个类似"C:\ wamp \ bin \ php \ php5.6.13"的条目.
- 只需将其更改为位于wamp/bin/php7.1.9处的php的文件夹名称,此处php7.1.9为文件夹名称.
- 用bin7.1.9替换php5.6.13,它将看起来像"C:\ wamp \ bin \ php \ php7.1.9",只需在所有复选框上单击确定"即可.
- 您完成了.
- 要进行验证,首先关闭所有cmd窗口,然后打开cmd并键入
php -v
,按Enter键,您应该会看到php7.1.9. - 如果您没有看到php版本的变化,而只是重新启动PC并在cmd中再次运行
php -v
,它将起作用.
- Search for system environment variables in cortana.
- Click on the button "Environment variables".
- Under "System variables" select path and click on edit, you will see one entry like this "C:\wamp\bin\php\php5.6.13".
- 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.
- 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.
- You are done.
- To verify, first close all the cmd windows, than open cmd and type
php -v
, press enter and you should see php7.1.9. - 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版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!