summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWez Furlong <wez@php.net>2003-02-10 00:20:53 +0000
committerWez Furlong <wez@php.net>2003-02-10 00:20:53 +0000
commit1e9eeafe21e91bbd15fad70cd7ad648c93d6997e (patch)
tree0e9a4893f4f101a96743d90d7d1f22122b790c84
parentb69d4c004d7e04ef15b4867cfc3b84cf6b7c5eba (diff)
downloadphp-git-1e9eeafe21e91bbd15fad70cd7ad648c93d6997e.tar.gz
Fix php.ini customization.
Apparently, it seems that running the php script with output captured to the log prevented it from working correctly. Also, deletes the php.ini when uninstalled. TODO: The defaults install and activate all extensions. This is a problem for those extension that require non-bundled .dlls (such as OCI).
-rw-r--r--win32/installer/gen-nsis.php23
-rw-r--r--win32/installer/setini.php14
2 files changed, 22 insertions, 15 deletions
diff --git a/win32/installer/gen-nsis.php b/win32/installer/gen-nsis.php
index 0907e41674..0a4a18103c 100644
--- a/win32/installer/gen-nsis.php
+++ b/win32/installer/gen-nsis.php
@@ -314,7 +314,7 @@ $UNINSTALL = implode("\n", $uninstall) . "\n" . implode("\n", $rmdirs) . "\n";
!define MUI_PRODUCT "PHP - Hypertext Preprocessor"
!define MUI_VERSION "<?= PHPVERSION ?>"
; The second UI has a wider area for the component names
-!define MUI_UI "${NSISDIR}\Contrib\UIs\modern3.exe"
+!define MUI_UI "${NSISDIR}\Contrib\UIs\modern2.exe"
!include "${NSISDIR}\Contrib\Modern UI\System.nsh"
@@ -347,16 +347,19 @@ LicenseData "license.txt"
;Folder-selection page
InstallDir "C:\PHP-<?= PHPVERSION ?>"
-
+;define NSIS_CONFIG_LOG "install.log"
+;LogSet on
+
+!cd <?= SOURCEDIR ?>win32\installer
+
;Things that need to be extracted on startup (keep these lines before any File command!)
;Only useful for BZIP2 compression
;Use ReserveFile for your own Install Options ini files too!
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
!insertmacro MUI_RESERVEFILE_SPECIALINI
!insertmacro MUI_RESERVEFILE_SPECIALBITMAP
-
-;--------------------------------
-;Modern UI System
+
+!cd <?= DISTDIR ?>
!insertmacro MUI_SYSTEM
@@ -380,9 +383,9 @@ Function CopyPHPIni
; Extensions will call a function to activate their entry
; in the ini file as they are installed.
- ifFileExists "<?= $SYSDIR ?>\php.ini" "" +2
- Rename "<?= $SYSDIR ?>\php.ini" "<?= $SYSDIR ?>\php.ini.old"
- CopyFiles "$INSTDIR\php.ini-dist" "<?= $SYSDIR ?>\php.ini"
+ ifFileExists "$WINDIR\php.ini" "" +2
+ Rename "<?= $SYSDIR ?>\php.ini" "$WINDIR\php.ini.old"
+ CopyFiles "$INSTDIR\php.ini-dist" "$WINDIR\php.ini"
; For editing the ini, put the cli and the php4ts.dll in the same dir
; these files will be deleted during post-installation
@@ -403,8 +406,7 @@ FunctionEnd
; Perform final actions after everything has been installed
Section -post
; Merge ini settings
- nsExec::ExecToLog "$\"$INSTDIR\strap-php.exe$\" $\"$INSTDIR\setini.php$\" $\"<?= $SYSDIR ?>\php.ini$\" $\"$INSTDIR\.ini-add$\""
-
+ ExecWait "$\"$INSTDIR\strap-php.exe$\" $\"$INSTDIR\setini.php$\" $\"$WINDIR\php.ini$\" $\"$INSTDIR\.ini-add$\""
Delete "$INSTDIR\.ini-add" ; Created by the AddIniSetting function
Delete "$INSTDIR\setini.php"
Delete "$INSTDIR\strap-php.exe"
@@ -431,6 +433,7 @@ Section "Uninstall"
<?= $UNINSTALL ?>
Delete "$INSTDIR\Uninstall.exe"
+ Delete "$WINDIR\php.ini"
RMDir "$INSTDIR"
; Remove from Add/Remove programs list
DeleteRegKey /ifempty HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\PHP-<?= PHPVERSION ?>"
diff --git a/win32/installer/setini.php b/win32/installer/setini.php
index 91d1b1a325..c16ea02f98 100644
--- a/win32/installer/setini.php
+++ b/win32/installer/setini.php
@@ -9,6 +9,8 @@
* $argv[2] is the path to the option file
*/
+echo "Running post-installation script to configure php.ini\n";
+
$ini_name = $argv[1];
$option_file = $argv[2];
@@ -20,9 +22,9 @@ foreach ($options as $line) {
list($name, $value) = explode("=", $line);
if ($name == "extension") {
- $pat = "/^;?extension\s*=\s*" . $value . "/i";
+ $pat = "/^;?extension\s*=\s*" . preg_quote($value, '/') . "/i";
} else {
- $pat = "/^;?$name\s*=\s*/i";
+ $pat = "/^;?" . preg_quote($name, '/') . "\s*=\s*/i";
}
$opts[] = array('pat' => $pat, 'name' => $name, 'value' => $value);
@@ -32,6 +34,9 @@ $new_name = $ini_name . "~";
$dest = fopen($new_name, "w");
if (!$dest) {
+ echo "Could not create temporary file! $new_name\n";
+ flush();
+ sleep(10);
die("Cannot create temporary file!");
}
@@ -43,10 +48,7 @@ foreach ($lines as $line) {
extract($optdata);
if (preg_match($pat, $line)) {
- echo "Found: $line\n";
$line = "$name=$value\r\n";
- echo" New value: $line\n";
-
// No need to match again
unset($opts[$k]);
break;
@@ -61,4 +63,6 @@ fclose($dest);
unlink($ini_name);
rename($new_name, $ini_name);
+echo "All done!\n";
+
?>