Problem with Enable-PHPExtension when PHP installed in D:\PHP
hakkika opened this issue · comments
Hi,
I just wanted to let you know what I have learned about Enable-PHPExtension.
I noticed that Enable-PHPExtension does not work when PHP, e.g. PHP 8.0.7, is installed in D:\PHP
unless extension_dir is set in php.ini like this:
extension_dir = "D:\PHP\ext"
When I try to enable couchbase extension using this command
Import-Module PHPManager
Enable-PHPExtension couchbase -Verbose
I get this error
PS>TerminatingError(): "Unable to find a locally available extension with name (or handle) "couchbase": use the Install-PhpExtension to download it"
TerminatingError(): "Unable to find a locally available extension with name (or handle) "couchbase": use the Install-PhpExtension to download it"
Unable to find a locally available extension with name (or handle) "couchbase": use the Install-PhpExtension to download it
Unable to find a locally available extension with name (or handle) "couchbase": use the Install-PhpExtension to downloa
d it
At C:\Program Files\WindowsPowerShell\Modules\PhpManager\1.25.2\public\Enable-PhpExtension.ps1:55 char:21
- ... throw "Unable to find a locally available extension with ...
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : OperationStopped: (Unable to find ... to download it:String) [], RuntimeException
- FullyQualifiedErrorId : Unable to find a locally available extension with name (or handle) "couchbase": use the
Install-PhpExtension to download it
This also does not work, unless extension_dir is set
PS C:\Users\Administrator> Enable-PHPExtension couchbase -Path D:\PHP -Verbose
Unexpected 'php -m' line: Warning: PHP Startup: Unable to load dynamic library 'couchbase' (tried: C:\php\ext\couchbase
(The specified module could not be found), C:\php\ext\php_couchbase.dll (The specified module could not be found)) in
Unknown on line 0
At C:\Program Files\WindowsPowerShell\Modules\PhpManager\1.25.2\private\Get-PhpActivatedExtension.ps1:42 char:21
-
throw "Unexpected 'php -m' line: $line"
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : OperationStopped: (Unexpected 'php...known on line 0:String) [], RuntimeException
- FullyQualifiedErrorId : Unexpected 'php -m' line: Warning: PHP Startup: Unable to load dynamic library 'couchbas
e' (tried: C:\php\ext\couchbase (The specified module could not be found), C:\php\ext\php_couchbase.dll (The speci
fied module could not be found)) in Unknown on line 0
PS C:\Users\Administrator>
I noticed that Enable-PHPExtension does not work when PHP, e.g. PHP 8.0.7, is installed in D:\PHP
unless extension_dir is set in php.ini like this:extension_dir = "D:\PHP\ext"
If your php.ini
file doesn't define the value of extension_dir
, it will default to C:\php\ext
:
C:\> php -n -r "echo ini_get('extension_dir');"
C:\php\ext
How did you install PHP? If you installed it with Install-Php
, the extension_dir
would have been set automatically.
I do install Php using Install-Php, but in my installation script I also copy php.ini-development over php.ini and never noticed that.
Thank you for your help :-)