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

Unable to install PHP extensions

kranack opened this issue · comments

I'm experiencing an issue during the installation of any PHP extensions. I think it's related to the space in the path to my PHP directory because I can't reproduce this issue with a path like "C:/PHP".

Here is a screenshot of the error I get during the installation.

image

The error says
"Move-Item: Impossible to find a part of the access path.
At character: ......"

The error says
"Move-Item: Impossible to find a part of the access path.
At character: ......"

Don't worry about translating: je comprend un petit peu de Français ;)

I'll check what's going wrong

It seems it's working for me. Are you running an elevated powershell (that is, did you launch it as administrator)?
I'm asking because usually folders and files under C:\Program Files can be modified only by administrators

Also, could you check which version of PhpManager you are using? You can check it by running

Get-Module -Name PhpManager

If the above command returns an empty result, you can run

Get-Module -Name PhpManager -ListAvailable

Don't worry about translating: je comprend un petit peu de Français ;)

Ahah ! Great because my english is not quite good :)

It seems it's working for me. Are you running an elevated powershell (that is, did you launch it as administrator)?
I'm asking because usually folders and files under C:\Program Files can be modified only by administrators

Also, could you check which version of PhpManager you are using? You can check it by running

Yes, I'm running the install command in an elevated powershell. My current version is the latest I think (1.17.0.207)

image

I really don't understand what's going wrong. Everything seems ok to me... Maybe the MongoDB extension requires some DLL that's not installed in your system?

I just updated Phpmanager (with this little change). so that it's a bit more verbose when installing an extension.

Could you update the PhpManager powershell module, and retry to install the mongodb extension (with the -Verbose flag)?

Here's my output:

PS C:\WINDOWS\system32> Install-Php -Version 7.3 -Architecture x64 -ThreadSafe $true -Path 'C:\Program Files\PHP' -TimeZone UTC -InitialPhpIni Production -Verbose
DETAILED: GET https://windows.php.net/downloads/releases/ with 0-byte payload
DETAILED: received 6821-byte response of content type text/html; charset=UTF-8
DETAILED: Installing PHP PHP 7.3.10 x64 (64-bit) Thread-Safe
DETAILED: Downloading from https://windows.php.net/downloads/releases/php-7.3.10-Win32-VC15-x64.zip
DETAILED: GET https://windows.php.net/downloads/releases/php-7.3.10-Win32-VC15-x64.zip with 0-byte payload
DETAILED: received 25716166-byte response of content type application/x-zip-compressed
DETAILED: Extracting C:\Dev\cache\php-7.3.10-Win32-VC15-x64.zip to temporary directory
DETAILED: Extracting C:\Dev\cache\php-7.3.10-Win32-VC15-x64.zip to destination directory

PS C:\WINDOWS\system32> Install-PhpExtension -Extension mongodb -Version 1.5 -Path 'C:\Program Files\PHP' -Verbose
DETAILED: GET https://pecl.php.net/rest/p/packages.xml with 0-byte payload
DETAILED: received 6550-byte response of content type application/xml
DETAILED: GET https://pecl.php.net/rest/r/mongodb/allreleases.xml with 0-byte payload
DETAILED: received 2779-byte response of content type application/xml
DETAILED: GET https://windows.php.net/downloads/pecl/releases/mongodb/1.5.5 with 0-byte payload
DETAILED: received 2375-byte response of content type text/html; charset=UTF-8
DETAILED: Downloading PECL package mongodb 1.5.5 from https://windows.php.net/downloads/pecl/releases/mongodb/1.5.5/php_mongodb-1.5.5-7.3-ts-vc15-x64.zip
DETAILED: Downloading from https://windows.php.net/downloads/pecl/releases/mongodb/1.5.5/php_mongodb-1.5.5-7.3-ts-vc15-x64.zip
DETAILED: GET https://windows.php.net/downloads/pecl/releases/mongodb/1.5.5/php_mongodb-1.5.5-7.3-ts-vc15-x64.zip with 0-byte payload
DETAILED: received 1331506-byte response of content type application/x-zip-compressed
DETAILED: Installing new extension 'mongodb' version 1.5.5
DETAILED: Checking prerequisites for mongodb
DETAILED: Moving "J:\Temp\5k1dtzxk.bmi\php_mongodb.dll" to "C:\Program Files\PHP\ext\php_mongodb.dll"
DETAILED: Enabling extension "mongodb" for "C:\Program Files\PHP\php.exe"
DETAILED: The extension mongodb v1.5.5 has been enabled

Could you update the PhpManager powershell module, and retry to install the mongodb extension (with the -Verbose flag)?

Sure, here's my output
image

It seems that's the module is ignoring my -Path parameter and trying to move the extension in C:\PHP directory.
I think the only difference with your test is I've installed my PHP binaries with choco install php (Chocolatey package manager). Is your module compatible with any PHP installations or should I install my PHP with your module too ?

Could you try to run this command?

Get-Php -Path 'C:\Program Files\PHP'

Well, I think I find my mistake here...

image

I didn't know PHP will take C:\PHP\ext as default extension dir.... I changed the path in php.ini and it worked as expected :)

image

Thanks for your help and sorry for the inconvenience.

Don't worry:wink:
Salut!!

PS: I just released a new version that includes a check about the extension dir.