You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[](https://github.com/midnight-coding/grunt-cache-killer/commits/master)
9
+
[](https://github.com/midnight-coding/WampServer-PHP-CLI-Version-Changer/issues?q=is%3Aopen+is%3Aissue)
WampServer PHP CLI Version Changer is a Microsoft Windows batch script that allows you to easily change between installed WampServer PHP CLI versions using the users environmental path.
3
13
14
+
## Table Of Contents
15
+
16
+
*[Minimum Requirements](#minimum-requirements)
17
+
*[Installation](#installation)
18
+
*[Configuration](#configuration)
19
+
*[How To Use](#how-to-use)
20
+
*[Text Based User Interface (TUI)](#text-based-user-interface--TUI-)
21
+
*[Command Line Interface (CLI)](#command-line-interface--CLI-)
22
+
*[FAQ's](#faq-s)
23
+
4
24
## Minimum Requirements
25
+
5
26
The following are required for the CLI Changer script to function correctly.
6
27
- Microsoft Windows 7 and up.
7
28
- WampServer v3.0.0 and up.
8
29
9
30
## Installation
31
+
10
32
No installation is required.
11
33
12
-
At just over 7kB the CLI Changer script is small enough to be saved anywhere in your file system.
34
+
At just over 10kB the CLI Changer script is small enough to be saved anywhere in your file system.
13
35
14
36
**Tip:** Once you have save the CLI Changer script, create a desktop shortcut to it for quick and easy access.
15
37
16
38
## Configuration
39
+
17
40
No configuration is necessary if your installed WampServer in its default directory.
18
41
19
42
The default installation directories are:
@@ -24,7 +47,7 @@ If you installed WampServer in a custom directory, then follow the steps below:
24
47
25
48
1. Open the CLI Changer script in your preferred text editor.
26
49
2. Append your custom install path to the `$customInstallPath` variable.
27
-
3. Save the file and close your editor.
50
+
3. Save the file and close your text editor.
28
51
29
52
Example: A customised WampServer install path.
30
53
```
@@ -39,12 +62,14 @@ set $customInstallPath=D:\WampServer 64-Bit
39
62
**IMPORTANT:** Do not add quotation marks around your custom installation path, even if the path contains spaces.
40
63
41
64
## How To Use
65
+
42
66
There are two ways you can use the CLI Changer script.
43
67
44
68
* Text based user interface (TUI).
45
69
* Command line interface (CLI).
46
70
47
71
### Text Based User Interface (TUI)
72
+
48
73
Upon running the CLI Changer script you will be presented with a numbered list of installed PHP versions that you can select from.
49
74
50
75
The exact list of installed PHP CLI versions is dependent on what you currently have in your WampServer PHP addon folder.
@@ -84,6 +109,7 @@ To exit the CLI Changer script without making any changes just press the ENTER k
84
109
Should you make an invalid selection or should the selection be the same as the currently selected version then you will receive feedback indicating so.
85
110
86
111
### Command Line Interface (CLI)
112
+
87
113
To update the PHP CLI version number directly from the command line, you can pass in the desired PHP version via the scripts first argument. This will bypass the selection screen and go straight to setting the desired version number.
88
114
89
115
From a CMD prompt:
@@ -108,7 +134,21 @@ Following execution, an exit code will be given:
108
134
**Tip:** Calling scripts via the command line is common during (automated) development, testing and deployment. EG: Incorporate it into your build files...
109
135
110
136
## FAQ's
137
+
138
+
### How does the environment 'user' and 'system' path variables work?
139
+
140
+
Environment 'path' variables allow the user (and system) to call an executable without the need to use the executables absolute (full) path. Windows parses the path variables from left to right, with the 'user' path being appended to the 'system' path. (IE: path = system.path + user.path)
141
+
142
+
When the user (or the user's script) calls the `php.exe` executable, the path pointing to the executable will be used. If an environment path contains two or more paths to a PHP executable, then only the first one found is executed. The other php executables will never be called, ever.
143
+
144
+
Based on this information and pursuant to the successful selection of a PHP version number, this script scans and then removes any and all reference to any php executable path(s) found within the environment 'user' path prior to appending the selected PHP version path.
145
+
146
+
The PHP CLI version number returned by typing `php -v` at the command prompt should be the same as that selected by you when using this script. If it is not, there is a strong chance that there is reference to a PHP executable within the environment 'system' path. To correct this situation, you must remove this reference from the environment 'system' path manually.
147
+
148
+
Both the environment 'user' and 'system' paths can be accessed by clicking 'Start' -> 'Control Panel' -> 'System' -> 'Advanced system settings' -> 'Environment Variables...'
149
+
111
150
### How do I remove the error at the bottom of the WampServer right-click menu?
151
+
112
152
As of WampServer v3.1.2 the below error message may be displayed.
113
153
114
154
```
@@ -137,11 +177,17 @@ Press ENTER to continue...
137
177
138
178
This error can be suppressed by right-clicking the WampServer icon in the taskbar notification area and selecting: _Wamp Settings -> Do not verify PATH_
139
179
140
-
**Question 1:** Why would you want to suppress this error? Because currently, WampServer does not have the ability to change the CLI version of PHP should your script(s) require a specific version.
180
+
#### Why would you want to suppress this error?
181
+
182
+
Because currently, WampServer does not have the ability to change the CLI version of PHP should your script(s) require a specific version.
183
+
184
+
#### But isn't that what right-clicking the WampServer icon in the taskbar notification area and selecting: _Tools -> Change PHP CLI version_ does?
185
+
186
+
No, it doesn't. This selection currently changes the CLI version that the _WampServer's scripts use_, not what your scripts use when called from the command line.
141
187
142
-
**Question 2:** But isn't that what right-clicking the WampServer icon in the taskbar notification area and selecting: _Tools -> Change PHP CLI version_ does? No, it doesn't. This selection currently changes the CLI version that the _WampServer's scripts use_, not what your scripts use when called from the command line.
188
+
#### So can I safely use this script?
143
189
144
-
**Question 3:** So can I safely use this script? Currently, yes (but this may change if WampServer decides in the future to begin using either or both of your systems environmental path variables).
190
+
Currently, yes (but this may change if WampServer decides in the future to begin using either or both of your systems environmental path variables).
145
191
146
192
### How do I add more PHP versions?
147
193
To add more PHP versions to your WampServer v3 installation visit [SourceForge](https://sourceforge.net/projects/wampserver/files/WampServer%203/WampServer%203.0.0/Addons/Php/).
0 commit comments