resolve merge conflicts
This commit is contained in:
parent
0c8a4b731a
commit
463d30b0ad
|
@ -1,28 +1,32 @@
|
||||||
## Setup Environment on a clean machine
|
## Setup Environment on a clean machine
|
||||||
|
|
||||||
### Windows
|
The PHP zip file can be downloaded from <http://php.net/downloads.php>.
|
||||||
Install Visual Studio 2015 before running the following commands. Make sure C++ tools are enabled.
|
|
||||||
Run `cmd` as administrator.
|
The SQLSRV and PDO_SQLSRV driver binaries can be downloaded from <https://github.com/Microsoft/msphpsql/releases>.
|
||||||
|
|
||||||
|
### Windows
|
||||||
|
Install Visual Studio 2015 redistributable before running the following commands.
|
||||||
|
Run `Windows PowerShell` as administrator.
|
||||||
|
|
||||||
powershell
|
|
||||||
Set-ExecutionPolicy Unrestricted
|
Set-ExecutionPolicy Unrestricted
|
||||||
.\setup_env_windows.ps1 <PHP_VERSION - 7.x.x> <PHP_THREAD - ts or nts> <Absolute path to driver source folder> <ARCH - x86 or x64>
|
.\setup_env_windows.ps1 <absolute path to the PHP zip file> <absolute path to the SQLSRV driver DLL> <absolute path to the PDO_SQLSRV driver DLL>
|
||||||
|
|
||||||
### Ubuntu 16
|
### Ubuntu 16
|
||||||
sudo env "PATH=$PATH" bash setup_env_unix.sh Ubuntu16 <PHP_VERSION - 7.x.x> <PHP_THREAD - ts or nts> <Absolute path to driver source folder>
|
sudo env "PATH=$PATH" bash setup_env_unix.sh Ubuntu16 <PHP_VERSION - 7.x.y> <PHP_THREAD - ts or nts> <absolute path to the SQLSRV driver so> <absolute path to the PDO_SQLSRV driver so>
|
||||||
### RedHat 7
|
### RedHat 7
|
||||||
sudo env "PATH=$PATH" bash setup_env_unix.sh RedHat7 <PHP_VERSION - 7.x.x> <PHP_THREAD - ts or nts> <Absolute path to driver source folder>
|
sudo env "PATH=$PATH" bash setup_env_unix.sh RedHat7 <PHP_VERSION - 7.x.y> <PHP_THREAD - ts or nts> <absolute path to the SQLSRV driver so> <absolute path to the PDO_SQLSRV driver so>
|
||||||
### Sierra
|
### MacOS 10.12 Sierra
|
||||||
`brew` cannot be run with `sudo` on Sierra. Either enable passwordless `sudo` on the machine or enter the password when prompted.
|
`brew` cannot be run with `sudo` on Sierra. Either enable passwordless `sudo` on the machine or enter the password when prompted.
|
||||||
|
|
||||||
bash setup_env_unix.sh Sierra <PHP_VERSION - 7.x.x> <PHP_THREAD - ts or nts> <Absolute path to driver source folder>
|
bash setup_env_unix.sh Sierra <PHP_VERSION - 7.x.y> <PHP_THREAD - ts or nts> <absolute path to the SQLSRV driver so> <absolute path to the PDO_SQLSRV driver so>
|
||||||
## Run benchmarks
|
## Run benchmarks
|
||||||
PHPBench is used to run the benchmarks. Visit http://phpbench.readthedocs.io/en/latest/introduction.html to have an idea how the tool works.
|
PHPBench is used to run the benchmarks. Visit http://phpbench.readthedocs.io/en/latest/introduction.html to have an idea how the tool works.
|
||||||
|
|
||||||
### 1. Modify lib/connect.php with the test database credentials
|
##### 1. Modify lib/connect.php with the test database credentials
|
||||||
### 2. Modify lib/result_db.php with the result database credentials
|
##### 2. Modify lib/result_db.php with the result database credentials
|
||||||
### 3. The number of iterations for each test can be modified in the test itself (e.g., in test/Performance/benchmark/sqlsrv). Each test has a @Iteration(n) annotation. If you change the number in this annotation, you will change the number of iterations run for this test. By default, most tests are set to 1000 iterations.
|
##### 3. The number of iterations for each test can be modified in the test itself (e.g., in test/Performance/benchmark/sqlsrv). Each test has a @Iteration(n) annotation. If you change the number in this annotation, you will change the number of iterations run for this test. By default, most tests are set to 1000 iterations.
|
||||||
### 4. Execute run-perf_tests.py.
|
##### 4. Execute run-perf_tests.py.
|
||||||
|
|
||||||
### Windows
|
### Windows
|
||||||
py.exe run-perf_tests.py -platform <PLATFORM> > tee run-perf_output.txt
|
py.exe run-perf_tests.py -platform <PLATFORM> > tee run-perf_output.txt
|
||||||
### Linux and Mac
|
### Linux and Mac
|
||||||
|
@ -30,6 +34,16 @@ On Linux and Mac, the script must be executed with `sudo python3` because to ena
|
||||||
|
|
||||||
python3 run-perf_tests.py -platform <PLATFORM> | tee run-perf_output.txt
|
python3 run-perf_tests.py -platform <PLATFORM> | tee run-perf_output.txt
|
||||||
|
|
||||||
`-platform` - The platform that the tests are ran on. Must be one of the following: Windows10, WindowsServer2016, WindowsServer2012, Ubuntu16, RedHat7, Sierra
|
<<<<<<< HEAD
|
||||||
|
`-platform` - The platform that the tests are ran on. Must be one of the following: Windows10, WindowsServer2016, WindowsServer2012, Ubuntu16, RedHat7, Sierra.
|
||||||
`-php-driver` (optional) - The driver that the tests are ran on. Must be one of the following: sqlsrv, pdo_sqlsrv, or both. Default is both.
|
`-php-driver` (optional) - The driver that the tests are ran on. Must be one of the following: sqlsrv, pdo_sqlsrv, or both. Default is both.
|
||||||
`-test-only` (optional) - The test to run. Must be the file name (not including path) of one test or 'all'. Default is 'all'. If one test is specified, must also specify the -php-driver option to sqlsrv or pdo_sqlsrv.
|
`-test-only` (optional) - The test to run. Must be the file name (not including path) of one test or 'all'. Default is 'all'. If one test is specified, must also specify the -php-driver option to sqlsrv or pdo_sqlsrv.
|
||||||
|
=======
|
||||||
|
`-platform` - The platform that the tests are ran on. Must be one of the following: Windows10, WindowsServer2016, WindowsServer2012, Ubuntu16, RedHat7, Sierra.
|
||||||
|
`-iterations` - The number of iterations for regular tests.
|
||||||
|
`-iterations-large` - The number of iterations for the tests that fetch large data. Usually set to 1.
|
||||||
|
`-result-server` - The server containing the result database. It is assumed that the result database s already setup before running the tests.
|
||||||
|
`-result-db` - Database name. With the current result database setup files, this should be set to `TestResults`.
|
||||||
|
`-result-uid` - Result database username.
|
||||||
|
`-result-pwd` - Result database password.
|
||||||
|
>>>>>>> upstream/dev
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
set options=%2
|
|
||||||
set options=%options:"=%
|
|
||||||
C:\php-sdk\bin\phpsdk_setvars.bat && "c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %1 && .\buildconf --force && .\configure %options% && nmake && nmake install
|
|
|
@ -1,72 +1,91 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [[ ("$1" = "Ubuntu16" || "$1" = "RedHat7" || "$1" = "Sierra") ]]; then
|
if [[ ("$1" = "Ubuntu16" || "$1" = "RedHat7" || "$1" = "Sierra") ]]; then
|
||||||
PLATFORM=$1
|
PLATFORM=$1
|
||||||
else
|
else
|
||||||
echo "First argument must be one of Ubuntu16, RedHat7, Sierra. Exiting..."
|
echo "1st argument must be one of Ubuntu16, RedHat7, Sierra. Exiting..."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$2" != 7.*.* ]]; then
|
if [[ "$2" != 7.*.* ]]; then
|
||||||
echo "Second argument must be PHP version in format of 7.x.x.Exiting..."
|
echo "2nd argument must be PHP version in format of 7.x.y. Exiting..."
|
||||||
exit
|
exit
|
||||||
else
|
else
|
||||||
PHP_VERSION=$2
|
PHP_VERSION=$2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ("$3" != "nts" && "$3" != "ts") ]]; then
|
if [[ ("$3" != "nts" && "$3" != "ts") ]]; then
|
||||||
echo "Thrid argument must be either nts or ts. Exiting..."
|
echo "3rd argument must be either nts or ts. Exiting..."
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
PHP_THREAD=$3
|
PHP_THREAD=$3
|
||||||
fi
|
fi
|
||||||
if [[ (! -d "$4") || (! -d $4/sqlsrv) || (! -d $4/pdo_sqlsrv) || (! -d $4/shared) ]]; then
|
|
||||||
echo "Fourth argument must be path to source folder.Path not found.Exiting..."
|
if [[ (! -f "$4") || (! -f "$5") ]]; then
|
||||||
|
echo "5th and 6th argument must be paths to sqlsrv and pdo drivers. Exiting..."
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
DRIVER_SOURCE_PATH=$4
|
SQLSRV_DRIVER=$4
|
||||||
|
PDO_DRIVER=$5
|
||||||
fi
|
fi
|
||||||
rm -rf env_setup.log
|
|
||||||
touch env_setup.log
|
|
||||||
if [ $PLATFORM = "Ubuntu16" ]; then
|
if [ $PLATFORM = "Ubuntu16" ]; then
|
||||||
echo "Update..."
|
printf "Update..."
|
||||||
yes | sudo dpkg --configure -a >> env_setup.log 2>&1
|
yes | sudo dpkg --configure -a > env_setup.log
|
||||||
yes | sudo apt-get update >> env_setup.log 2>&1
|
yes | sudo apt-get update >> env_setup.log
|
||||||
echo "Installing git, zip, curl, libxml, autoconf, openssl, python3, pip3..."
|
printf "done\n"
|
||||||
yes | sudo apt-get install git zip curl autoconf libxml2-dev libssl-dev pkg-config python3 python3-pip >> env_setup.log 2>&1
|
|
||||||
echo "OK"
|
printf "Installing git, zip, curl, libxml, autoconf, openssl, python3, pip3..."
|
||||||
echo "Installing MSODBCSQL..."
|
yes | sudo apt-get install git zip curl autoconf libxml2-dev libssl-dev pkg-config python3 python3-pip >> env_setup.log
|
||||||
|
printf "done\n"
|
||||||
|
|
||||||
|
printf "Installing MSODBCSQL..."
|
||||||
curl -s https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
|
curl -s https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
|
||||||
curl -s https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
|
curl -s https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
|
||||||
yes | sudo apt-get update >> env_setup.log 2>&1
|
yes | sudo apt-get update >> env_setup.log
|
||||||
yes | sudo ACCEPT_EULA=Y apt-get install msodbcsql >> env_setup.log 2>&1
|
yes | sudo ACCEPT_EULA=Y apt-get install msodbcsql >> env_setup.log
|
||||||
yes | sudo apt-get install -qq unixodbc-dev >> env_setup.log 2>&1
|
yes | sudo apt-get install -qq unixodbc-dev >> env_setup.log
|
||||||
echo "Installing pyodbc"
|
printf "done\n"
|
||||||
pip3 install --upgrade pip >> env_setup.log 2>&1
|
|
||||||
pip3 install pyodbc >> env_setup.log 2>&1
|
printf "Installing pyodbc"
|
||||||
echo "OK"
|
pip3 install --upgrade pip >> env_setup.log
|
||||||
|
pip3 install pyodbc >> env_setup.log
|
||||||
|
printf "done\n"
|
||||||
|
|
||||||
elif [ $PLATFORM = "RedHat7" ]; then
|
elif [ $PLATFORM = "RedHat7" ]; then
|
||||||
echo "Update..."
|
printf "Update..."
|
||||||
yes | sudo yum update >> env_setup.log 2>&1
|
yes | sudo yum update >> env_setup.log
|
||||||
echo "OK"
|
printf "done\n"
|
||||||
echo "Enabling EPEL repo..."
|
|
||||||
|
printf "Enabling EPEL repo..."
|
||||||
|
# pipe non-error to log file (wget and yum install reports error when there's nothing to do)
|
||||||
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm >> env_setup.log 2>&1
|
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm >> env_setup.log 2>&1
|
||||||
yes | sudo yum install epel-release-latest-7.noarch.rpm >> env_setup.log 2>&1 || true
|
yes | sudo yum install epel-release-latest-7.noarch.rpm >> env_setup.log 2>&1 || true
|
||||||
echo "OK"
|
printf "done\n"
|
||||||
echo "Installing python34-setuptools..."
|
|
||||||
yes | sudo yum install python34-setuptools -y >> env_setup.log 2>&1
|
printf "Installing python34-setuptools..."
|
||||||
echo "OK"
|
yes | sudo yum install python34-setuptools -y >> env_setup.log
|
||||||
echo "Installing gcc, git, zip libxml, openssl, EPEL, python3, pip3..."
|
printf "done\n"
|
||||||
yes | sudo yum install -y gcc-c++ libxml2-devel git zip openssl-devel python34 python34-devel python34-pip >> env_setup.log 2>&1
|
|
||||||
echo "OK"
|
printf "Installing gcc, git, zip libxml, openssl, EPEL, python3, pip3..."
|
||||||
echo "Installing MSODBCSQL..."
|
yes | sudo yum install -y gcc-c++ libxml2-devel git zip openssl-devel python34 python34-devel python34-pip >> env_setup.log
|
||||||
|
printf "done\n"
|
||||||
|
|
||||||
|
printf "Installing MSODBCSQL..."
|
||||||
curl -s https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/mssql-release.repo
|
curl -s https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/mssql-release.repo
|
||||||
(yes | sudo ACCEPT_EULA=Y yum install -y msodbcsql >> env_setup.log 2>&1)
|
(yes | sudo ACCEPT_EULA=Y yum install -y msodbcsql >> env_setup.log)
|
||||||
(yes | sudo yum install -y unixODBC-devel autoconf >> env_setup.log 2>&1)
|
(yes | sudo yum install -y unixODBC-devel autoconf >> env_setup.log)
|
||||||
echo "OK"
|
printf "done\n"
|
||||||
echo "Installing pyodbc"
|
|
||||||
pip3 install --upgrade pip >> env_setup.log 2>&1
|
printf "Installing pyodbc"
|
||||||
pip3 install pyodbc >> env_setup.log 2>&1
|
pip3 install --upgrade pip >> env_setup.log
|
||||||
echo "OK"
|
pip3 install pyodbc >> env_setup.log
|
||||||
|
printf "done\n"
|
||||||
|
|
||||||
elif [ $PLATFORM = "Sierra" ]; then
|
elif [ $PLATFORM = "Sierra" ]; then
|
||||||
|
<<<<<<< HEAD
|
||||||
echo "Installing homebrew..."
|
echo "Installing homebrew..."
|
||||||
yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" >> env_setup.log 2>&1
|
yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" >> env_setup.log 2>&1
|
||||||
echo "OK"
|
echo "OK"
|
||||||
|
@ -92,49 +111,108 @@ elif [ $PLATFORM = "Sierra" ]; then
|
||||||
echo "Installing pyodbc..."
|
echo "Installing pyodbc..."
|
||||||
pip3 install pyodbc >> env_setup.log 2>&1
|
pip3 install pyodbc >> env_setup.log 2>&1
|
||||||
echo "OK"
|
echo "OK"
|
||||||
|
=======
|
||||||
|
printf "Installing homebrew..."
|
||||||
|
yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" >> env_setup.log
|
||||||
|
printf "done\n"
|
||||||
|
|
||||||
|
printf "Installing wget..."
|
||||||
|
brew install wget >> env_setup.log
|
||||||
|
printf "done\n"
|
||||||
|
|
||||||
|
printf "Installing svn..."
|
||||||
|
brew install svn >> env_setup.log
|
||||||
|
printf "done\n"
|
||||||
|
|
||||||
|
printf "Installing openssl..."
|
||||||
|
brew install pkg-config >> env_setup.log
|
||||||
|
brew install openssl >> env_setup.log
|
||||||
|
printf "done\n"
|
||||||
|
|
||||||
|
printf "Installing python3..."
|
||||||
|
brew install python3 >> env_setup.log
|
||||||
|
printf "done\n"
|
||||||
|
|
||||||
|
printf "Installing MSODBCSQL..."
|
||||||
|
brew tap microsoft/msodbcsql https://github.com/Microsoft/homebrew-msodbcsql >> env_setup.log
|
||||||
|
brew update >> env_setup.log
|
||||||
|
yes | ACCEPT_EULA=Y brew install --no-sandbox msodbcsql >> env_setup.log
|
||||||
|
printf "done\n"
|
||||||
|
|
||||||
|
yes | brew install autoconf >> env_setup.log
|
||||||
|
printf "Installing pyodbc..."
|
||||||
|
pip3 install pyodbc >> env_setup.log
|
||||||
|
printf "done\n"
|
||||||
|
>>>>>>> upstream/dev
|
||||||
fi
|
fi
|
||||||
echo "Downloading PHP-$PHP_VERSION source tarball..."
|
|
||||||
|
printf "Downloading PHP-$PHP_VERSION source tarball..."
|
||||||
|
# pipe non-error to log file
|
||||||
wget http://ca1.php.net/get/php-$PHP_VERSION.tar.gz/from/this/mirror -O php-$PHP_VERSION.tar.gz >> env_setup.log 2>&1
|
wget http://ca1.php.net/get/php-$PHP_VERSION.tar.gz/from/this/mirror -O php-$PHP_VERSION.tar.gz >> env_setup.log 2>&1
|
||||||
echo "OK"
|
printf "done\n"
|
||||||
echo "Extracting PHP source tarball..."
|
|
||||||
|
printf "Extracting PHP source tarball..."
|
||||||
rm -rf php-$PHP_VERSION
|
rm -rf php-$PHP_VERSION
|
||||||
tar -xf php-$PHP_VERSION.tar.gz
|
tar -xf php-$PHP_VERSION.tar.gz
|
||||||
echo "OK"
|
printf "done\n"
|
||||||
cd php-$PHP_VERSION
|
|
||||||
mkdir ext/sqlsrv ext/pdo_sqlsrv
|
phpDir=php-$PHP_VERSION
|
||||||
cp -r $DRIVER_SOURCE_PATH/sqlsrv/* $DRIVER_SOURCE_PATH/shared ext/sqlsrv
|
cd $phpDir
|
||||||
cp -r $DRIVER_SOURCE_PATH/pdo_sqlsrv/* $DRIVER_SOURCE_PATH/shared ext/pdo_sqlsrv
|
|
||||||
|
printf "Configuring PHP..."
|
||||||
./buildconf --force >> ../env_setup.log 2>&1
|
./buildconf --force >> ../env_setup.log 2>&1
|
||||||
CONFIG_OPTIONS="--enable-cli --enable-cgi --enable-pdo --enable-sqlsrv=shared --with-pdo_sqlsrv=shared --with-odbcver=0x0380 --with-zlib --enable-mbstring --prefix=/usr/local"
|
CONFIG_OPTIONS="--enable-cli --enable-cgi --with-zlib --enable-mbstring --prefix=/usr/local"
|
||||||
[ "${PHP_THREAD}" == "ts" ] && CONFIG_OPTIONS=${CONFIG_OPTIONS}" --enable-maintainer-zts"
|
[ "${PHP_THREAD}" == "ts" ] && CONFIG_OPTIONS=${CONFIG_OPTIONS}" --enable-maintainer-zts"
|
||||||
if [ $PLATFORM = "Sierra" ]; then
|
if [ $PLATFORM = "Sierra" ]; then
|
||||||
CONFIG_OPTIONS=$CONFIG_OPTIONS" --with-openssl=/usr/local/opt/openssl/"
|
CONFIG_OPTIONS=$CONFIG_OPTIONS" --with-openssl=/usr/local/opt/openssl/"
|
||||||
else
|
else
|
||||||
CONFIG_OPTIONS=$CONFIG_OPTIONS" --with-openssl"
|
CONFIG_OPTIONS=$CONFIG_OPTIONS" --with-openssl"
|
||||||
fi
|
fi
|
||||||
echo "Configuring PHP..."
|
#pipe non-error to log file
|
||||||
(./configure $CONFIG_OPTIONS >> ../env_setup.log 2>&1)
|
(./configure $CONFIG_OPTIONS >> ../env_setup.log 2>&1)
|
||||||
echo "OK"
|
printf "done\n"
|
||||||
echo "Compiling PHP and the drivers..."
|
|
||||||
make >> ../env_setup.log 2>&1
|
printf "Compiling and installing PHP..."
|
||||||
echo "OK"
|
make >> ../env_setup.log
|
||||||
sudo make install >> ../env_setup.log 2>&1
|
sudo make install >> ../env_setup.log
|
||||||
|
printf "done\n"
|
||||||
|
|
||||||
|
# check PHP version
|
||||||
|
/usr/local/bin/php -v
|
||||||
|
|
||||||
|
printf "Setting up drivers..."
|
||||||
|
phpExtDir=`/usr/local/bin/php-config --extension-dir`
|
||||||
cp php.ini-production php.ini
|
cp php.ini-production php.ini
|
||||||
echo "extension=sqlsrv.so" >> php.ini
|
driverName=$(basename $SQLSRV_DRIVER)
|
||||||
echo "extension=pdo_sqlsrv.so" >> php.ini
|
echo "extension=$driverName" >> php.ini
|
||||||
|
sudo cp -r $SQLSRV_DRIVER $phpExtDir/$driverName
|
||||||
|
sudo chmod a+r $SQLSRV_DRIVER $phpExtDir/$driverName
|
||||||
|
|
||||||
|
driverName=$(basename $PDO_DRIVER)
|
||||||
|
echo "extension=$driverName" >> php.ini
|
||||||
|
sudo cp -r $PDO_DRIVER $phpExtDir/$driverName
|
||||||
|
sudo chmod a+r $SQLSRV_DRIVER $phpExtDir/$driverName
|
||||||
|
|
||||||
sudo cp php.ini /usr/local/lib
|
sudo cp php.ini /usr/local/lib
|
||||||
|
printf "done\n"
|
||||||
|
|
||||||
|
# check drivers
|
||||||
|
/usr/local/bin/php --ri sqlsrv
|
||||||
|
/usr/local/bin/php --ri pdo_sqlsrv
|
||||||
|
|
||||||
|
printf "Installing Composer..."
|
||||||
cd ..
|
cd ..
|
||||||
php -v
|
# pipe non-error to log file
|
||||||
php --ri sqlsrv
|
|
||||||
php --ri pdo_sqlsrv
|
|
||||||
echo "Installing Composer..."
|
|
||||||
wget https://getcomposer.org/installer -O composer-setup.php >> env_setup.log 2>&1
|
wget https://getcomposer.org/installer -O composer-setup.php >> env_setup.log 2>&1
|
||||||
php composer-setup.php >> env_setup.log 2>&1
|
/usr/local/bin/php composer-setup.php >> env_setup.log
|
||||||
echo "OK"
|
printf "done\n"
|
||||||
echo "Installing PHPBench..."
|
|
||||||
php composer.phar install >> env_setup.log 2>&1
|
printf "Installing PHPBench...\n"
|
||||||
echo "OK"
|
/usr/local/bin/php composer.phar install >> env_setup.log
|
||||||
echo "Cleaning up..."
|
printf "done\n"
|
||||||
rm -rf php-$PHP_VERSION* compser-setup.php
|
|
||||||
echo "OK"
|
printf "Cleaning up..."
|
||||||
|
rm -rf $phpDir compser-setup.php
|
||||||
|
printf "done\n"
|
||||||
|
|
||||||
echo "Setup completed!"
|
echo "Setup completed!"
|
|
@ -1,28 +1,13 @@
|
||||||
Param(
|
Param(
|
||||||
[Parameter(Mandatory=$True,Position=1)]
|
[Parameter(Mandatory=$True,Position=1)]
|
||||||
[string]$PHP_VERSION,
|
[string]$PHP_ZIP,
|
||||||
[Parameter(Mandatory=$True,Position=2)]
|
[Parameter(Mandatory=$True,Position=2)]
|
||||||
[string]$PHP_THREAD,
|
[string]$SQLSRV_DRIVER,
|
||||||
[Parameter(Mandatory=$True,Position=3)]
|
[Parameter(Mandatory=$True,Position=3)]
|
||||||
[string]$DRIVER_SOURCE_PATH,
|
[string]$PDO_DRIVER
|
||||||
[Parameter(Mandatory=$True,Position=4)]
|
|
||||||
[string]$ARCH
|
|
||||||
)
|
)
|
||||||
|
|
||||||
IF($ARCH -ne "x64" -And $ARCH -ne "x86"){
|
$ErrorActionPreference = "Stop"
|
||||||
Write-Host "ARCH must either x64 or x86"
|
|
||||||
Break
|
|
||||||
}
|
|
||||||
|
|
||||||
IF($PHP_THREAD -ne "nts" -And $PHP_THREAD -ne "ts"){
|
|
||||||
Write-Host "PHP_THREAD must either nts or ts"
|
|
||||||
Break
|
|
||||||
}
|
|
||||||
|
|
||||||
IF($PHP_VERSION -NotMatch "7.[0-1].[0-9]"){
|
|
||||||
Write-Host "PHP_VERSION must be in format of 7.x.x"
|
|
||||||
Break
|
|
||||||
}
|
|
||||||
|
|
||||||
$startingDir=$pwd.Path
|
$startingDir=$pwd.Path
|
||||||
$tempFolder=Join-Path $startingDir "temp"
|
$tempFolder=Join-Path $startingDir "temp"
|
||||||
|
@ -30,17 +15,12 @@ $tempFolder=Join-Path $startingDir "temp"
|
||||||
Remove-Item temp -Recurse -Force -ErrorAction Ignore
|
Remove-Item temp -Recurse -Force -ErrorAction Ignore
|
||||||
New-Item -ItemType directory -Path temp
|
New-Item -ItemType directory -Path temp
|
||||||
|
|
||||||
(New-Object System.Net.WebClient).DownloadFile("http://windows.php.net/downloads/releases/sha1sum.txt","$tempFolder\sha1sum.txt")
|
|
||||||
$PHP70_LATEST_VERSION=type $tempFolder\sha1sum.txt | where { $_ -match "php-(7.0\.\d+)-src" } | foreach { $matches[1] }
|
|
||||||
$PHP71_LATEST_VERSION=type $tempFolder\sha1sum.txt | where { $_ -match "php-(7.1\.\d+)-src" } | foreach { $matches[1] }
|
|
||||||
|
|
||||||
$PHP_VERSION_MINOR=$PHP_VERSION.split(".")[1]
|
|
||||||
|
|
||||||
Write-Host "Installing chocolatey..."
|
Write-Host "Installing chocolatey..."
|
||||||
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
|
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
|
||||||
Write-Host "Installing Git..."
|
Write-Host "Installing Git..."
|
||||||
choco install -y git
|
choco install -y git
|
||||||
Set-Alias git 'C:\Program Files\Git\cmd\git.exe'
|
|
||||||
|
$gitDir = 'C:\Program Files\Git\cmd\git.exe'
|
||||||
Write-Host "Installing Python3..."
|
Write-Host "Installing Python3..."
|
||||||
choco install -y python3
|
choco install -y python3
|
||||||
RefreshEnv
|
RefreshEnv
|
||||||
|
@ -54,63 +34,35 @@ msiexec /quiet /passive /qn /i $tempFolder\msodbcsql.msi IACCEPTMSODBCSQLLICENSE
|
||||||
Write-Host "Installing 7-Zip..."
|
Write-Host "Installing 7-Zip..."
|
||||||
choco install -y 7zip.install
|
choco install -y 7zip.install
|
||||||
|
|
||||||
Write-Host "Downloading PHP-SDK..."
|
Write-Host "Installing PHP..."
|
||||||
(New-Object System.Net.WebClient).DownloadFile('http://windows.php.net/downloads/php-sdk/php-sdk-binary-tools-20110915.zip', "$tempFolder\binary_tools.zip")
|
$phpDir="C:\php"
|
||||||
Write-Host "Downloading PHP-$PHP_VERSION source..."
|
|
||||||
IF($PHP_VERSION -eq $PHP70_LATEST_VERSION -Or $PHP_VERSION -eq $PHP71_LATEST_VERSION){
|
|
||||||
(New-Object System.Net.WebClient).DownloadFile("http://windows.php.net/downloads/releases/php-$PHP_VERSION-src.zip", "$tempFolder\php-$PHP_VERSION-src.zip")
|
|
||||||
}
|
|
||||||
ELSE{
|
|
||||||
(New-Object System.Net.WebClient).DownloadFile("http://windows.php.net/downloads/releases/archives/php-$PHP_VERSION-src.zip", "$tempFolder\php-$PHP_VERSION-src.zip")
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Host "Downloading Dependencies..."
|
# remove existing PHP and setup new one
|
||||||
(New-Object System.Net.WebClient).DownloadFile("http://windows.php.net/downloads/php-sdk/deps-7.$PHP_VERSION_MINOR-vc14-$ARCH.7z", "$tempFolder\deps-7.$PHP_VERSION_MINOR-vc14-$ARCH.7z")
|
Remove-Item $phpDir -Recurse -ErrorAction Ignore
|
||||||
|
New-Item -ItemType directory -Path $phpDir
|
||||||
|
Expand-Archive $PHP_ZIP -DestinationPath $phpDir
|
||||||
|
Copy-Item $SQLSRV_DRIVER $phpDir\ext
|
||||||
|
Copy-Item $PDO_DRIVER $phpDir\ext
|
||||||
|
|
||||||
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
# setup driver
|
||||||
Remove-Item C:\php-sdk -Recurse -Force -ErrorAction Ignore
|
Copy-Item $phpDir\php.ini-production $phpDir\php.ini
|
||||||
New-Item -ItemType directory -Path C:\php-sdk
|
Add-Content $phpDir\php.ini "extension=$phpDir\ext\php_openssl.dll"
|
||||||
[System.IO.Compression.ZipFile]::ExtractToDirectory("$tempFolder\binary_tools.zip", "C:\php-sdk")
|
Add-Content $phpDir\php.ini "extension=$phpDir\ext\php_mbstring.dll"
|
||||||
cd C:\php-sdk\
|
|
||||||
bin\phpsdk_buildtree.bat phpdev
|
|
||||||
New-Item -ItemType directory -Path .\phpdev\vc14
|
|
||||||
Copy-Item .\phpdev\vc9\* phpdev\vc14\ -recurse
|
|
||||||
[System.IO.Compression.ZipFile]::ExtractToDirectory("$tempFolder\php-$PHP_VERSION-src.zip", "C:\php-sdk\phpdev\vc14\$ARCH\")
|
|
||||||
7z.exe x $tempFolder\deps-7.$PHP_VERSION_MINOR-vc14-$ARCH.7z -oC:\php-sdk\phpdev\vc14\$ARCH\
|
|
||||||
|
|
||||||
bin\phpsdk_setvars.bat
|
$driverName=Split-Path $SQLSRV_DRIVER -leaf
|
||||||
|
Add-Content $phpDir\php.ini "extension=$phpDir\ext\$driverName"
|
||||||
cd C:\php-sdk\phpdev\vc14\$ARCH\php-$PHP_VERSION-src
|
$driverName=Split-Path $PDO_DRIVER -leaf
|
||||||
|
Add-Content $phpDir\php.ini "extension=$phpDir\ext\$driverName"
|
||||||
New-Item -ItemType directory -Path .\ext\sqlsrv
|
|
||||||
New-Item -ItemType directory -Path .\ext\pdo_sqlsrv
|
|
||||||
Copy-Item $DRIVER_SOURCE_PATH\sqlsrv\* .\ext\sqlsrv\ -recurse
|
|
||||||
Copy-Item $DRIVER_SOURCE_PATH\shared\ .\ext\sqlsrv\ -recurse
|
|
||||||
Copy-Item $DRIVER_SOURCE_PATH\pdo_sqlsrv\* .\ext\pdo_sqlsrv\ -recurse
|
|
||||||
Copy-Item $DRIVER_SOURCE_PATH\shared\ .\ext\pdo_sqlsrv\ -recurse
|
|
||||||
|
|
||||||
|
|
||||||
$CONFIG_OPTIONS="--enable-cli --enable-cgi --enable-sqlsrv=shared --enable-pdo=shared --with-pdo-sqlsrv=shared --with-odbcver=0x0380 --enable-mbstring --with-openssl"
|
|
||||||
if ($PHP_THREAD -ceq "nts") {
|
|
||||||
$CONFIG_OPTIONS=$CONFIG_OPTIONS + " --disable-zts"
|
|
||||||
}
|
|
||||||
& $startingDir\compile_php.bat $ARCH $CONFIG_OPTIONS
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Copy-Item php.ini-production php.ini
|
|
||||||
Add-Content php.ini "extension=C:\php\ext\php_sqlsrv.dll"
|
|
||||||
Add-Content php.ini "extension=C:\php\ext\php_pdo_sqlsrv.dll"
|
|
||||||
Add-Content php.ini "extension=C:\php\ext\php_openssl.dll"
|
|
||||||
Move-Item php.ini C:\Windows -force
|
|
||||||
Copy-Item C:\php-sdk\phpdev\vc14\$ARCH\deps\bin\ssleay32.dll C:\Windows -force
|
|
||||||
Copy-Item C:\php-sdk\phpdev\vc14\$ARCH\deps\bin\libeay32.dll C:\Windows -force
|
|
||||||
|
|
||||||
|
Move-Item $phpDir\php.ini C:\Windows -force
|
||||||
|
Copy-Item $phpDir\ssleay32.dll C:\Windows -force
|
||||||
|
Copy-Item $phpDir\libeay32.dll C:\Windows -force
|
||||||
cd $startingDir
|
cd $startingDir
|
||||||
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\php\", [System.EnvironmentVariableTarget]::Machine)
|
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";" + $phpDir + ";" + $gitDir, [System.EnvironmentVariableTarget]::Machine)
|
||||||
$env:Path += ";C:\php\"
|
$env:Path = $env:Path + ";" + $phpDir + ";" + $gitDir
|
||||||
RefreshEnv
|
RefreshEnv
|
||||||
|
|
||||||
|
# setup composer
|
||||||
wget https://getcomposer.org/installer -O composer-setup.php
|
wget https://getcomposer.org/installer -O composer-setup.php
|
||||||
php composer-setup.php
|
php composer-setup.php
|
||||||
php composer.phar install
|
php composer.phar install
|
||||||
|
|
Loading…
Reference in a new issue