com web/rmtools: Support php_opcache profiling: pgo-bui ld/pgo_controller.ps1 pgo-build/setup-utils.ps1
| From: | Stephen A. Zarkos | Date: | Wed, 20 Mar 2013 20:28:15 +0000 |
| Subject: | com web/rmtools: Support php_opcache profiling: pgo-bui ld/pgo_controller.ps1 pgo-build/setup-utils.ps1 | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-15712@lists.php.net to get a copy of this message | ||
Commit: fce0f07ce16b68d397c64be19aba44023883603d
Author: Stephen Zarkos <stephen.zarkos@microsoft.com> Wed, 20 Mar 2013 13:28:15
-0700
Parents: 838dbab8c4b919c25f93a2cf5ee987b6aefb5f79
Branches: master
Link: http://git.php.net/?p=web/rmtools.git;a=commitdiff;h=fce0f07ce16b68d397c64be19aba44023883603d
Log:
Support php_opcache profiling
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 54caa20..590cf8f 100644
--- a/pgo-build/pgo_controller.ps1
+++ b/pgo-build/pgo_controller.ps1
@@ -9,9 +9,9 @@
#
## 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="", $APACHEVER="2.4" )
+Param( $PHPBUILD="", $PHPVER="", $APACHEVER="2.4", $OPCACHE=0 )
if ( ($PHPBUILD -eq "") -or ($PHPVER -eq "") ) {
- write-output "Usage: pgo_controller.ps1 -PHPBUILD <path_to_.zip> -PHPVER
<php_ver> [-APACHEVER <ver>]"
+ write-output "Usage: pgo_controller.ps1 -PHPBUILD <path_to_.zip> -PHPVER
<php_ver> [-APACHEVER <ver>] [-OPCACHE 0|1]"
exit
}
@@ -27,7 +27,7 @@ if ( $APACHEVER -eq "2.4" ) {
$APACHE_DIR = "Apache2"
}
-$SERVER = "php-pgo02"
+$SERVER = "SERVERNAME"
$WebSvrPHPLoc = "\\$SERVER\pgo"
$WebSvrApacheLoc = "\\$SERVER\$APACHE_DIR"
$RemoteBaseDir = "C:\pgo"
@@ -116,6 +116,9 @@ else {
if ( $PHPBUILD -match "nts" ) {
$phpini = "$BaseDir/ini/$PHPVER-pgo-nts.ini"
+ if ( $OPCACHE -eq 1 ) {
+ $phpini = "$BaseDir/ini/$PHPVER-pgo-nts-cache.ini"
+ }
if ( (php-configure $build $phpini) -eq $false ) {
logger "PGP Controller: php-configure() returned error: $build, $phpini"
remove-lock $lockfile
@@ -133,6 +136,9 @@ if ( $PHPBUILD -match "nts" ) {
}
else {
$phpini = "$BaseDir/ini/$PHPVER-pgo-ts.ini"
+ if ( $OPCACHE -eq 1 ) {
+ $phpini = "$BaseDir/ini/$PHPVER-pgo-ts-cache.ini"
+ }
if ( (test-path "$exts\php_apc.dll") -eq $true ) {
$phpini = "$BaseDir/ini/$PHPVER-pgo-ts-apc.ini"
}
@@ -158,10 +164,14 @@ Start-Sleep -s 10
## Collect the .pgc files
$LocalBuildDir = $PHPBUILD -replace "$build\.zip", ''
-remove-item "$LocalBuildDir/*.pgc" -force
-copy-item -force "$WebSvrPHPLoc/$build/*.pgc" -destination $LocalBuildDir
-copy-item -force "$WebSvrPHPLoc/$build/ext/*.pgc" -destination $LocalBuildDir
+if ( $OPCACHE -eq 1 ) {
+ copy-item -force "$WebSvrPHPLoc/$build/ext/php_opcache*.pgc" -destination $LocalBuildDir
+}
+else {
+ remove-item "$LocalBuildDir/*.pgc" -force
+ copy-item -force "$WebSvrPHPLoc/$build/*..pgc" -destination $LocalBuildDir
+ copy-item -force "$WebSvrPHPLoc/$build/ext/*.pgc" -destination $LocalBuildDir
+}
## Remove lock
remove-lock $lockfile
-
diff --git a/pgo-build/setup-utils.ps1 b/pgo-build/setup-utils.ps1
index a8b3af3..8517a1f 100644
--- a/pgo-build/setup-utils.ps1
+++ b/pgo-build/setup-utils.ps1
@@ -105,8 +105,10 @@ Function setup-apache( $phppath="", $ver = "2.4" ) {
if ( (test-path $conffile) -eq $false ) {
return $false
}
-}
+ $( winrs -r:$SERVER rmdir "c:\apps\$APACHE_DIR\php_deps" )
+ $( winrs -r:$SERVER mklink /d "c:\apps\$APACHE_DIR\php_deps"
"$RemoteBaseDir\$phppath" )
+}
#
## Description: Configure PHP for IIS.
@@ -155,4 +157,16 @@ function php-configure( $phppath="", $phpini="" ) {
$line | out-file -encoding ASCII -append "$WebSvrPHPLoc/$phppath/php.ini"
}
}
+ if ( $OPCACHE -eq 1 ) {
+ $contents = (get-content "$WebSvrPHPLoc/$phppath/php.ini")
+ out-file -encoding ASCII -Force "$WebSvrPHPLoc/$phppath/php.ini"
+ Foreach ( $line in $contents ) {
+ if ( $line -match "^zend_extension=php_opcache" ) {
+ $line =
"zend_extension=
"$phpdir/$phppath/ext/php_opcache.dll""
+ }
+ $line | out-file -encoding ASCII -append "$WebSvrPHPLoc/$phppath/php.ini"
+ }
+ }
+
+ return $true
}