2

When I start wamp it shows me this error about the PHP path but I don't even have this PHP version on my computer.

Sorry,

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.


Press ENTER to continue...

This are the versions that I have installed: 5.6.38, 7.0.32, 7.1.22, 7.2.10

I've already tried uninstalling and installing wamp again (even upgraded to the newest version), but still get the same error.

I've also already tried changing the Environment Variables PHP path like how it is suggested in this question I am getting error in wamp for PHP in path and it didn't work.

I can access the localhost page, the phpmyadmin page, everything seems to work fine but I keep getting this error.

EDIT: I don't understand why this was marked as duplicate. This question was about runing php from command line, mine was about an error, that just so happen to be about php and wamp as well. It has nothing to do with my question at all, and didn't answer any questions I might still have had.

  • I don't understand why this was marked as duplicate. That question was about runing php from command line, mine was about an error, that just so happen to be about php and wamp as well. It has nothing to do with my question at all, and didn't answer any questions I might have had. – cantthinkofone Feb 05 '19 at 14:51

3 Answers3

2

I fixed it on my own.

I unistalled wamp, deleted the php path (like it says to do on the question I linked above), installed wamp again and then added back the php path (I don't think you have to do this last step, but I did it anyway. It was there, there might be a reason why? edit: it's there because composer needs it).

At first it still wasn't working. I had visual code opened when I did this because I was trying to roll back some migrations I had made before this error, but it was giving me another error (php command not found, or something like that), so I closed visual code, opened it again and it was working. edit: again, composer. I guess because I hadn't closed it, it didn't recognised I had added it back, but this error was because of composer

I still don't know what caused this error, since it was working the last time I checked, with no errors and I didn't change anything, but at least it's fixed.

I don't know if this was the best solution, but I hope it can help someone who is in the same situation as me!

Edit: I know wamp doesn't need the path, but from what I've read and from this experience, composer does.

2

WAMPServer does not set the PATH to contain a reference to it's potentially multiple versions of PHP and warns you with the error above that there is a potentially confusing situation on your system if it finds that someone has.

The confusion being that when you run the PHP CLI (Command Line Interface) you will be running the version of PHP referenced in the PATH environment variable. Remember this is only affecting the PHP CLI and not the version of PHP that runs with Apache!


Ok so why is it on the PATH anyway?

  1. If people have attempted to install Apache and PHP manually the install of a Windows Standalone PHP will add the folder containing that version of PHP to the PATH.

  2. You may have followed some bad advice and added a version of WAMPServers own PHP versions to the PATH.


What you should do to remove this error

All you need to do is remove ANY reference to ANY folder that contain a PHP executable from your Windows PATH environment variable.

Look at System Properties Heres how to get to those

So how do you run the PHP CLI for any version of PHP installed in WAMPServer

Here is How I do it, the batch file also includes using Composer and even PEAR is you want to. Amend that to suite you situation.

Community
  • 1
  • 1
RiggsFolly
  • 83,545
  • 20
  • 96
  • 136
  • Actually, I tried deleting the path too, and it didn't work. – cantthinkofone Oct 24 '18 at 11:50
  • PATH can be stored in 2 places. Did you check both? – RiggsFolly Oct 24 '18 at 11:51
  • +RiggsFolly I checked the one I linked above. The environment variable path that contained php, there were two path variables but only one had the php path. I deleted it, didn't work, so I added the one I was using and the error disappeared – cantthinkofone Oct 24 '18 at 11:55
  • No, you need to check for any OTHER references to a folder that may contain a `php.exe` Like I said WAMPServer does not add to the PATH so something else must have – RiggsFolly Oct 24 '18 at 11:56
  • +RiggsFolly ok but were? You only talked about environment variables, I checked those. – cantthinkofone Oct 24 '18 at 12:02
1

Wampserver decries it as error. But it's clearly more of a bug.

  • It's just a warning, that you can (and probably should) disable.

  • Wampserver insisting on managing the available PHP versions might be the proper thing to do from their perspective. It shouldn't prevent you from utilizing proper OS lookup features and having a shortcut to PHP CLI however.

  • The message itself, btw

    […]
    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.

    is pretty vague as to how exactly it is "detrimental". Wether Wampserver uses mod_php or FPM shouldn't be affected by a PATH setting. It would be an issue with old-school CGI setups (but nobody is doing that anymore).

    It's kinda bonkers that the message first claims that the environment variable is not used and required, but then goes off to make it sound harmful (without mentioning the concrete conflict).

  • Alternatively you can of course set up the recommended batch wrapper, and remove the versioned folder from your system environment PATH.

See also: http://forum.wampserver.com/read.php?2,151286,151424#msg-151425

mario
  • 138,064
  • 18
  • 223
  • 277