GithubHelp home page GithubHelp logo

mlocati / powershell-phpmanager Goto Github PK

View Code? Open in Web Editor NEW
206.0 8.0 16.0 1.5 MB

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

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

License: MIT License

PowerShell 94.99% Batchfile 0.92% C 2.24% Makefile 0.25% Shell 0.09% JavaScript 0.20% PHP 0.90% Dockerfile 0.40%
php powershell extensions windows win32 dll

powershell-phpmanager's Introduction

AppVeyor Build Status GitHub Actions Test Status PowerShell Gallery Download Count Github Releases Download Count

Introduction

This repository contains a PowerShell module that implements functions to install, update and configure PHP on Windows.

Installation

You'll need at least PowerShell version 5: in order to determine which version you have, open PowerShell and type:

$PSVersionTable.PSVersion.ToString()

If you have an older version, you can upgrade it following these instructions.

To install this module for any user of your PC, open an elevated PowerShell session (for example with Start-Process powershell -Verb runAs) and run this command:

Install-Module -Name PhpManager -Repository PSGallery -Force

To install this module for the current user only:

Install-Module -Name PhpManager -Repository PSGallery -Force -Scope CurrentUser

If you won't be able to execute the module functions, you may need to tell PowerShell to enable their execution:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Force

Available Features

Here you can find a short description of the available commands: in order to get more details, type Get-Help <CommandName> (or Get-Help -Detailed <CommandName> or Get-Help -Full <CommandName>).

Installing PHP

