what's wrong with adding the WAMP's PHP to PATH?
Posted by: arvil (120.29.100.---)
Date: January 19, 2019 04:39PM

Hello,

I was always bothered by this Wamp message:


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.


I wish to use Wamp's PHP in cli, so I add it. But I do not understand if that WAMP notice is telling me there's a better way to do it? or is it something that we should avoid and use a different PHP executable that should be added to $PATH

Regards,

Options: ReplyQuote
Re: what's wrong with adding the WAMP's PHP to PATH?
Posted by: RiggsFolly (Moderator)
Date: January 19, 2019 05:28PM

The basic reason is that as WAMPServer can have multiple versions of PHP installed, you can use any of them from the CLI.

If you put ONE of the PHP versions on the PATH, when you want to use another version in a week/month/year from now, most people will forget that they put one on the PATH and then complain that they cannot use the version of PHP in the CLI that they want to.

So we suggest you do not put any version of PHP on the PATH.

I answered this on StackOverflow and provided a suggested bat file to use from the command line to temporarily add any version of PHP that may be installed in WAMPServer.
Please have a look at that

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.1.7 32bit & 64bit)
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 6.3.10>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your MySQL databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: what's wrong with adding the WAMP's PHP to PATH?
Posted by: aleangelico (63.245.105.---)
Date: February 04, 2019 03:41PM

for many frameworks (Laravel for instance) you need to run command line tools constantly. I think your solution in StackOverflow could be implemented directly from WAMP. Every time the php version is changed from the wamp tool, just change the path. If this is not possible, then you can create and modify a "php" script in a folder in the path, so when running "php" this will run the script.

Example:

1. Add a folder d:\wamp64\scripts to the path
2. Change php version from WAMP tool
3. the change automatically modifies "php.cmd" with a line like:
D:\wamp64\bin\php\php7.2.10\php.exe


this way, everytime I change the php version, i have the right php in the command line.

Options: ReplyQuote
Re: what's wrong with adding the WAMP's PHP to PATH?
Posted by: RiggsFolly (Moderator)
Date: February 04, 2019 04:33PM

Hi,

But then you would not be able to sit at a command prompt and test a script against 3/4/5/6 different versions of PHP with a flick of the wrist smiling smiley

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.1.7 32bit & 64bit)
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 6.3.10>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your MySQL databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: what's wrong with adding the WAMP's PHP to PATH?
Posted by: Otomatic (Moderator)
Date: February 05, 2019 09:09AM

Hi,

> Every time the php version is changed from the wamp tool, just change the path.
> If this is not possible, then you can create and modify a "php" script in a folder in the path,
> so when running "php" this will run the script.

I don't understand why the members of the "Coulda Shoulda Woulda" tribe haven't done it yet.

------------------------------------------------------------------------------------------------------------
Wampserver 3.1.7 32 bit - Apache 2.4.38 - PHP 7.3.2/7.2.15/7.1.26/7.0.33/5.6.40 - MySQL 5.7.25 - MariaDB 10.3.12
Wampserver 3.1.7 64 bit - Apache 2.4.38 - PHP 7.3.2/7.2.15/7.1.26/7.0.33/5.6.40 - MySQL 5.7.25/8.0.14 - MariaDB 10.3.12
PhPMyadmin 4.8.5 - MysqlDumper 1.24.5
on W10 and W7 Pro 64 bit
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons
« Ce n'est pas parce qu'ils sont nombreux à avoir tort, qu'ils ont forcément raison. Coluche »
« It's not because they are many to be wrong, they are necessarily right. Coluche »

Options: ReplyQuote


Sorry, only registered users may post in this forum.