Search & Replace Text (httpd.conf,php.ini) ??
Posted: Fri Apr 15, 2011 1:34 am
Hello,
I am new to InstallAware and I am an absolut beginner.
In the past I did a lot with the NSIS installer but now we want to use InstallAware.
My collegue has started an installation script with InstallAware and I have to complete it now.
My challenge ist to install an Apache webserver with PHP. For that I use XAMPPlite from apachefriends.
I have to edit some configuration files and the php.ini file for correct paths.
In the source files there is the path with the key word /xampplite. I have to replace this with the installation path.
In httpd.conf all paths are with slashes /
ServerRoot "/xampplite/apache" ==>> should be later "C:/program files/myinstalldir/apache"
the php.ini file has backslashes
error_log = "\xampplite\apache\logs\php_error.log" ==>> should be later "C:\program files\myinstalldir\apache\logs\php_error.log"
one file has double backslahes
SetEnv PHP_PEAR_SYSCONF_DIR "\\xampplite\\php"
How can I do this replacement in this files with InstallAware?
Can anybody show me an example?
Next step is to install the apache service after copying all files.
How can I check for existing services and install (or remove it for deinstallation) )
With the NSIS installer I did this in this way:
-----------------------------------------------------------------------------------------------
Push "$INSTDIR" ;original string
Push "\" ;needs to be replaced
Push "/" ;will replace wrong characters
Call StrReplace
Pop $0
!insertmacro ReplaceInFile "$INSTDIR\apache\conf\httpd.conf" "/xampplite" "$0"
!insertmacro ReplaceInFile "$INSTDIR\apache\conf\extra\httpd-autoindex.conf" "/xampplite" "$0"
!insertmacro ReplaceInFile "$INSTDIR\apache\conf\extra\httpd-dav.conf" "/xampplite" "$0"
!insertmacro ReplaceInFile "$INSTDIR\apache\conf\extra\httpd-multilang-errordoc.conf" "/xampplite" "$0"
!insertmacro ReplaceInFile "$INSTDIR\apache\conf\extra\httpd-ssl.conf" "/xampplite" "$0"
!insertmacro ReplaceInFile "$INSTDIR\apache\conf\extra\httpd-vhosts.conf" "/xampplite" "$0"
!insertmacro ReplaceInFile "$INSTDIR\apache\conf\extra\httpd-xampp.conf" "/xampplite" "$0"
!insertmacro ReplaceInFile "$INSTDIR\mysql\bin\my.ini" "/xampplite" "$0"
Push "$INSTDIR" ;original string
Push "\" ;needs to be replaced
Push "#" ;will replace wrong characters
Call StrReplace
Pop $0
Push $0 ;original string
Push "#" ;needs to be replaced
Push "\\" ;will replace wrong characters
Call StrReplace
Pop $0
!insertmacro ReplaceInFile "$INSTDIR\apache\conf\extra\httpd-xampp.conf" "\\xampplite" "$0"
Sorry for my first long post
best regards
Hansjoerg
I am new to InstallAware and I am an absolut beginner.
In the past I did a lot with the NSIS installer but now we want to use InstallAware.
My collegue has started an installation script with InstallAware and I have to complete it now.
My challenge ist to install an Apache webserver with PHP. For that I use XAMPPlite from apachefriends.
I have to edit some configuration files and the php.ini file for correct paths.
In the source files there is the path with the key word /xampplite. I have to replace this with the installation path.
In httpd.conf all paths are with slashes /
ServerRoot "/xampplite/apache" ==>> should be later "C:/program files/myinstalldir/apache"
the php.ini file has backslashes
error_log = "\xampplite\apache\logs\php_error.log" ==>> should be later "C:\program files\myinstalldir\apache\logs\php_error.log"
one file has double backslahes
SetEnv PHP_PEAR_SYSCONF_DIR "\\xampplite\\php"
How can I do this replacement in this files with InstallAware?
Can anybody show me an example?
Next step is to install the apache service after copying all files.
How can I check for existing services and install (or remove it for deinstallation) )
With the NSIS installer I did this in this way:
-----------------------------------------------------------------------------------------------
Push "$INSTDIR" ;original string
Push "\" ;needs to be replaced
Push "/" ;will replace wrong characters
Call StrReplace
Pop $0
!insertmacro ReplaceInFile "$INSTDIR\apache\conf\httpd.conf" "/xampplite" "$0"
!insertmacro ReplaceInFile "$INSTDIR\apache\conf\extra\httpd-autoindex.conf" "/xampplite" "$0"
!insertmacro ReplaceInFile "$INSTDIR\apache\conf\extra\httpd-dav.conf" "/xampplite" "$0"
!insertmacro ReplaceInFile "$INSTDIR\apache\conf\extra\httpd-multilang-errordoc.conf" "/xampplite" "$0"
!insertmacro ReplaceInFile "$INSTDIR\apache\conf\extra\httpd-ssl.conf" "/xampplite" "$0"
!insertmacro ReplaceInFile "$INSTDIR\apache\conf\extra\httpd-vhosts.conf" "/xampplite" "$0"
!insertmacro ReplaceInFile "$INSTDIR\apache\conf\extra\httpd-xampp.conf" "/xampplite" "$0"
!insertmacro ReplaceInFile "$INSTDIR\mysql\bin\my.ini" "/xampplite" "$0"
Push "$INSTDIR" ;original string
Push "\" ;needs to be replaced
Push "#" ;will replace wrong characters
Call StrReplace
Pop $0
Push $0 ;original string
Push "#" ;needs to be replaced
Push "\\" ;will replace wrong characters
Call StrReplace
Pop $0
!insertmacro ReplaceInFile "$INSTDIR\apache\conf\extra\httpd-xampp.conf" "\\xampplite" "$0"
Sorry for my first long post
best regards
Hansjoerg