Choco: PHP Package won't upgrade or uninstall - Path Bind Error

Created on 15 May 2018  路  22Comments  路  Source: chocolatey/choco

I tried upgrading from PHP 7.2.3 > 7.2.5
https://chocolatey.org/packages/php

Win 7 x64

Other packages work fine, only PHP has the problem

Here's the log:
2018-05-15 09:14:57,223 3092 [INFO ] - VERBOSE: Importing alias 'Start-ChocolateyProcess'.
2018-05-15 09:14:57,267 3092 [DEBUG] - Running 'ChocolateyScriptRunner' for php v7.2.3 with packageScript 'C:\ProgramData\chocolatey\lib\php\tools\chocolateyUninstall.ps1', packageFolder:'C:\ProgramData\chocolatey\lib\php', installArguments: '', packageParameters: '',
2018-05-15 09:14:57,282 3092 [DEBUG] - Running 'C:\ProgramData\chocolatey\lib\php\tools\chocolateyUninstall.ps1'
2018-05-15 09:14:57,296 3092 [DEBUG] - Checking for uninstall text document in C:\ProgramData\chocolatey\lib\php\tools..
2018-05-15 09:14:57,351 3092 [DEBUG] - Running Uninstall-ChocolateyZipPackage -packageName 'php' -zipFileName 'php-7.2.3-nts-Win32-VC15-x64.zip'
2018-05-15 09:14:57,364 3092 [ERROR] - ERROR: Cannot bind argument to parameter 'Path' because it is null.
2018-05-15 09:14:57,376 3092 [DEBUG] - Built-in PowerShell host called with ['[System.Threading.Thread]::CurrentThread.CurrentCulture = '';[System.Threading.Thread]::CurrentThread.CurrentUICulture = ''; & import-module -name 'C:\ProgramData\chocolatey\helpers\chocolateyInstaller.psm1'; & 'C:\ProgramData\chocolatey\helpers\chocolateyScriptRunner.ps1' -packageScript 'C:\ProgramData\chocolatey\lib\php\tools\chocolateyUninstall.ps1' -installArguments '' -packageParameters '''] exited with '-1'.
2018-05-15 09:14:57,386 3092 [DEBUG] - Calling command ['"C:\Windows\System32\shutdown.exe" /a']
2018-05-15 09:14:57,431 3092 [DEBUG] - Command ['"C:\Windows\System32\shutdown.exe" /a'] exited with '1116'
2018-05-15 09:14:57,437 3092 [ERROR] - php uninstall not successful.
2018-05-15 09:14:57,446 3092 [ERROR] - Error while running 'C:\ProgramData\chocolatey\lib\php\tools\chocolateyUninstall.ps1'.
See log for details.
2018-05-15 09:14:57,453 3092 [ERROR] - php not uninstalled. An error occurred during uninstall:
php uninstall not successful.

Package Issue

Most helpful comment

@jansohn only workaround that I know of currently is:

  1. Uninstall the package without running the uninstall script (choco uninstall php -n, this will leave the installed directory though).
  2. Then install the package again.

All 22 comments

@Jimmy03 hopefully you would have noted this:

DO NOT CREATE ISSUES FOR PACKAGES. Read over Submitting Issues.

In the issue template when you created this issue. This repository is for reporting issues with Chocolatey itself, not for packages hosted on the Community Repository.

My best suggestion would be for you to raise this issue here:

https://github.com/chocolatey/chocolatey-coreteampackages/issues

@gep13 actually, I think this issue is related to the following issue: https://github.com/chocolatey/choco/issues/1550

which is a bug in choco, and not in the package itself.

@AdmiringWorm upgrade, not uninstall.

Okay, why does upgrade call uninstall?

That's considered an anti-pattern and not something we like used. Shared functionality should have a file between they both call, but calling chocolateyUninstall.ps1 is from the chocolateyInstall.ps1 is considered an anti-pattern of sorts.

@ferventcoder yes, but the php package uninstalls the current version by using the Uninstall-ChocolateyZipPackage before installing the the new php version.