Use the Install-Php command to install PHP.

  • you can specify a generic version (eg 7) or a more refined version (eg 7.2 or 7.2.1). You can also ask to install release candidate versions (eg 7.2.5RC), as well as development versions (eg 7.4snapshot or master)
  • you can specify to install a 32-bit or a 64-bit version
  • you can specify to install a Thread-Safe or Non-Thread-Safe version
  • you can specify the default time zone
  • you can ask to add the PHP installation path to the system or to the user PATH variable (so that you'll be able to use php.exe without specifying its path)
Install-Php -Version 7.2 -Architecture x64 -ThreadSafe 0 -Path C:\PHP -TimeZone UTC -AddToPath User

Upgrading PHP

Use the Update-Php command to upgrade PHP. The command will automatically check if there's a newer version available: if so, the PHP installation will be upgraded. Please note that stable versions will be upgraded to stable, and non-stable (alpha/beta/release candidate) versions will be upgraded to stable or non-stable versions. Also the 32/64 bit and the thread safety will be the same.

Update-Php C:\PHP

Updating PHP to a specified version

Use the Install-Php command to update PHP (for example existing version 7.2.10 to 7.2.15). If you don't specify the InitialPhpIni parameter all settings are retained. Also the parameter Force is required

Install-Php -Version 7.2.15 -Architecture x64 -ThreadSafe $true -Path C:\PHP -Force

Uninstalling PHP

Use the Uninstall-Php command to uninstall PHP. This command will remove the PHP installation folder, and its path will be removed from the PATH environment variables.

Uninstall-Php C:\PHP

Working with multiple PHP installations

It's often handy to be able to use different PHP versions for different projects.
For instance, sometimes you may want that php.exe is PHP 5.6, sometimes you may want that php.exe is PHP 7.2.
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.
First, you install the PHP versions you need:

Install-Php -Version 5.6 -Architecture x86 -ThreadSafe $true -Path C:\Dev\PHP5.6 -TimeZone UTC
Install-Php -Version 7.2 -Architecture x86 -ThreadSafe $true -Path C:\Dev\PHP7.2 -TimeZone UTC

Then you initialize the PHP Switcher, specifying where the current PHP version should be available:

Initialize-PhpSwitcher -Alias C:\Dev\PHP -Scope CurrentUser

Then, you can add to the PHP Switcher the PHP versions you installed:

Add-PhpToSwitcher -Name 5.6 -Path C:\Dev\PHP5.6
Add-PhpToSwitcher -Name 7.2 -Path C:\Dev\PHP7.2

You can get the details about the PHP Switcher configuration with the Get-PhpSwitcher command:

Get-PhpSwitcher
(Get-PhpSwitcher).Targets

Once you have done that, you can switch the current PHP version as easily as calling the Switch-Php command.
Here's a sample session:

PS C:\> Switch-Php 5.6
PS C:\> php -r 'echo PHP_VERSION;'
5.6.36
PS C:\> (Get-Command php).Path
C:\Dev\PHP\php.exe
PS C:\> Switch-Php 7.2
PS C:\> php -r 'echo PHP_VERSION;'
7.2.5
PS C:\> (Get-Command php).Path
C:\Dev\PHP\php.exe
PS C:\>

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.

You can do many fancy stuff with PHP Switcher. For example, to download and enable the redis PHP extension for all the PHP versions, you can write something like this:

$phpSwitcher = Get-PhpSwitcher
$phpSwitcher.Targets.Keys | ForEach-Object {
    Write-Host -Object "Installing for $_... " -NoNewline
    try {
        Install-PhpExtension -Path $phpSwitcher.Targets[$_] redis
        Write-Host -Object 'done.' -ForegroundColor Green
    } catch {
        Write-Host -Object $_ -ForegroundColor Red
    }
}

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. For instance, with PHP 5.6 it is

LoadModule php5_module "C:\Dev\PHP5.6\php5apache2_4.dll"

And for PHP 7.2 it is

LoadModule php7_module "C:\Dev\PHP7.2\php7apache2_4.dll"

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. So, in your Apache configuration file, instead of writing the LoadModule directive, you can simply write:

Include "C:\Dev\PHP\Apache.conf"

That's all: to switch the PHP version used by Apache simply call Switch-Php and restart Apache.

Getting details about installed PHPs

Use the Get-Php command to list the PHP installations found in the current PATH environment variable. You can also specify a directory: the command will display the details of the PHP installed there.

Get-Php C:\PHP

Sample Output:

Folder             : C:\PHP
ExecutablePath     : C:\PHP\php.exe
ExtensionsPath     : C:\PHP\ext
MajorMinorVersion  : 7.4
Version            : 7.4.0
FullVersion        : 7.4.0RC6
UnstabilityLevel   : RC
UnstabilityVersion : 6
DisplayName        : PHP 7.4.0RC6 x86 (32-bit) Thread-Safe
Architecture       : x86
ThreadSafe         : True
VCVersion          : 15

Getting php.ini configuration keys

Use the Get-PhpIniKey command to retrieve the value of a configuration in the php.ini file used by a PHP installation.

Get-PhpIniKey default_charset C:\PHP

Setting and removing php.ini configuration keys

Use the Set-PhpIniKey command to add or change configuration keys in the php.ini file used by a PHP installation. You can also delete, comment or uncomment configuration keys with this command.

Set-PhpIniKey default_charset UTF-8 C:\PHP

Getting the list of PHP extensions

You can use the Get-PhpExtension command to get the PHP extensions currently available (enabled or disabled) in the PHP installation.

# List the builtin extensions
Get-PhpExtension C:\PHP | Where { $_.Type -eq 'Builtin' }
# List the enabled extensions
Get-PhpExtension C:\PHP | Where { $_.State -eq 'Enabled' }
# List the Zend extensions (xdebug, opcache, ...)
Get-PhpExtension C:\PHP | Where { $_.Type -eq 'Zend' }

The Type property of the extension objects can be:

  • Builtin for extensions bundled in PHP (for example: reflection, spl, tokenizer)
  • Php for regular PHP extensions
  • Zend for Zend extensions (for example: xdebug or opcache)

The State property of the extension objects can be:

  • Builtin for extensions bundled in PHP (for example: reflection, spl, tokenizer) (those extensions are always enabled)
  • Enabled for enabled non-builtin extensions
  • Disabled for disabled non-builtin extensions
  • Unknown if you pass Get-PhpExtension the path to a DLL extension file (see here)

Enabling and disabling PHP extensions

You can use the Enable-PhpExtension/Disable-PhpExtension command to enable or disable PHP extensions. Please remark that the Enable-PhpExtension command requires that the extension is already present in your PHP installation; if you don't have the installation DLL file, you can use the Install-PhpExtension command.

Enable-PhpExtension opcache C:\PHP
Disable-PhpExtension mbstring C:\PHP

Adding new extensions (from PECL)

The Enable-PhpExtension command can only enable extensions that are already present in the PHP installation. In order to add new extensions (like xdebug or imagick - imagemagick) you can use the Install-PhpExtension command. This command will download the DLLs of the extensions from the PECL archive. You can specify a version of the extension (generic, like 1, or specific, like 1.2), and the minimum stability:

Install-PhpExtension xdebug -Version 2.6
Install-PhpExtension imagick -MinimumStability snapshot

Some extensions require additional dependencies (for example imagick). By default, Install-PhpExtension automatically installs these dependencies in the directory where PHP is installed. If you want to install them in another directory, you have to call the Install-PhpExtensionPrerequisite command, and specify the -NoDependencies option for Install-PhpExtension.

PS: Install-PhpExtension can also be used to upgrade (or downgrade) a PHP extension to the most recent version available online.

Getting the list of PHP versions available online

Use the Get-PhpAvailableVersion command to list the PHP versions available online. You can specify to list the Release versions (that is, the ones currently supported), as well as the Archive versions (the ones at end-of-life) and the QA versions (that is, the release candidates).

For instance, to list all the 64-bit thread-safe releases you can use this command:

Get-PhpAvailableVersion Release | Where { $_.Architecture -eq 'x64' -and $_.ThreadSafe -eq $true }

Managing HTTPS/TLS/SSL Certification Authority certificates

When connecting (with cURL, openssl, ...) to a remote resource via a secure protocol (for instance https:), PHP checks if the certificate has been issued by a valid Certification Authority (CA).
On Linux and Mac systems, the list of valid CAs is managed by the system.
On Windows there isn't a similar feature: we have to manually retrieve the list of reliable CAs and tell PHP where they are.
The Update-PhpCAInfo does all that for you: a simple call to this command will fetch the valid CA list and configure PHP.
Since the list of valid CA certificates changes over time, you should execute Update-PhpCAInfo on a regular basis.
In addition, Update-PhpCAInfo can optionally add your custom CA certificates to the list of official CA certificates.

Installing Composer

You can install Composer with the command Install-Composer. Install-Composer is able to add composer to the path, so that you can execute it from any location. Type Get-Help -Detailed Install-Composer for more details.

Configuring OpenSSL

If you need to use the OpenSSL PHP extension for key generation or certificate signing functions, you will need a valid openssl.cnf file. Set-OpenSSLConf will set the OPENSSL_CONF environment variable (for the current process, and optionally for the current user or local machine). Set-OpenSSLConf will look for openssl.cnf in some common places, but you can also provide the path to that file.

Inspecting a PHP extension DLL file

Get-PhpExtension is able to inspect a DLL file of a PHP extension:

PS C:\> Invoke-WebRequest -Uri https://xdebug.org/files/php_xdebug-2.6.1-7.0-vc14-nts-x86_64.dll -OutFile test.dll
PS C:\> Get-PhpExtension test.dll
Type         : Zend
State        : Unknown
Name         : Xdebug
Handle       : xdebug
Version      : 2.6.1
PhpVersion   : 7.0
Architecture : x64
ThreadSafe   : False
Filename     : test.dll

Caching downloads

This module downloads PHP and PHP extensions from internet.
In order to avoid downloading the same files multiple times you can use Set-PhpDownloadCache to specify the path of a local folder where the downloads will be cached (to get the configured value you can use Get-PhpDownloadCache).

By default Set-PhpDownloadCache does not persist the configured value: you can use the -Persist option to store if for the current user only, or for any user.

To retrieve the currently configured value you can use Get-PhpDownloadCache.

To disable the cache, run Set-PhpDownloadCache without arguments (to make this setting persistent, use Set-PhpDownloadCache -Persist CurrentUser or Set-PhpDownloadCache -Persist AllUsers).

Supported platforms

This module is fully tested on Windows 10, Windows Server 2016, Windows Server Core, Windows Nano Server.

Test

Tests require some module (PSScriptAnalyzer, Pester, ...).
You can run the test\setup.ps1 PowerShell script to install them.
The test\pester.ps1 script executes all the tests, which are located in the test\tests directory. You can test a specific case by specifying its name:

.\test\pester.ps1 Edit-FolderInPath

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:

$Env:PHPMANAGER_TEST_RUNAS=1
.\test\pester.ps1 Edit-FolderInPath

Some other tests require that Node.js is installed and available in the PATH environment variable.

Do you want to really say thank you?

You can offer me a monthly coffee or a one-time coffee ๐Ÿ˜‰

FAQ

What are those executable in the archive?

In order to retrieve the name and the version of the locally available extensions, as well as to determine if they are normal PHP extensions (to be added to php.ini with extension=...) or Zend extensions (to be added to php.ini with zend_extension=...), we need to inspect the extension DLL files. This is done with this C code.

You could think that this code could be written in C# and included in the PowerShell scripts with the Add-Type -Language CSharp cmdlet. Sadly, we have to inspect DLLs that are compiled both for 32 and for 64 bits architectures, and the code would only be able to inspect DLLs with the same architecture used by PowerShell. So if PowerShell is running in 64-bit mode we won't be able to inspect 32-bit DLLs (and vice versa). That's why we need these executables: they will be started in 32-bit (Inspect-PhpExtension-x86.exe) or in 64-bit (Inspect-PhpExtension-x64.exe) mode.

Of course you don't have to trust them: you can compile them on your own (it will require Windows Subsystem for Linux) by calling the compile.bat script.

The folder also contains a couple of 7-Zip executables (one for 32-bit systems and one for 64-bit systems): they are used by PhpManager to unzip the downloaded archives.
Sure, we could use the standard Expand-Archive cmdlet, but these 7-Zip tools are about one order of magnitute faster than it.

powershell-phpmanager's People

Contributors

berserkir-wolf avatar elanora96 avatar ltdeta avatar mlocati avatar nitemarereal avatar sergeyklay avatar shivammathur avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

powershell-phpmanager's Issues

Unable to install PHP 7.2 on nanoserver

Hi,

First, thanks for developping this nice module.

I am trying to install PHP 7.2 on nanoserver (build 10.0.14393.2551), but it tells me "The Visual C++ 2017 Redistributable seems to be missing: you have to install it manually".

I first tried copying only the vcruntime140.dll file into the C:\Windows\System32 directory, but it does not work. The I tried copying all dlls that have the same creation date as vcruntime140.dll for both System32 and SysWOW64 directory, but it does not help.

I also installed Apache 2.4.37, which requires VC15 and it works. PHP installation works if I ask for 7.1 version.

Here is my DockerFile, if you want to test.

FROM microsoft/nanoserver:10.0.14393.2551

# Visual Studio 2017 / VC15, required for Apache and PHP.
COPY ./files/vcruntime140.dll.15 /Windows/System32/vcruntime140.dll

RUN powershell -Command \
    #
    # Install PHP Manager powershell module.
    Install-PackageProvider -Name "NuGet" -RequiredVersion "2.8.5.201" -Force; \
    Install-Module -Name "PhpManager" -Force; \
    #
    # Install PHP 7.2.
    Install-Php -Version "7.2" -Architecture "x64" -ThreadSafe $true -Path "C:\PHP" -TimeZone "UTC" -AddToPath "System"; \
    #
    # Install PHP extensions.
    Enable-PhpExtension "openssl" "C:\PHP"; \
    #
    # Install Apache 2.4.
    Invoke-WebRequest -Uri "https://home.apache.org/~steffenal/VC15/binaries/httpd-2.4.37-win64-VC15.zip" -OutFile "$ENV:Temp\httpd.zip"; \
    Expand-Archive "$ENV:Temp\httpd.zip" -DestinationPath "$ENV:Temp"; \
    Copy-Item "$ENV:Temp\Apache24" -Destination "C:\Apache24" -Recurse; \
    #
    # Install Composer.
    Install-Composer -Path "C:\Composer" -Scope "System"; \
    #
    # Clean temporary files.
    Remove-Item -Path "$ENV:Temp/*" -Recurse;

COPY ./files/httpd-custom.conf /Apache24/conf/httpd-custom.conf

CMD C:\Apache24\bin\httpd.exe -f "C:\Apache24\conf\httpd-custom.conf"

and my custom httpd-custom.conf file:

# Base configuration
Include conf/httpd.conf

# PHP Configuration (mod PHP)
LoadModule php7_module "C:\PHP\php7apache2_4.dll"
PHPIniDir "C:/PHP"
<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>

Regards

Initialize-PhpSwitcher : not a junktion

Why does the following error occur?

Remove-PhpSwitcher

Initialize-PhpSwitcher D:\PHP7

D:\PHP7 already exist and it's not a junction.
In C:\Program Files\WindowsPowerShell\Modules\PhpManager\1.24.4\public\Initialize-PhpSwitcher.ps1:54 Zeichen:17
throw "$Alias already exist and it's not a junction."
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CategoryInfo : OperationStopped: (D:\PHP7 already...not a junction.:String) [], RuntimeException
FullyQualifiedErrorId : D:\PHP7 already exist and it's not a junction.

extensions - simple listing

the function Getting the list of PHP extensions shows a lot of detail information

Type : Builtin
State : Builtin
Name : zlib
Handle : zlib
Version :
PhpVersion : 7.2.12
Architecture : x86
ThreadSafe : True
Filename :

An additional way to get only the names in a simple list would be helpful

Timing of version upgrades?

Running PHP 7.2.18 and just ran the Update-Php command. The response was "False" - presumably indicating no upgrade available? However https://windows.php.net/download/ has the latest version as 7.3.5 (admittedly released yesterday). What is the timing of the PhpManager updates relative to when versions are released?

How to use in a xampp instalation

I cant use Install-PHPExtension in my preinstaled PHP XAMP I tryed:

Install-PhpExtension imagick -MinimumStability snapshot

Install-PhpExtension imagick C:\XAMPP\PHP -MinimumStability snapshot
and
Install-PhpExtension imagick -MinimumStability snapshot C:\XAMPP\PHP

ExtensionDetail from DLL Path causing error when using local file and not PECL

Due to PECL not having DLLs for the pdo_sqlsrv and sqlsrv for PHP 8+, I am trying to use PhpManager to install the files I have downloaded from the mssql git repo.

When I run Install-PhpExtension -Path C:\PHP\82 C:\temp\php_sqlsrv_82_nts.dll I receive this error: The variable '$newExtension' cannot be retrieved because it has not been set.

Looking into the Install-PhpExtension script I found the following line that I believe is causing the issue.

$oldExtension = Get-PhpExtension -Path $phpVersion.ExecutablePath | Where-Object { $_.Handle -eq $newExtension.Handle }

I believe this is because the variable is only set in the else part of the if statement on line 212.

if (Test-Path -Path $Extension -PathType Leaf) {
if ($Version -ne '') {
throw 'You can''t specify the -Version argument if you specify an existing file with the -Extension argument'
}
if ($null -ne $MinimumStability -and $MinimumStability -ne '') {
throw 'You can''t specify the -MinimumStability argument if you specify an existing file with the -Extension argument'
}
if ($null -ne $MaximumStability -and $MaximumStability -ne '') {
throw 'You can''t specify the -MaximumStability argument if you specify an existing file with the -Extension argument'
}
$dllPath = [System.IO.Path]::GetFullPath($Extension)
}
else {
if ($null -eq $MinimumStability -or $MinimumStability -eq '') {
$MinimumStability = $Script:PEARSTATE_STABLE
}
if ($null -eq $MaximumStability -or $MaximumStability -eq '') {
$MaximumStability = $Script:PEARSTATE_STABLE
}
$peclPackages = @(Get-PeclAvailablePackage)
$foundPeclPackages = @($peclPackages | Where-Object { $_ -eq $Extension })
if ($foundPeclPackages.Count -ne 1) {
$foundPeclPackages = @($peclPackages | Where-Object { $_ -like "*$Extension*" })
if ($foundPeclPackages.Count -eq 0) {
throw "No PECL extensions found containing '$Extension'"
}
if ($foundPeclPackages.Count -ne 1) {
throw ("Multiple PECL extensions found containing '$Extension':`n - " + [String]::Join("`n - ", $foundPeclPackages))
}
}
$peclPackageHandle = $foundPeclPackages[0]
switch ($peclPackageHandle) {
'xdebug' {
$availablePackageVersion = Get-XdebugExtension -PhpVersion $phpVersion -Version $Version -MinimumStability $MinimumStability -MaximumStability $MaximumStability
if ($null -ne $availablePackageVersion) {
$remoteFileIsZip = $false
$finalDllName = 'php_xdebug.dll'
} else {
$finalDllName = $null
}
}
default {
$availablePackageVersion = $null
$finalDllName = $null
}
}
if ($null -eq $availablePackageVersion) {
$peclPackageVersions = @(Get-PeclPackageVersion -Handle $peclPackageHandle -Version $Version -MinimumStability $MinimumStability -MaximumStability $MaximumStability)
if ($peclPackageVersions.Count -eq 0) {
if ($Version -eq '') {
throw "The PECL package $peclPackageHandle does not have any version with a stability between $MinimumStability and $MaximumStability"
}
throw "The PECL package $peclPackageHandle does not have any $Version version with a stability between $MinimumStability and $MaximumStability"
}
foreach ($peclPackageVersion in $peclPackageVersions) {
$archiveUrl = Get-PeclArchiveUrl -PackageHandle $peclPackageHandle -PackageVersion $peclPackageVersion -PhpVersion $phpVersion -MinimumStability $MinimumStability -MaximumStability $MaximumStability
if ($archiveUrl -eq '') {
Write-Verbose ("No Windows DLLs found for PECL package {0} {1} compatible with {2}" -f $peclPackageHandle, $peclPackageVersion, $phpVersion.DisplayName)
}
else {
$availablePackageVersion = @{PackageVersion = $peclPackageVersion; PackageArchiveUrl = $archiveUrl }
$remoteFileIsZip = $true
break
}
}
if ($null -eq $availablePackageVersion) {
throw "No compatible Windows DLL found for PECL package $peclPackageHandle with a stability between $MinimumStability and $MaximumStability"
}
}
Write-Verbose ("Downloading PECL package {0} {1} from {2}" -f $peclPackageHandle, $availablePackageVersion.PackageVersion, $availablePackageVersion.PackageArchiveUrl)
$downloadedFile, $keepDownloadedFile = Get-FileFromUrlOrCache -Url $availablePackageVersion.PackageArchiveUrl
$additionalFiles = @()
try {
if ($remoteFileIsZip) {
$tempFolder = New-TempDirectory
Expand-ArchiveWith7Zip -ArchivePath $downloadedFile -DestinationPath $tempFolder
$phpDlls = @(Get-ChildItem -Path $tempFolder\php_*.dll -File -Depth 0)
if ($phpDlls.Count -eq 0) {
$phpDlls = @(Get-ChildItem -Path $tempFolder\php_*.dll -File -Depth 1)
}
if ($phpDlls.Count -eq 0) {
throw ("No PHP DLL found in archive downloaded from {0}" -f $availablePackageVersion.PackageArchiveUrl)
}
if ($phpDlls.Count -ne 1) {
throw ("Multiple PHP DLL found in archive downloaded from {0}" -f $availablePackageVersion.PackageArchiveUrl)
}
$dllPath = $phpDlls[0].FullName
switch ($peclPackageHandle) {
'couchbase' {
$libcouchbaseDll = Join-Path -Path $tempFolder -ChildPath 'libcouchbase.dll'
if (Test-Path -LiteralPath $libcouchbaseDll -PathType Leaf) {
$additionalFiles += $libcouchbaseDll
}
}
'decimal' {
$libmpdecDll = Join-Path -Path $tempFolder -ChildPath 'libmpdec.dll'
if (Test-Path -LiteralPath $libmpdecDll -PathType Leaf) {
$additionalFiles += $libmpdecDll
}
}
'imagick' {
$additionalFiles += @(Get-ChildItem -Path $tempFolder\CORE_*.dll -File -Depth 1)
$additionalFiles += @(Get-ChildItem -Path $tempFolder\IM_*.dll -File -Depth 1)
$additionalFiles += @(Get-ChildItem -Path $tempFolder\FILTER_*.dll -File -Depth 1)
}
'memcached' {
$libmemcachedDll = Join-Path -Path $tempFolder -ChildPath 'libmemcached.dll'
$libhashkitDll = Join-Path -Path $tempFolder -ChildPath 'libhashkit.dll'
if (Test-Path -LiteralPath $libmemcachedDll -PathType Leaf) {
$additionalFiles += $libmemcachedDll
}
if (Test-Path -LiteralPath $libhashkitDll -PathType Leaf) {
$additionalFiles += $libhashkitDll
}
}
'yaml' {
$yamlDll = Join-Path -Path $tempFolder -ChildPath 'yaml.dll'
if (Test-Path -LiteralPath $yamlDll -PathType Leaf) {
$additionalFiles += $yamlDll
}
}
}
}
else {
$keepDownloadedFile = $true
$dllPath = $downloadedFile
}
$newExtension = Get-PhpExtensionDetail -PhpVersion $phpVersion -Path $dllPath
}
catch {
$keepDownloadedFile = $false
throw
}
finally {
if (-Not($keepDownloadedFile)) {
try {
Remove-Item -Path $downloadedFile -Force
}
catch {
Write-Debug 'Failed to remove temporary zip file'
}
}
}
}

$newExtension = Get-PhpExtensionDetail -PhpVersion $phpVersion -Path $dllPath

I wonder if moving line 212 right after the closing if statement bracket on line 228 would fix this issue.

Thank you for your hard work on this! I'll see if I can get a pull request put together.

Adjust PHP version regex for PHP 8.1 snap builds

PHP 8.1 in the PHP-8.1 branch has the version 8.1.0RC1-dev.
Ref:

This is unlike PHP 8.0 RCs where the version on the branch was 8.0.0-dev.
So this change in 8.1 breaks the regex for checking PHP version as it parses -dev and -RC\d, but not -RC\d-dev.

$match = $executableResult | Select-String -Pattern "(?<version>\d+\.\d+\.\d+)(?<stabilityLevel>-dev|(?:$Script:UNSTABLEPHP_RX))?(?<stabilityVersion>\d+)?\t(?<bits>\d+)\t(?<apiVersion>\d+)$"

Failure log for Get-Php: https://github.com/shivammathur/test-setup-php/runs/3492819490?check_suite_focus=true#step:3:11

Error while installing 7.4RC

While installing PHP 7.4RC it gives this error

Failed to recognize VCVersion from Visual C++ 2017
At C:\Users\runneradmin\Documents\WindowsPowerShell\Modules\PhpManager\1.16.1.201\private\PhpVersion.ps1:284 char:27
+ ...   default { throw "Failed to recognize VCVersion from Visual C++ $vcY ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Failed to recog...Visual C++ 2017:String) [], RuntimeException
    + FullyQualifiedErrorId : Failed to recognize VCVersion from Visual C++ 2017

This is because in PhpVersion.ps1 the switch to check $vcYear only has 2019 and it fails for 2017.

switch ($vcYear) {
'2019' { $data.VCVersion = 16 }
default { throw "Failed to recognize VCVersion from Visual C++ $vcYear" }
}

imagemagick version mismatch

For PHP 7.4 and lower after the release of imagick 3.6.0RC1, ImageMagick was updated, so it gives the version mismatch warning

PHP Warning:  Version warning: Imagick was compiled against ImageMagick version 1799 but version 1808 is loaded. Imagick will run but may behave surprisingly in Unknown on line 0

While this is a warning, it breaks PhpManager installing any extensions specified after imagick.
Test workflow: https://github.com/shivammathur/test-setup-php/actions/runs/1447619348/workflow

This can be fixed temporarily by changing the $pageUrl in Install-ImagickPrerequisite.ps1 to archives, but when imagick 3.6.0 releases it would break again as the change will have to be reverted, as that will use newer ImageMagick.

Also, I noticed now the ImageMagick DLLs are inside the extension zip for versions lower than PHP 8.0, so maybe using those instead of downloading the library might help.

Update-Php: specified version

update-php
The command will automatically check if there's a newer version available: if so, the PHP installation will be upgraded.

It would be nice if you could specify a version, and not necessarily update to the latest version.

Add support for memcached

The recent Memcached release has windows builds.
It would be nice to add support for it. It has additional libraries in the zip.

Awesome

Hey,

I just want to say this repo is awesome - has saved me a ton of time and headaches already.

Definitely starring and watching this one!

Error when enabling extension

Every time I try to enable an extension, I get an error. Extension exists in filesystem and I get this error with ANY extension I try to enable.
My PHP installation was already present in my hard disk, it wasn't installed with this module.
Changing any php.ini key works.
Tested on

  • PHP 8.2.5, Windows 10, PowerShell 7.3.4
  • PHP 8.2.5, Windows 8, PowerShell 7.3.4

Error:
image

Problem with Enable-PHPExtension when PHP installed in D:\PHP

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

Unrecognized PHP extension name: ionCube Loader

I have a working PHP 7.2 installation that includes ionCube Loader (https://www.ioncube.com/loaders.php). I wanted to add my existing PHP installation to PhpSwitcher in order to install imagick, but I always get the error message Unrecognized PHP extension name: ionCube Loader

What I did:

Initialize-PhpSwitcher -Alias C:\PHP\CurrentVersion -Scope CurrentUser
Add-PhpToSwitcher -Name 7.2 -Path C:\XAMPP\PHP
Switch-Php 7.2 -force
Install-PhpExtension -Extension imagick -MinimumStability snapshot

Unrecognized PHP extension name: ionCube Loader
At C:\Program Files\WindowsPowerShell\Modules\PhpManager\1.15.0.191\private\Get-PhpExtensionHandle.ps1:37 char:21
+                     throw "Unrecognized PHP extension name: $Name"
+                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Unrecognized PH... ionCube Loader:String) [], RuntimeException
    + FullyQualifiedErrorId : Unrecognized PHP extension name: ionCube Loader

I also added the LoadModule and PhpIniDir instructions to the http.conf. What am I doing wrong here?

Support for self compiled builds from master branch

Will it be possible to support functions other than Install-Php for builds from master branch.
I think it will need adjusting ZEND_MODULE_API_NO and UNSTABLEPHP_RX and their use to support the 8.0.0-dev version. I want to use functions other than Install-Php like Enable-PhpExtension, Update-PhpCAInfo and Set-PhpIniKey on the same.

You can move the check to give the error for this version from PhpVersion to Install-Php till alpha1 is tagged.

Unhandled exit code when vcredist is not installed.

On GitHub Actions, I'm getting a different exit code when vcredist is not installed for x86 version of PHP.

0xC0000135 and 0xC0000139 are checked, but I'm getting 0xc000007b.

if ($exeExitCode -eq $Script:STATUS_DLL_NOT_FOUND -or $exeExitCode -eq $Script:ENTRYPOINT_NOT_FOUND -or $exeOutput -match 'vcruntime.*is not compatible with this PHP build') {

Logs: https://github.com/shivammathur/test-setup-php/actions/runs/3918173849/jobs/6698400981#step:3:1

Error while extracting zip

PhpManager isnt able to unpack zip. error:

Error extracting from archive:  7-Zip (a) 18.05 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2018-04-30  Scanning the
drive for archives: 1 file, 30773278 bytes (30 MiB)  Extracting archive: C:\Users\Billab01\AppData\Local\Temp\tmpEC7F.z
ip -- Path = C:\Users\Billab01\AppData\Local\Temp\tmpEC7F.zip Type = zip Physical Size = 30773278  ERROR: Data Error :
ext\php_imap.dll ERROR: Data Error : ext\php_odbc.dll ERROR: Headers Error : ext\php_opcache.dll  Sub items Errors: 3
Archives with Errors: 1  Sub items Errors: 3
At C:\Program Files\WindowsPowerShell\Modules\PhpManager\1.26.2\private\Expand-ArchiveWith7Zip.ps1:67 char:13
+             throw "Error extracting from archive: $sevenZipResult"
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Error extractin...items Errors: 3:String) [], RuntimeException
    + FullyQualifiedErrorId : Error extracting from archive:  7-Zip (a) 18.05 (x64) : Copyright (c) 1999-2018 Igor Pav
   lov : 2018-04-30  Scanning the drive for archives: 1 file, 30773278 bytes (30 MiB)  Extracting archive: C:\Users\B
  illab01\AppData\Local\Temp\tmpEC7F.zip -- Path = C:\Users\Billab01\AppData\Local\Temp\tmpEC7F.zip Type = zip Physi
 cal Size = 30773278  ERROR: Data Error : ext\php_imap.dll ERROR: Data Error : ext\php_odbc.dll ERROR: Headers Erro
r : ext\php_opcache.dll  Sub items Errors: 3  Archives with Errors: 1  Sub items Errors: 3

Unable to load dynamic library 'imagick'

i am using Apache/2.4.33 (Win32) OpenSSL/1.1.0h PHP/7.2.12
I did everything as described

PS C:\test> Install-Php -Version 7.2.12 -Architecture x86 -ThreadSafe $true -Path d:\PHP7.2.12 -TimeZone Europe/Rome -InitialPhpIni Development
PS C:\test> Install-PhpExtension -Extension imagick -Path d:\PHP7.2.12

Get-PhpExtension -Path D:\php7.2.12 | Where-Object { $_.Name -eq 'imagick' }
Type         : Php
State        : Enabled
Name         : imagick
Handle       : imagick
Version      : @PACKAGE_VERSION@
PhpVersion   : 7.2
Architecture : x86
ThreadSafe   : True
Filename     : D:\PHP7.2.12\ext\php_imagick.dll

Calling D:\php7.2.12\php -i gives the following information about imagick

imagick

imagick module => enabled
imagick module version => @PACKAGE_VERSION@
imagick classes => Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator, ImagickKernel
Imagick compiled with ImageMagick version => ImageMagick 7.0.7-11 Q16 x86 2017-11-23 http://www.imagemagick.org
Imagick using ImageMagick library version => ImageMagick 7.0.7-11 Q16 x86 2017-11-23 http://www.imagemagick.org
ImageMagick copyright => Copyright (C) 1999-2015 ImageMagick Studio LLC
ImageMagick release date => 2017-11-23
ImageMagick number of supported formats:  => 238
ImageMagick supported formats => 3FR, 3G2, 3GP, AAI, AI, ART, ARW, AVI, AVS, BGR, BGRA, BGRO, BIE, BMP, BMP2, BMP3, BRF, CAL, CALS, CANVAS, CAPTION, CIN, CIP, CLIP, CLIPBOARD, CMYK, CMYKA, CR2, CRW, CUR, CUT, DCM, DCR, DCX, DDS, DFONT, DJVU, DNG, DOT, DPS, DPX, DXT1, DXT5, EMF, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, ERF, EXR, FAX, FILE, FITS, FLIF, FPX, FRACTAL, FTP, FTS, G3, G4, GIF, GIF87, GRADIENT, GRAY, GROUP4, GV, HALD, HDR, HISTOGRAM, HRZ, HTM, HTML, HTTP, HTTPS, ICB, ICO, ICON, IIQ, INFO, INLINE, IPL, ISOBRL, ISOBRL6, J2C, J2K, JBG, JBIG, JNG, JNX, JP2, JPC, JPE, JPEG, JPG, JPM, JPS, JPT, JSON, K25, KDC, LABEL, M2V, M4V, MAC, MAP, MASK, MAT, MATTE, MEF, MIFF, MKV, MNG, MONO, MOV, MP4, MPC, MPEG, MPG, MRW, MSL, MSVG, MTV, MVG, NEF, NRW, NULL, ORF, OTB, OTF, PAL, PALM, PAM, PANGO, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PEF, PES, PFA, PFB, PFM, PGM, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG00, PNG24, PNG32, PNG48, PNG64, PNG8, PNM, PPM, PS, PS2, PS3, PSB, PSD, PTIF, PWP, RADIAL-GRADIENT, RAF, RAS, RAW, RGB, RGBA, RGBO, RGF, RLA, RLE, RMF, RW2, SCR, SCREENSHOT, SCT, SFW, SGI, SHTML, SIX, SIXEL, SPARSE-COLOR, SR2, SRF, STEGANO, SUN, SVG, SVGZ, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TTC, TTF, TXT, UBRL, UBRL6, UIL, UYVY, VDA, VICAR, VID, VIFF, VIPS, VST, WBMP, WEBP, WMF, WMV, WPG, X3F, XBM, XC, XCF, XPM, XPS, XV, YCbCr, YCbCrA, YUV

Directive => Local Value => Master Value
imagick.locale_fix => 0 => 0
imagick.progress_monitor => 0 => 0
imagick.skip_version_check => 0 => 0
PS D:\PHP7.2.12> Get-PhpExtension d:\php7.2.12 | Where-Object {$_.State -ne 'Disabled'} | Select-Object -Property Handle,Type, State
Handle     Type    State  
------     ----    -----  
bcmath     Builtin Builtin
calendar   Builtin Builtin
core       Builtin Builtin
ctype      Builtin Builtin
date       Builtin Builtin
dom        Builtin Builtin
filter     Builtin Builtin
hash       Builtin Builtin
iconv      Builtin Builtin
json       Builtin Builtin
libxml     Builtin Builtin
mysqlnd    Builtin Builtin
pcre       Builtin Builtin
pdo        Builtin Builtin
phar       Builtin Builtin
readline   Builtin Builtin
reflection Builtin Builtin
session    Builtin Builtin
simplexml  Builtin Builtin
spl        Builtin Builtin
standard   Builtin Builtin
tokenizer  Builtin Builtin
wddx       Builtin Builtin
xml        Builtin Builtin
xmlreader  Builtin Builtin
xmlwriter  Builtin Builtin
zip        Builtin Builtin
zlib       Builtin Builtin
imagick    Php     Enabled

PS C:\test> d:\PHP7.2.12\php.exe -r '$image = new Imagick(); $image->newImage(1, 1, new ImagickPixel(\"#ffffff\")); $image->setImageFormat(\"png\"); $pngData = $image->getImagesBlob(); echo strpos($pngData, \"\x89PNG\r\n\x1a\n\") === 0 ? \"Ok\" : \"Failed\";'
Ok

php error_log displays the following error

PHP Warning: PHP Startup: Unable to load dynamic library 'imagick' (tried: d:\PHP7.2.12\ext\imagick (Das angegebene Modul wurde nicht gefunden.), d:\PHP7.2.12\ext\php_imagick.dll (Das angegebene Modul wurde nicht gefunden.)) in Unknown on line 0

running this PHP code , error appears:

<?php
  $image = new Imagick();
  $image->newImage(1, 1, new ImagickPixel('#ffffff'));
  $image->setImageFormat('png');
  $pngData = $image->getImagesBlob();
  echo strpos($pngData, "\x89PNG\r\n\x1a\n") === 0 ? 'Ok' : 'Failed'; 
?>

Fatal error: Uncaught Error: Class 'Imagick' not found in D:\php_projekte\imageMagicTest.php:2 Stack trace: #0 {main} thrown in D:\php_projekte\imageMagicTest.php on line 2

Users rights on extensions

Environment
Windows 2016 Server
PHP 7.3.x
PHPManager 1.20.0

Issue Description
When installing extensions with the PHPManager module, the rights applied on the files are not those I'm expecting. I installed PHP and ImageMagick with Chocolatey and installed ssh2, mongodb and imagick PHP extensions with your module on my windows. Chocolatey seems to apply additionnal read/execute rights for standard users when PHPManager only add the current user rights (here, administrator).
Here's some screenshots to make it more comprehensible.

image
There are the rights applied to sqlite3 extension, "Utilisateurs" refers to all "Users" on the machine I think.

image
There are the rights applied to imagick extension, "J2S" is the user who installed the extension.

I've managed to copy rights with the Get-Acl and Set-Acl commands but I wonder if it could be possible to set these rights "in the Chocolatey way" instead of using the current user (I have no clue of how it's working for Windows).

Cannot switch PHP version due to missing drive

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

Install-PhpExtension not working with params

This worked till about month ago, it seems there is a new parameter?
Running only Install-PhpExtension and then fill out the prompt works.

โฏ Install-PhpExtension xdebug -Version 3
Install-PhpExtension : Cannot bind positional parameters because no names were given.
At line:1 char:1
+ Install-PhpExtension xdebug -Version 3
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Install-PhpExtension], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousPositionalParameterNoName,Install-PhpExtension
 

