mirror of
https://github.com/php/php-src.git
synced 2024-09-22 02:17:32 +00:00
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).
This commit is contained in:
parent
b69d4c004d
commit
1e9eeafe21
@ -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 ?>"
|
||||
|
@ -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";
|
||||
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user