mlocati / powershell-phpmanager

A PowerShell module to install/update PHP, PHP extensions and Composer on Windows

Home Page:https://www.powershellgallery.com/packages/PhpManager

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot switch PHP version due to missing drive

Remo opened this issue · comments

I'm trying to switch the PHP version, but it fails becaues of a missing drive. I only have one drive (C:) on this computer. Any hint where I can look to fix this?

PS C:\WINDOWS\system32> Initialize-PhpSwitcher -Alias C:\PHP -Scope CurrentUser
PS C:\WINDOWS\system32> Add-PhpToSwitcher -Name 7.2 -Path C:\PHP72
PS C:\WINDOWS\system32> Add-PhpToSwitcher -Name 7.1 -Path C:\PHP71
PS C:\WINDOWS\system32> Get-PhpSwitcher

Scope       Alias  Targets    Current
-----       -----  -------    -------
CurrentUser C:\PHP {7.1, 7.2}


PS C:\WINDOWS\system32> Switch-Php 7.1
Join-Path : Cannot find drive. A drive with the name 'D' does not exist.
At C:\Program Files\WindowsPowerShell\Modules\PhpManager\1.17.2.210\private\PhpVersion.ps1:328 char:27
+                     $ep = Join-Path -Path $path -ChildPath 'php.exe'
+                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (D:String) [Join-Path], DriveNotFoundException
    + FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.JoinPathCommand

Switch-Php checks the PHP installations available in the PATH environment variable (see here).
When that operation is performed, PhpManager inspects the found PHP installations (see here).
If one of those PHP installations is misconfigured, the process aborts.

Maybe is this your case? You can check it for example by running Get-Php

PS: Ciao Remo!!

Ciao Michele 😄
yes, you're absolutely right! I removed that variable and it's now working fine.