com web/rmtools: Support Apache2.4: pgo-build/pgo_controller .ps1 pgo-build/setup-utils.ps1
| From: | Stephen A. Zarkos | Date: | Fri, 01 Mar 2013 00:12:56 +0000 |
| Subject: | com web/rmtools: Support Apache2.4: pgo-build/pgo_controller .ps1 pgo-build/setup-utils.ps1 | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-15637@lists.php.net to get a copy of this message | ||
Commit: 51f8737bcd57a2beb0f6a13044c96c979d3f621b
Author: Stephen Zarkos <stephen.zarkos@microsoft.com> Thu, 28 Feb 2013 16:12:56
-0800
Parents: 8bd4ffdd1fab034aed1ec8518e5e284293550563
Branches: master
Link: http://git.php.net/?p=web/rmtools.git;a=commitdiff;h=51f8737bcd57a2beb0f6a13044c96c979d3f621b
Log:
Support Apache2.4
Changed paths:
M pgo-build/pgo_controller.ps1
M pgo-build/setup-utils.ps1
Diff:
diff --git a/pgo-build/pgo_controller.ps1 b/pgo-build/pgo_controller.ps1
index 490cda8..54caa20 100644
--- a/pgo-build/pgo_controller.ps1
+++ b/pgo-build/pgo_controller.ps1
@@ -9,15 +9,27 @@
#
## Example: pgo_controller.ps1 -PHPBUILD
C:\obj\ts-windows-vc9-x86\Release_TS\php-5.4.0RC6-dev-Win32-VC9-x86.zip -PHPVER php-5.4
-Param( $PHPBUILD="", $PHPVER="" )
+Param( $PHPBUILD="", $PHPVER="", $APACHEVER="2.4" )
if ( ($PHPBUILD -eq "") -or ($PHPVER -eq "") ) {
- write-output "Usage: pgo_controller.ps1 -PHPBUILD <path_to_.zip> -PHPVER
<php_ver>"
+ write-output "Usage: pgo_controller.ps1 -PHPBUILD <path_to_.zip> -PHPVER
<php_ver> [-APACHEVER <ver>]"
exit
}
-$SERVER = "php-pgo01"
+if ( ($APACHEVER -ne "2.4") -and ($APACHEVER -ne "2.2") ) {
+ write-output "Unknown apache version, only 2.2 and 2.4 are supported";
+ exit
+}
+if ( $APACHEVER -eq "2.4" ) {
+ $APACHE_SERVICE = "Apache2.4"
+ $APACHE_DIR = "Apache24"
+} else {
+ $APACHE_SERVICE = "Apache2.2"
+ $APACHE_DIR = "Apache2"
+}
+
+$SERVER = "php-pgo02"
$WebSvrPHPLoc = "\\$SERVER\pgo"
-$WebSvrApacheLoc = "\\$SERVER\Apache2"
+$WebSvrApacheLoc = "\\$SERVER\$APACHE_DIR"
$RemoteBaseDir = "C:\pgo"
$RemotePHPBin = "C:\pgo\php-nts-bin\php.exe"
@@ -73,7 +85,7 @@ if ( $PHPBUILD -match "nts" ) {
$( winrs -r:$SERVER net stop w3svc )
}
else {
- $( winrs -r:$SERVER net stop Apache2.2 )
+ $( winrs -r:$SERVER net stop $APACHE_SERVICE )
}
## Copy and set up PHP runtime.
@@ -129,7 +141,7 @@ else {
remove-lock $lockfile
exit
}
- $( winrs -r:$SERVER net stop Apache2.2 "&" net start Apache2.2 )
+ $( winrs -r:$SERVER net stop $APACHE_SERVICE "&" net start $APACHE_SERVICE )
$( winrs -r:$SERVER $RemotePHPBin C:\pgo\scripts\pgo.php localhost 8080 )
}
@@ -137,7 +149,7 @@ if ( $PHPBUILD -match "nts" ) {
$( winrs -r:$SERVER net stop w3svc )
}
else {
- $( winrs -r:$SERVER net stop Apache2.2 )
+ $( winrs -r:$SERVER net stop $APACHE_SERVICE )
}
## Important - need to give instrumentation time to
diff --git a/pgo-build/setup-utils.ps1 b/pgo-build/setup-utils.ps1
index 492071a..a8b3af3 100644
--- a/pgo-build/setup-utils.ps1
+++ b/pgo-build/setup-utils.ps1
@@ -8,7 +8,7 @@
## Description: Check and set the lock file on the PGO host.
#
Function set-lock ( $lockfile ) {
- for ($i=0; $i -lt 70; $i++) {
+ for ($i=0; $i -lt 120; $i++) {
if ( (test-path "$WebSvrPHPLoc\$lockfile") -eq $true ) {
logger "set-lock($lockfile): $WebSvrPHPLoc\$lockfile exists, waiting for 60 seconds."
Start-Sleep -s 60
@@ -32,7 +32,7 @@ Function set-lock ( $lockfile ) {
Function remove-lock ( $lockfile ) {
logger "remove-lock($lockfile): removing lockfile $WebSvrPHPLoc\$lockfile."
- remove-item -path "$WebSvrPHPLoc\$lockfile" -Force
+ remove-item -path "$WebSvrPHPLoc\$lockfile" -Force -Recurse
if ( (test-path "$WebSvrPHPLoc\$lockfile") -eq $true ) {
logger "remove-lock($lockfile): lockfile $WebSvrPHPLoc\$lockfile not removed."
}
@@ -78,7 +78,7 @@ Function setup-php ( $extdir="", $phploc ) {
#
## Description: Configure PHP for Apache.
#
-Function setup-apache( $phppath="" ) {
+Function setup-apache( $phppath="", $ver = "2.4" ) {
if ( $phppath -eq "" ) {
return $false
}
@@ -86,8 +86,18 @@ Function setup-apache( $phppath="" ) {
$phpdir = $RemoteBaseDir -replace '\\', '/'
+ if ( ($ver -ne "2.4") -and ($ver -ne "2.2") ) {
+ logger "setup-apache: unknown apache version '$ver'"
+ return $false
+ }
+ if ( $ver -eq "2.4" ) {
+ $dll = "php5apache2_4.dll"
+ } else {
+ $dll = "php5apache2_2.dll"
+ }
+
$conffile = "$WebSvrApacheLoc/conf/extra/httpd-php.conf"
- $config = "LoadModule php5_module
"$phpdir/$phppath/php5apache2_2.dll"`n"
+ $config = "LoadModule php5_module "$phpdir/$phppath/$dll"`n"
$config += "AddType application/x-httpd-php .php`n"
$config += "PHPIniDir "$phpdir/$phppath"`n"