Wamp 3.1.3 Windows Environment PATH conflict [duplicate]

对着背影说爱祢 提交于 2020-01-04 06:27:49

问题


I just installed Wamp 3.1.3, and then installed composer.

The composer added the path to php.exe to windows environment variables. But now Wamp shows error in context menu , that when clicked shows this message:

There is an error.

There is Wampserver path (c:/wamp64) into Windows PATH environnement variable: (C:\wamp64\bin\php\php7.2.4)

It seems that a PHP installation is declared in the environment variable PATH C:\wamp64\bin\php\php7.2.4

Wampserver does not use, modify or require the PATH environment variable. Using a PATH on Wampserver or PHP version is detrimental to the proper functioning of Wampserver.

Now if I remove the path, wamp is happy, but composer would complain that php is not recognized program, and otherwise composer works but wamp complains to remove the path.

Any workaround?


回答1:


Install the Composer manually:

Create bat script called composer.bat inside any directory within the PATH so it's system wide containing:

@C:\your\absolute\path\to\php.exe "%~dp0composer.phar" %*

Next time you change PHP simply update the path. Or you can have multiple scripts like composer-php6, composer-php7 etc. calling multiple php versions. Just remember to put the composer.phar alongside your batch script.

No need to update the PATH at all. Good luck.



来源:https://stackoverflow.com/questions/50385922/wamp-3-1-3-windows-environment-path-conflict

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!