2017-06-01 03:11:10 +02:00
|
|
|
Param(
|
|
|
|
[Parameter(Mandatory=$True,Position=1)]
|
2017-08-22 00:46:39 +02:00
|
|
|
[string]$PHP_ZIP,
|
|
|
|
[Parameter(Mandatory=$True,Position=2)]
|
|
|
|
[string]$SQLSRV_DRIVER,
|
2017-06-01 03:11:10 +02:00
|
|
|
[Parameter(Mandatory=$True,Position=3)]
|
2017-08-22 00:46:39 +02:00
|
|
|
[string]$PDO_DRIVER
|
2017-06-01 03:11:10 +02:00
|
|
|
)
|
|
|
|
|
2017-08-22 00:46:39 +02:00
|
|
|
$ErrorActionPreference = "Stop"
|
2017-07-14 04:13:57 +02:00
|
|
|
|
2017-06-01 03:11:10 +02:00
|
|
|
$startingDir=$pwd.Path
|
|
|
|
$tempFolder=Join-Path $startingDir "temp"
|
2017-06-02 02:35:44 +02:00
|
|
|
|
2017-06-01 03:11:10 +02:00
|
|
|
Remove-Item temp -Recurse -Force -ErrorAction Ignore
|
|
|
|
New-Item -ItemType directory -Path temp
|
|
|
|
|
2017-06-22 22:22:37 +02:00
|
|
|
Write-Host "Installing chocolatey..."
|
|
|
|
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
|
2017-06-01 03:11:10 +02:00
|
|
|
Write-Host "Installing Git..."
|
2017-07-07 02:19:21 +02:00
|
|
|
choco install -y git
|
2017-08-22 00:46:39 +02:00
|
|
|
|
|
|
|
$gitDir = 'C:\Program Files\Git\cmd\git.exe'
|
2017-06-19 23:32:24 +02:00
|
|
|
Write-Host "Installing Python3..."
|
2017-07-07 02:19:21 +02:00
|
|
|
choco install -y python3
|
|
|
|
RefreshEnv
|
2017-06-19 23:32:24 +02:00
|
|
|
Write-Host "Installing pyodbc..."
|
2017-07-07 03:00:33 +02:00
|
|
|
C:\Python*\Scripts\pip3.exe install pyodbc | Out-Null
|
2017-06-01 03:11:10 +02:00
|
|
|
Write-Host "Downloading MSODBCSQL..."
|
2017-07-07 02:19:21 +02:00
|
|
|
#This needs to be manually updated when there is a new release
|
2017-06-01 03:11:10 +02:00
|
|
|
(New-object System.Net.WebClient).DownloadFile('https://download.microsoft.com/download/D/5/E/D5EEF288-A277-45C8-855B-8E2CB7E25B96/x64/msodbcsql.msi', "$tempFolder\msodbcsql.msi")
|
|
|
|
Write-Host "Installing MSODBCSQL..."
|
|
|
|
msiexec /quiet /passive /qn /i $tempFolder\msodbcsql.msi IACCEPTMSODBCSQLLICENSETERMS=YES | Out-Null
|
|
|
|
Write-Host "Installing 7-Zip..."
|
2017-07-07 02:19:21 +02:00
|
|
|
choco install -y 7zip.install
|
|
|
|
|
2017-08-22 00:46:39 +02:00
|
|
|
Write-Host "Installing PHP..."
|
|
|
|
$phpDir="C:\php"
|
|
|
|
|
|
|
|
# remove existing PHP and setup new one
|
|
|
|
Remove-Item $phpDir -Recurse -ErrorAction Ignore
|
|
|
|
New-Item -ItemType directory -Path $phpDir
|
|
|
|
Expand-Archive $PHP_ZIP -DestinationPath $phpDir
|
2017-08-26 00:15:24 +02:00
|
|
|
|
|
|
|
# copy drivers to extensions directory and rename to a standard nomenclature
|
|
|
|
# for consistency with run-perf_tests.py
|
|
|
|
Copy-Item $SQLSRV_DRIVER $phpDir\ext\php_sqlsrv.dll
|
|
|
|
Copy-Item $PDO_DRIVER $phpDir\ext\php_pdo_sqlsrv.dll
|
2017-08-22 00:46:39 +02:00
|
|
|
|
|
|
|
# setup driver
|
|
|
|
Copy-Item $phpDir\php.ini-production $phpDir\php.ini
|
|
|
|
Add-Content $phpDir\php.ini "extension=$phpDir\ext\php_openssl.dll"
|
|
|
|
Add-Content $phpDir\php.ini "extension=$phpDir\ext\php_mbstring.dll"
|
|
|
|
|
2017-08-26 00:15:24 +02:00
|
|
|
Add-Content $phpDir\php.ini "extension=$phpDir\ext\php_sqlsrv.dll"
|
|
|
|
Add-Content $phpDir\php.ini "extension=$phpDir\ext\php_pdo_sqlsrv.dll"
|
2017-08-22 00:46:39 +02:00
|
|
|
|
|
|
|
Move-Item $phpDir\php.ini C:\Windows -force
|
|
|
|
Copy-Item $phpDir\ssleay32.dll C:\Windows -force
|
|
|
|
Copy-Item $phpDir\libeay32.dll C:\Windows -force
|
2017-06-02 02:35:44 +02:00
|
|
|
cd $startingDir
|
2017-08-22 00:46:39 +02:00
|
|
|
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";" + $phpDir + ";" + $gitDir, [System.EnvironmentVariableTarget]::Machine)
|
|
|
|
$env:Path = $env:Path + ";" + $phpDir + ";" + $gitDir
|
2017-07-07 02:19:21 +02:00
|
|
|
RefreshEnv
|
2017-08-22 00:46:39 +02:00
|
|
|
|
|
|
|
# setup composer
|
2017-06-02 02:35:44 +02:00
|
|
|
wget https://getcomposer.org/installer -O composer-setup.php
|
|
|
|
php composer-setup.php
|
2017-07-07 03:43:31 +02:00
|
|
|
php composer.phar install
|
|
|
|
Remove-Item temp -Recurse -Force -ErrorAction Ignore
|
2017-08-22 00:46:39 +02:00
|
|
|
Write-Host "Setup completed!"
|