Search & Replace Text (httpd.conf,php.ini) ??

Got a problem you cannot solve? Try here.
Post Reply
QooScho
Posts: 152
Joined: Fri Apr 15, 2011 1:02 am

Search & Replace Text (httpd.conf,php.ini) ??

Post by QooScho »

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
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: Search & Replace Text (httpd.conf,php.ini) ??

Post by giaviv »

Dear Hansjoerg,

Please check out this plugin:
http://www.installaware.com/forum/viewtopic.php?t=81

It allows you to edit text files quite easily. Just like a replace method in any other text editor, you need to specify the string to search and what to replace it with.
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
QooScho
Posts: 152
Joined: Fri Apr 15, 2011 1:02 am

Re: Search & Replace Text (httpd.conf,php.ini) ??

Post by QooScho »

Hello,
thanks a lot for the help,

yes I have found this plugin and it works fine, except one situation

I need to replace double backslash
like in
SetEnv MYSQL_HOME "\\xampplite\\mysql\\bin"

It seems not wo work.

Other question.
I cannot find any plugin to install a service. I see only a plugin "Manage Service" where I can start and stop a service but not install.
Is there anything?

regards
Hansjoerg

Hmmm. How can I put the text from Installaware Script Editor into here?
It seems not be shown correct.

Code: Select all

~InstallAware Clipboard Data~
~Comment~
~{7563B22B-A113-416B-8DED-4BFC48F936FC}~
~~
~EditFile~
~{30CC896B-D0E2-4CD7-9C9F-9289C78809C6}~
~$PROGDIR$\websrv\apache\conf\extra\httpd-xampp.conf^|^\\xampplite^|^$BackSlashToSlash$^|^^|^0~
~mIDEEdit.dll\mEXEEdit.dll~
~Replace String~
~{EAA30E3B-03A8-4614-8995-79A62D340D5B}~
~BackSlashToSlash~
~\~
~\\~
~TRUE~
~TRUE~
~Comment~
~{A0F4BD75-2BE5-427E-8F1D-8685A03909DB}~
~Here we have to replace double backslahes~
~EditFile~
~{693CC450-0937-4604-ADA0-69F382C7ADEC}~
~$PROGDIR$\mysql\bin\my.ini^|^/xampplite^|^$BackSlashToSlash$^|^^|^0~
~mIDEEdit.dll\mEXEEdit.dll~
~EditFile~
~{C5FDBE2E-7B44-49D7-85AD-600DD47A1EBE}~
~$PROGDIR$\websrv\apache\conf\extra\httpd-xampp.conf^|^/xampplite^|^$BackSlashToSlash$^|^^|^0~
~mIDEEdit.dll\mEXEEdit.dll~
~EditFile~
~{B3F8C30A-2BD3-4455-8557-E31EBD60DED1}~
~$PROGDIR$\websrv\apache\conf\extra\httpd-vhosts.conf^|^/xampplite^|^$BackSlashToSlash$^|^^|^0~
~mIDEEdit.dll\mEXEEdit.dll~
~EditFile~
~{BD468321-9F39-42FA-9C57-7DC0F8E3A262}~
~$PROGDIR$\websrv\apache\conf\extra\httpd-ssl.conf^|^/xampplite^|^$BackSlashToSlash$^|^^|^0~
~mIDEEdit.dll\mEXEEdit.dll~
~EditFile~
~{AFD180E0-1182-4B1E-8BBA-F06A2C084119}~
~$PROGDIR$\websrv\apache\conf\extra\httpd-multilang-errordoc.conf^|^/xampplite^|^$BackSlashToSlash$^|^^|^0~
~mIDEEdit.dll\mEXEEdit.dll~
~EditFile~
~{00003262-8F5F-4A92-9D22-44D1B20A9FDD}~
~$PROGDIR$\websrv\apache\conf\extra\httpd-dav.conf^|^/xampplite^|^$BackSlashToSlash$^|^^|^0~
~mIDEEdit.dll\mEXEEdit.dll~
~EditFile~
~{5E7D88C0-E687-4EFB-94BA-082B09DF3017}~
~$PROGDIR$\websrv\apache\conf\extra\httpd-autoindex.conf^|^/xampplite^|^$BackSlashToSlash$^|^^|^0~
~mIDEEdit.dll\mEXEEdit.dll~
~EditFile~
~{3525FB3D-7CAB-4FC2-B6F4-C16100C72F5F}~
~$PROGDIR$\websrv\apache\conf\httpd.conf^|^/xampplite^|^$BackSlashToSlash$^|^^|^0~
~mIDEEdit.dll\mEXEEdit.dll~
~Comment~
~{56427881-C4E3-4FE1-AA7B-321A7C754F67}~
~~
~Replace String~
~{BDB8569C-9EBF-4A59-98DD-D09B9074C9DA}~
~BackSlashToSlash~
~\~
~/~
~TRUE~
~TRUE~
~Set Variable~
~{0DB5C28A-B8B5-469E-B1CD-5DF4FB92D192}~
~BackSlashToSlash$MYAH$MYAH$FALSE~
~$PROGDIR$~

giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: Search & Replace Text (httpd.conf,php.ini) ??

Post by giaviv »

Dear Hansjoerg,

To install a service, simply call the Install Service command.

About the replacement, try checking the Replace \\ with \ box - does that work?
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Post Reply