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

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

schmidtl4 opened this issue · comments

commented

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?

Your apache service is up and running, isn't it?

If so, the apache process is locking some files in the PHP installation directory (for example, php7apache2_4.dll), so PhpManager can't overwrite those files.

If your apache service is called Apache, you can update PHP with the following commands:

Stop-Service Apache
Update-Php C:\PHP
Start-Service Apache

Please remark that the Start-Service / Stop-Service commands require admin rights, so you may need to run them in an elevated powershell instance (that is, Run as Administrator).

commented

Yes Apache is up and running and restarted after installation. But the name is Apache24 and PHP is in PHP7. So would the correct commands be:
Stop-Service Apache24
Update-Php C:\PHP7
Start-Service Apache24

Yep, that should be correct.

commented

That worked. Thanks!

You can also stop/start the Apache24 service in a normal (non elevated) shell by running these two commands

Start-Process -FilePath 'powershell.exe' -ArgumentList 'Stop-Service Apache24' -Verb RunAs -Wait -WindowStyle Hidden
Update-Php C:\PHP7
Start-Process -FilePath 'powershell.exe' -ArgumentList 'Start-Service Apache24' -Verb RunAs -Wait -WindowStyle Hidden

(but Windows will ask you twice to allow the execution of the two elevated commands)