command for current php versions

Is it possible to add a function to query the current stable php versions?

some examples

Versions-Php 7

result: 7.0.33 / 7.1.27 / 7.2.16 / 7.3.3

Versions-Php 7.2*

result: 7.2.16

Versions-Php 5.6*

result: 5.6.40

Improve support to install pre-release extensions

@mlocati
Currently the MinimumStability parameter can be used to install pre-release extensions, but if a stable version is released afterwards it will install the stable version.

So if there is a Stability optional parameter which forces the extension state, that will be great.
For example following would setup 2.8.0beta2 and not 2.8.1.

Install-PhpExtension xdebug -Stability beta -Version 2.8

Unable to install PHP extensions

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: ......"

Upgrade 7.2 to 7.3 not working - "error extracting from archive"

Hello,
Just attempted to use the Update-Php C:\PHP command.
Was running PHP 7.2, x64 ts on Windows 10, Apache 2.4.39
Got the following output:

> Error extracting from archive:  7-Zip (a) 18.05 (x64) : Copyright (c) 1999-2018
> Igor Pavlov : 2018-04-30  Scanning the drive for archives: 1 file, 26029109
> bytes (25 MiB)  Extracting archive:
> C:\Users\les24\AppData\Local\Temp\tmp896D.zip -- Path =
> C:\Users\les24\AppData\Local\Temp\tmp896D.zip Type = zip Physical Size =
> 26029109  ERROR: Can not delete output file : Access is denied. :
> C:\PHP7\ext\php_curl.dll ERROR: Can not delete output file : Access is denied. :
> C:\PHP7\ext\php_exif.dll ERROR: Can not delete output file : Access is denied. :
> C:\PHP7\ext\php_fileinfo.dll ERROR: Can not delete output file : Access is
> denied. : C:\PHP7\ext\php_ftp.dll ERROR: Can not delete output file : Access is
> denied. : C:\PHP7\ext\php_gd2.dll ERROR: Can not delete output file : Access is
> denied. : C:\PHP7\ext\php_intl.dll ERROR: Can not delete output file : Access is
> denied. : C:\PHP7\ext\php_mbstring.dll ERROR: Can not delete output file :
> Access is denied. : C:\PHP7\ext\php_mysqli.dll ERROR: Can not delete output file
> : Access is denied. : C:\PHP7\ext\php_openssl.dll ERROR: Can not delete output
> file : Access is denied. : C:\PHP7\ext\php_pdo_mysql.dll ERROR: Can not delete
> output file : Access is denied. : C:\PHP7\ext\php_pdo_sqlite.dll ERROR: Can not
> delete output file : Access is denied. : C:\PHP7\ext\php_xmlrpc.dll ERROR: Can
> not delete output file : Access is denied. : C:\PHP7\ext\php_xsl.dll ERROR: Can
> not delete output file : Access is denied. : C:\PHP7\libssh2.dll ERROR: Can not
> delete output file : Access is denied. : C:\PHP7\php7apache2_4.dll ERROR: Can
> not delete output file : Access is denied. : C:\PHP7\php7ts.dll  Sub items
> Errors: 16  Archives with Errors: 1  Sub items Errors: 16
> At C:\Program Files\WindowsPowerShell\Modules\PhpManager\1.14.1.183\private\Expan
> d-ArchiveWith7Zip.ps1:67 char:13
> +             throw "Error extracting from archive: $sevenZipResult"
> +             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>     + CategoryInfo          : OperationStopped: (Error extractin...tems Errors:
>    16:String) [], RuntimeException
>     + FullyQualifiedErrorId : Error extracting from archive:  7-Zip (a) 18.05 (x
>    64) : Copyright (c) 1999-2018 Igor Pavlov : 2018-04-30  Scanning the drive f
>   or archives: 1 file, 26029109 bytes (25 MiB)  Extracting archive: C:\Users\l
>  es24\AppData\Local\Temp\tmp896D.zip -- Path = C:\Users\les24\AppData\Local\T
> emp\tmp896D.zip Type = zip Physical Size = 26029109  ERROR: Can not delete o
> utput file : Access is denied. : C:\PHP7\ext\php_curl.dll ERROR: Can not del
> ete output file : Access is denied. : C:\PHP7\ext\php_exif.dll ERROR: Can no
> t delete output file : Access is denied. : C:\PHP7\ext\php_fileinfo.dll ERRO
> R: Can not delete output file : Access is denied. : C:\PHP7\ext\php_ftp.dll
> ERROR: Can not delete output file : Access is denied. : C:\PHP7\ext\php_gd2.
> dll ERROR: Can not delete output file : Access is denied. : C:\PHP7\ext\php_
> intl.dll ERROR: Can not delete output file : Access is denied. : C:\PHP7\ext
> \php_mbstring.dll ERROR: Can not delete output file : Access is denied. : C:
> \PHP7\ext\php_mysqli.dll ERROR: Can not delete output file : Access is denie
> d. : C:\PHP7\ext\php_openssl.dll ERROR: Can not delete output file : Access
> is denied. : C:\PHP7\ext\php_pdo_mysql.dll ERROR: Can not delete output file
> : Access is denied. : C:\PHP7\ext\php_pdo_sqlite.dll ERROR: Can not delete
> output file : Access is denied. : C:\PHP7\ext\php_xmlrpc.dll ERROR: Can not
> delete output file : Access is denied. : C:\PHP7\ext\php_xsl.dll ERROR: Can
> not delete output file : Access is denied. : C:\PHP7\libssh2.dll ERROR: Can
> not delete output file : Access is denied. : C:\PHP7\php7apache2_4.dll ERROR
> : Can not delete output file : Access is denied. : C:\PHP7\php7ts.dll  Sub i
> tems Errors: 16  Archives with Errors: 1  Sub items Errors: 16