Okay, why does upgrade call uninstall?

Because by request (or was it due to previous history), versioned directories wanted to be used in the php package.

That's considered an anti-pattern and not something we like used. Shared functionality should have a file between they both call, but calling chocolateyUninstall.ps1 is from the chocolateyInstall.ps1 is considered an anti-pattern of sorts.

The chocolateyInstall.ps1 file doesn't call chocolateyUninstall.ps1, it uses a helper file that makes the necessary changes. The uninstaller uses the same function though. It seems like the wrong logs have been provided though.

https://github.com/chocolatey/chocolatey-coreteampackages/blob/master/automatic/php/tools/helpers.ps1#L69-L82

https://github.com/chocolatey/chocolatey-coreteampackages/blob/master/automatic/php/tools/chocolateyInstall.ps1#L8-L12

I don't have the original install log, as it is from long ago.

I can provide other logs if needed (upgrade or uninstall)

chocolatey.log
Here is the log of choco update php -d from V. 7.2.3 to V. 7.2.5

@bedo2991 this is fixed in the commit https://github.com/chocolatey/choco/commit/93c33943a7d5f12bf8a05d8843b688fff11545d9

which will be available in the next release of choco.

I still have this issue, upgrading php 7.2.5 to 7.2.8, using choco v. 0.10.11 (May 5th), Windows 10 Enterprise, x64

ERROR: Cannot bind argument to parameter 'Path' because it is null.
The upgrade of php was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\php\tools\chocolateyInstall.ps1'.

chocolatey.log

Same Problem on uninstall because upgrade doesnt work.

ERROR: Cannot bind argument to parameter 'Path' because it is null.
php uninstall not successful.
Error while running 'C:\ProgramData\chocolatey\lib\php\tools\chocolateyUninstall.ps1'.
 See log for details.
php not uninstalled. An error occurred during uninstall:
 php uninstall not successful.

Chocolatey uninstalled 0/1 packages. 1 packages failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Failures
 - php (exited -1) - Error while running 'C:\ProgramData\chocolatey\lib\php\tools\chocolateyUninstall.ps1'.
 See log for details.

chocolatey.log

@gep13, can you reopen this? https://github.com/chocolatey/chocolatey-coreteampackages/issues/1047 marked it as an upstream issue.

@Zenexer no need to open this, it's already fixed in the codebase, but won't be available until the release of 0.10.12.

The actual issues for this problem is:
https://github.com/chocolatey/choco/issues/1546
and
https://github.com/chocolatey/choco/issues/1550

@AdmiringWorm Thanks; good to know I can stop worrying about it.

What's the workaround to get it working with 0.10.11?

@jansohn only workaround that I know of currently is:

  1. Uninstall the package without running the uninstall script (choco uninstall php -n, this will leave the installed directory though).
  2. Then install the package again.

Thanks @AdmiringWorm it works!

Thanks for the workaround. But what if I need to install different versions of PHP in different folders? Using --force and /InstallDir trying to install another version in a different path tries to uninstall the previous version:

Uninstalling previous version of php...
ERROR: Cannot bind argument to parameter 'Path' because it is null.
The install of php was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\php\tools\chocolateyInstall.ps1'.

I don't want to uninstall the previous version but to install two different versions.
What can I do to solve this with choco 0.10.11?
THANKS!

@ilcasco-hectora you should actually be able to use the workaround I mentioned to achieve what you want.

choco uninstall php -n
choco install php --params "/InstallDir:C:\I\Want\It\Here"

The first line just removes the package, without actually run the uninstall script (so the old installation directory is still available).
Then just install it again.

Other than that, I'm afraid I have no other solution for you.

I just used the choco uninstall php -n command at first because I had problems installing even one version. Now with your advice, I have both versions installed. So I can summarize the uninstall command has to be used for every version that needs to be installed on another path.

Thanks for your quick response.

Was this page helpful?
0 / 5 - 0 ratings