Skip to content

Commit

Permalink
Merge branch 'release/v1.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
custom-dev-tools committed Jul 2, 2021
2 parents 6d579cc + 251a122 commit 8fc1c18
Show file tree
Hide file tree
Showing 3 changed files with 273 additions and 122 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a

## [Unreleased]

## [1.3.0] - 2021-07-02

### Added
- Added ability to change PHP version within an open CMD Window session only.

### Updated
- Updated readme.md reflecting the new feature.
- Updated version number.

## [1.2.3] - 2020-08-26

### Fixed
Expand Down
37 changes: 34 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ WampServer PHP CLI Version Changer is a Microsoft Windows batch script that allo
* [How To Use](#how-to-use)
* [Text Based User Interface (TUI)](#text-based-user-interface-tui)
* [Command Line Interface (CLI)](#command-line-interface-cli)
* [Session Mode](#session-mode)
* [FAQ's](#faqs)

## Minimum Requirements
Expand All @@ -26,7 +27,7 @@ The following are required for the CLI Changer script to function correctly.

No installation is required.

At just over 10kB the CLI Changer script is small enough to be saved anywhere in your file system.
At just over 13KB the CLI Changer script is small enough to be saved anywhere in your file system.

**Tip:** Once you have save the CLI Changer script, create a desktop shortcut to it for quick and easy access.

Expand All @@ -51,6 +52,7 @@ rem | User Defined Variable(s) |
rem +------------------------------------------------+
rem WampServer custom install path.
rem Note: Trailing slash is not required.
set $customInstallPath=D:\WampServer 64-Bit
```

Expand All @@ -62,6 +64,7 @@ There are two ways you can use the CLI Changer script.

* Text based user interface (TUI).
* Command line interface (CLI).
* Session mode

### Text Based User Interface (TUI)

Expand Down Expand Up @@ -128,6 +131,31 @@ Following execution, an exit code will be given:

**Tip:** Calling scripts via the command line is common during (automated) development, testing and deployment. EG: Incorporate it into your build files...

#### Session Mode

Should you have the need to only change the PHP version number within an open command window (session) and not across your whole system then you can use the `--temp` option.

From a CMD prompt:
```
C:\>: "C:\path\to\cli_changer.bat" php7.2.3 --temp
```

From a Bash or Powershell prompt:
```
$ start "C:\path\to\cli_changer.bat" php7.2.3 --temp
```

The short command line option `-t` is also available.

**Note:** Enclosing the script path in quotes if it contains spaces and knowing the available PHP CLI version(s) in advance is still required.

Following execution, an exit code will be given:

- `0` - Success
- `1` - Failure

**Note:** Using the `--temp` or `-t` option will only change the PHP version number within that command window. Multiple command windows can be open and the PHP version number changed without affecting other open command windows.

## FAQ's

### What are environment path variables and how do they work?
Expand All @@ -136,11 +164,14 @@ Environment 'path' variables allow the user (and system) to call an executable w

When the user (or the user's script) calls `php` or `php.exe`, 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.

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.
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 (or the cmd window 'session' path) prior to appending the selected PHP version path.

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.

Both the environment 'user' and 'system' paths can be accessed by clicking 'Start' -> 'Control Panel' -> 'System' -> 'Advanced system settings' -> 'Environment Variables...'
Access the environment 'user' and 'system' paths by:

* Windows 7: Clicking 'Start' -> 'Control Panel' -> 'System' -> 'Advanced system settings' -> 'Environment Variables...'
* Windows 10: Clicking 'Start Search' -> Type 'env' -> Click the result 'Edit system environment variables' -> 'Environment Variables...'

### How do I remove the error at the bottom of the WampServer right-click menu?

Expand Down
Loading

0 comments on commit 8fc1c18

Please sign in to comment.