forked from shivammathur/php-builder-windows
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ef5d399
commit 65a99b3
Showing
5 changed files
with
125 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<# | ||
.Synopsis | ||
Installs PHP nightly. | ||
.Description | ||
Download and installs a nightly version of PHP. | ||
.Parameter Architecture | ||
The architecture of the PHP to be installed (x86 for 32-bit, x64 for 64-bit). | ||
.Parameter ThreadSafe | ||
A boolean value to indicate if the Thread-Safe version should be installed or not. | ||
You usually install the ThreadSafe version if you plan to use PHP with Apache, or the NonThreadSafe version if you'll use PHP in CGI mode. | ||
.Parameter Path | ||
The path of the directory where PHP will be installed. | ||
.Parameter Version | ||
The PHP version | ||
#> | ||
param ( | ||
[Parameter(Mandatory = $true, Position = 1, HelpMessage = 'Architecture of the PHP to be installed (x86 for 32-bit, x64 for 64-bit)')] | ||
[ValidateSet('x86', 'x64')] | ||
[string] $Architecture, | ||
[Parameter(Mandatory = $true, Position = 2, HelpMessage = 'Install a Thread-Safe version?')] | ||
[bool] $ThreadSafe, | ||
[Parameter(Mandatory = $true, Position = 3, HelpMessage = 'The path of the directory where PHP will be installed')] | ||
[ValidateLength(1, [int]::MaxValue)] | ||
[string] $Path, | ||
[Parameter(Mandatory = $false, Position = 4, HelpMessage = 'The PHP version')] | ||
[ValidateLength(1, [int]::MaxValue)] | ||
[string] $Version = '8.0' | ||
) | ||
if(-not(Test-Path $Path)) { | ||
New-Item -Type 'directory' $Path | ||
} | ||
$ts = '-nts' | ||
if($ThreadSafe) { | ||
$ts = '' | ||
} | ||
$branch = 'master' | ||
if($Version -eq '8.0') { | ||
$branch = 'PHP-8.0' | ||
} | ||
$semver = Invoke-RestMethod https://raw.githubusercontent.com/php/php-src/$branch/main/php_version.h | Where-Object { $_ -match 'PHP_VERSION "(.*)"' } | Foreach-Object {$Matches[1]} | ||
Invoke-WebRequest -UseBasicParsing -Uri "https://github.com/shivammathur/php-builder-windows/releases/download/php$Version/php-$semver$ts-Win32-vs16-$Architecture.zip" -OutFile $Path\master.zip | ||
Expand-Archive -Path $Path\master.zip -DestinationPath $Path -Force | ||
Copy-Item $Path\php.ini-production -Destination $Path\php.ini | ||
Move-Item -Path $Path\ext\php_oci8_12c.dll -Destination $Path\ext\php_oci8.dll -Force | ||
$ts = 'nts' | ||
if($ThreadSafe) { | ||
$ts = 'ts' | ||
} | ||
"xdebug", "pcov" | ForEach-Object { Invoke-WebRequest -UseBasicParsing -Uri "https://github.com/shivammathur/php-extensions-windows/releases/latest/download/php$Version`_$ts`_$Architecture`_$_.dll" -OutFile $Path"\ext\php`_$_.dll" } | ||
$ini_content = @" | ||
extension_dir=$Path\ext | ||
default_charset=UTF-8 | ||
zend_extension=php_opcache.dll | ||
opcache.enable=1 | ||
opcache.jit_buffer_size=256M | ||
opcache.jit=1235 | ||
"@ | ||
Add-Content -Path $Path\php.ini -Value $ini_content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<# | ||
.Synopsis | ||
Installs PHP nightly. | ||
.Description | ||
Download and installs a nightly version of PHP. | ||
.Parameter Architecture | ||
The architecture of the PHP to be installed (x86 for 32-bit, x64 for 64-bit). | ||
.Parameter ThreadSafe | ||
A boolean value to indicate if the Thread-Safe version should be installed or not. | ||
You usually install the ThreadSafe version if you plan to use PHP with Apache, or the NonThreadSafe version if you'll use PHP in CGI mode. | ||
.Parameter Path | ||
The path of the directory where PHP will be installed. | ||
.Parameter Version | ||
The PHP version | ||
#> | ||
param ( | ||
[Parameter(Mandatory = $true, Position = 1, HelpMessage = 'Architecture of the PHP to be installed (x86 for 32-bit, x64 for 64-bit)')] | ||
[ValidateSet('x86', 'x64')] | ||
[string] $Architecture, | ||
[Parameter(Mandatory = $true, Position = 2, HelpMessage = 'Install a Thread-Safe version?')] | ||
[bool] $ThreadSafe, | ||
[Parameter(Mandatory = $true, Position = 3, HelpMessage = 'The path of the directory where PHP will be installed')] | ||
[ValidateLength(1, [int]::MaxValue)] | ||
[string] $Path, | ||
[Parameter(Mandatory = $false, Position = 4, HelpMessage = 'The PHP version')] | ||
[ValidateLength(1, [int]::MaxValue)] | ||
[string] $Version = '8.1' | ||
) | ||
if(-not(Test-Path $Path)) { | ||
New-Item -Type 'directory' $Path | ||
} | ||
$ts = '-nts' | ||
if($ThreadSafe) { | ||
$ts = '' | ||
} | ||
if($Version -eq '8.0') { | ||
Install-Php -Version $Version -Architecture $Architecture -ThreadSafe $ThreadSafe -InstallVC -Path $Path -TimeZone UTC -InitialPhpIni Production -Force | ||
} else { | ||
Invoke-WebRequest -UseBasicParsing -Uri "https://github.com/shivammathur/php-builder-windows/releases/download/php$Version/php-$Version.0-dev$ts-Win32-vs16-$Architecture.zip" -OutFile $Path\master.zip | ||
Expand-Archive -Path $Path\master.zip -DestinationPath $Path -Force | ||
Copy-Item $Path\php.ini-production -Destination $Path\php.ini | ||
} | ||
Move-Item -Path $Path\ext\php_oci8_12c.dll -Destination $Path\ext\php_oci8.dll -Force | ||
$ts = 'nts' | ||
if($ThreadSafe) { | ||
$ts = 'ts' | ||
} | ||
"xdebug", "pcov" | ForEach-Object { Invoke-WebRequest -UseBasicParsing -Uri "https://github.com/shivammathur/php-extensions-windows/releases/latest/download/php$Version`_$ts`_$Architecture`_$_.dll" -OutFile $Path"\ext\php`_$_.dll" } | ||
$ini_content = @" | ||
extension_dir=$Path\ext | ||
default_charset=UTF-8 | ||
zend_extension=php_opcache.dll | ||
opcache.enable=1 | ||
opcache.jit_buffer_size=256M | ||
opcache.jit=1235 | ||
"@ | ||
Add-Content -Path $Path\php.ini -Value $ini_content |