I could not find any info to debug these messages. Can you assist please?

Imagick extension missing DLL

Environment
Windows 2016 Server
PHP 7.3.25
PHPManager 1.25.2

Issue Description
I installed PHP on a fresh new Windows 2016 Server with the latest version of PHPManager but the installation of the imagick extension seemed to not work as intended on some extensions. I realized at some point that one DLL is missing in the PHP install folder, compared to the ImageMagick library folder, the FILTER_analyze.dll_ file.
I checked the code in Install-ImagickPrerequisite.ps1 and wonder why this file is not copied as well as the CORE_RL_* and the IM_MOD_RL_* DLLs. Is there a reason for not getting this file automatically ?

yaml extension fails to enable PHP < 7.2 as it need yaml.dll in path

@mlocati To enable yaml extension on PHP versions before 7.2 requires yaml.dll. So currently it is required to manually extract yaml.dll from the zip into a directory in windows path, it would be great if yaml.dll, if found in the zip archive is extracted to the directory in -Path parameter or the default PHP directory.

Set-Content : Stream was not readable

Randomly when trying to enable or disable a PHP Extension I get the following error message and the INI file is completely cleared(!):

image

Obviously the big thing is the clearing out of the file. I attempted to remedy it a few different ways but was unsuccessful. The cause, I'm guessing, is that IIS is checking for changes to the PHP.ini file in the FastCGI application and if I get it just at that moment, the error occurs.

How to add a custom dll extension? SQLSRV

I couldn't find a way to add a custom extension like php_sqlsrv_56_ts.dll released by Microsoft Drivers do connect with Sql Server. My php.ini has only appointment to ext folder.

Anyone had be able to do it?

Instruction Adding new extensions (from PECL)

The instructions chapter "Adding new extensions (from PECL)" should be extended.
It is not clear that a path is mandatory.

PS D:\php7> Install-PhpExtension win32service
No PHP versions found in the current PATHs: use the -Path argument to specify the location of installed PHP
At C:\Program Files\WindowsPowerShell\Modules\PhpManager\1.13.0.176\private\PhpVersion.ps1:309 char:13

  •         throw "No PHP versions found in the current PATHs: use th ...
    
  •         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : OperationStopped: (No PHP versions...f installed PHP:String) [], RuntimeException
    • FullyQualifiedErrorId : No PHP versions found in the current PATHs: use the -Path argument to specify the location of installed PHP

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.