Skip to content

Commit ec73542

Browse files
committed
[minor] Minor changes in README.md
1 parent c7e3c90 commit ec73542

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ This repository contains a PowerShell module that implements functions to instal
1010
## Installation
1111

1212
You'll need at least PowerShell version 5: in order to determine which version you have, open PowerShell and type:
13+
1314
```powershell
1415
$PSVersionTable.PSVersion.ToString()
1516
```
@@ -88,26 +89,34 @@ It's often handy to be able to use different PHP versions for different projects
8889
For instance, sometimes you may want that `php.exe` is PHP 5.6, sometimes you may want that `php.exe` is PHP 7.2.
8990
This module let's you easily switch the *current* PHP version (that is, the one accessible without specifying the `php.exe` path) with the concept of **PHP Switcher**.
9091
First, you install the PHP versions you need:
92+
9193
```powershell
9294
Install-Php -Version 5.6 -Architecture x86 -ThreadSafe $true -Path C:\Dev\PHP5.6 -TimeZone UTC
9395
Install-Php -Version 7.2 -Architecture x86 -ThreadSafe $true -Path C:\Dev\PHP7.2 -TimeZone UTC
9496
```
97+
9598
Then you initialize the PHP Switcher, specifying where the *current* PHP version should be available:
99+
96100
```powershell
97101
Initialize-PhpSwitcher -Alias C:\Dev\PHP -Scope CurrentUser
98102
```
103+
99104
Then, you can add to the PHP Switcher the PHP versions you installed:
100105
```powershell
101106
Add-PhpToSwitcher -Name 5.6 -Path C:\Dev\PHP5.6
102107
Add-PhpToSwitcher -Name 7.2 -Path C:\Dev\PHP7.2
103108
```
109+
104110
You can get the details about the PHP Switcher configuration with the `Get-PhpSwitcher` command:
111+
105112
```powershell
106113
Get-PhpSwitcher
107114
(Get-PhpSwitcher).Targets
108115
```
116+
109117
Once you have done that, you can switch the current PHP version as easily as calling the `Switch-Php` command.
110118
Here's a sample session:
119+
111120
```powershell
112121
PS C:\> Switch-Php 5.6
113122
PS C:\> php -r 'echo PHP_VERSION;'
@@ -121,22 +130,29 @@ PS C:\> (Get-Command php).Path
121130
C:\Dev\PHP\php.exe
122131
PS C:\>
123132
```
133+
124134
You can use the `Remove-PhpFromSwitcher` to remove a PHP installation from the PHP Switcher, `Move-PhpSwitcher` to change the directory where `php.exe` will be visible in (`C:\Dev\PHP` in the example above), and `Remove-PhpSwitcher` to remove the PHP Switcher.
125135

126136
If you want to let **Apache** work with PHP, you have to add the `LoadModule` directive to the Apache configuration file, which should point to the appropriate DLL.
127137
For instance, with PHP 5.6 it is
138+
128139
```
129140
LoadModule php5_module "C:\Dev\PHP5.6\php5apache2_4.dll"
130141
```
142+
131143
And for PHP 7.2 it is
144+
132145
```
133146
LoadModule php7_module "C:\Dev\PHP7.2\php7apache2_4.dll"
134147
```
148+
135149
In order to simplify switching the PHP version used by Apache, the `Install-Php` command creates a file called `Apache.conf` in the PHP installation directory, containing the right `LoadModule` definition.
136150
So, in your Apache configuration file, instead of writing the `LoadModule` directive, you can simply write:
151+
137152
```
138153
Include "C:\Dev\PHP\Apache.conf"
139154
```
155+
140156
That's all: to switch the PHP version used by Apache simply call `Switch-Php` and restart Apache.
141157

142158
### Getting details about installed PHPs
@@ -299,20 +315,24 @@ Tests require some module (PSScriptAnalyzer, Pester, ...).
299315
You can run the `test\setup.ps1` PowerShell script to install them.
300316
The `test\pester.ps1` script executes all the tests, which are located in the `test\tests` directory.
301317
You can test a specific case by specifying its name:
318+
302319
```powershell
303320
.\test\pester.ps1 Edit-FolderInPath
304321
```
322+
305323
Some tests may require to run commands with elevated privileges. These tests are disabled by default: you can enable them by setting the `PHPMANAGER_TEST_RUNAS` environment variable to a non empty value:
324+
306325
```powershell
307326
$Env:PHPMANAGER_TEST_RUNAS=1
308327
.\test\pester.ps1 Edit-FolderInPath
309328
```
329+
310330
Some other tests require that [Node.js](https://nodejs.org) is installed and available in the PATH environment variable.
311331

312332

313333
## Do you want to really say thank you?
314334

315-
You can offer me a [montly coffee](https://github.com/sponsors/mlocati) or a [one-time coffee](https://paypal.me/mlocati) :wink:
335+
You can offer me a [monthly coffee](https://github.com/sponsors/mlocati) or a [one-time coffee](https://paypal.me/mlocati) :wink:
316336

317337

318338
## FAQ

0 commit comments

Comments
 (0)