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

Support for self compiled builds from master branch

shivammathur opened this issue · comments

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.

I agree that it'd be nice.

I see some problems though...

  1. people may want to install a development version from https://windows.php.net/snapshots#php-master or from a local directory
    For that reason, I'd add a -FromPath option to the Install-Php command. If it's specified, we'll look in that folder, otherwise we'll look in the relevant https://windows.php.net page, that is
  1. the PHP version of the master branch changes across time (it's 8.0.0-dev now, but it'll change once 8.0 is branched), so I'd let people install it with a value of master in the -Version parameter of the Install-Php command.

  2. the value of ZEND_MODULE_API_NO changes across time for development builds in the Zend/zend_modules.h file.
    How can we handle it? Should we consider an unknown value (that is, not listed here as master? Or should we create a scheduled job (in TravisCI or in GitHub Actions) that periodically checks the constant value, and rebuilds the Inspect-PhpExtension executables if it changes?
    Furthermore, if we install a master build, add some extensions to it, then we upgrade the master build to a newer version that changes the value of the ZEND_MODULE_API_NO, we'd have a broken PHP installation. Should PhpManager handle this case? Or delegate this check to the users?

  • I agree with your first and second point. Support for snapshot builds in Install-Php function will be great.

  • For the third point I agree with your suggestion of a placeholder master and fetching it from Zend/zend_modules.h in scripts dealing with extensions.

Something like this should work.

$ZEND_MODULES_H_URL = 'https://raw.githubusercontent.com/php/php-src/master/Zend/zend_modules.h'
if($ZEND_MODULE_API_NO -eq 'master') {
    $ZEND_MODULE_API_NO = Invoke-WebRequest -Uri $ZEND_MODULES_H_URL | Select-String -Pattern '#define\sZEND_MODULE_API_NO\s(\d+)' | % {$_.Matches.Groups[1].Value}
}

What about #46 ? It allows users to install and update snapshots (eg 7.4snapshot, master) downloading them from https://windows.php.net/downloads/snaps/.
It doesn't allow users to "install" self compiled binaries, but users can copy the relevant files quite easily with simple scripts, and they can use PhpManager to manage them.

Thanks 👍. Works great.

I just released version 1.22 with support for snapshot builds.