/* ----------------------------------------------------------------------- */ /* install APACHE 2 with PHP4 Module */ /* ----------------------------------------------------------------------- */ /* arg is the actual HOSTNAME value */ parse arg hostname if hostname=='' then hostname='a-net.demo.local' say 'Hostname is: ' hostname /* activate REXX Utils */ call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs' call SysLoadFuncs '@echo off' /* determine source drive for installation (CD or LAN drive) */ drivelist=SysDriveMap(,'USED') /* all local and LAN drives */ do forever parse var drivelist cddrv ' ' drivelist cddrv=strip(cddrv) filter = stream(cddrv'\cmd\inst_emx.cmd','c','query exists') if filter <> '' then leave end /* do forever */ say 'Source drive is ' cddrv /* determine boot drive */ bootdrv = SysBootDrive() say 'Boot drive is ' bootdrv say '' /* first check, if emx is already installed on system */ say 'looking for EMX ...' rc=SysFileTree(bootdrv||'\emxlibcm.dll','emxloc.','FS') /* search for emxlibcm.dll */ if rc==0 then do say 'EMX seems to be installed at: ' say emxloc.1 end /* if rc==0 */ else do say 'You must install EMX first' signal ende end /* else */ /* copy files */ drive=bootdrv apachedir='\a\apache2' /* apache directory OS/2 style */ say ' ' say '+--------------------------------------------+' say 'I choose installation drive letter I' say '+--------------------------------------------+' say 'Apache 2 will be copied to ' drive||apachedir say '[Enter] if o.k.,' say 'otherwise enter drive letter:' pull answer if answer=='' then answer='C' if answer<>'' then do if substr(answer,length(answer),1) == ':' /* : at line end */ then dd = '' else dd = ':' drive=answer||dd end /* if answer */ say 'Optionally enter alternate directory or press [Enter]' parse pull answer2 if answer2<>'' then do if substr(answer2,length(answer2),1) == '\' /* remove \ at the end */ then answer2=substr(answer2,1,length(answer2)-1) if substr(answer2,1,1) == '\' /* \ at the beginning */ then answer2=substr(answer2,2,length(answer2)) apachedir='\'||answer2 end /* if answer2 */ apachedir = strip(apachedir) /* remove trailing blanks */ say 'apachedir: ' apachedir say 'Apache2 will now be copied to ' drive||apachedir||'\' call SysSleep(4) say ' ' /* compute directory unix style (with '/' instead of '\') */ apachedirunix='' rest=apachedir i=0 do forever parse var rest part '\' rest say 'part: ' part ' rest: ' rest if part<>'' then apachedirunix=apachedirunix||'/'||part if rest=='' then leave end /* do forever */ 'xcopy \Apache2\*.* ' drive||apachedir||'\ /s /e' 'xcopy \php4\Apache20\modphp4.dll ' drive||apachedir||'\Modules\' 'xcopy \php4\php4.dll ' drive||apachedir||'\Modules\' 'xcopy \php4\modules\*.* ' drive||apachedir||'\Modules\' 'xcopy \php4\cgi\php.exe ' drive||apachedir||'\cgi\' /* ----------------------------------------------------------------------- */ /* create httpd.conf and activate PHP4 */ /* ----------------------------------------------------------------------- */ oldcfg=drive||apachedir||'\conf\httpd-std.conf' newcfg=drive||apachedir||'\conf\httpd.conf' 'if exist ' newcfg ' erase ' newcfg /* read httpd-std.conf line by line */ do while lines(oldcfg) line=linein(oldcfg) /* read line */ if pos('/Apps/apache2',line) <> 0 then do /* update directory */ /* replace '/Apps/apache2' with new directory */ parse var line part1 '/Apps/apache2' part2 line=part1||apachedirunix||part2 say 'folgende Zeile ge„ndert:' say ' ' line end /* if pos */ if pos('#ServerName new.host.name:80',line) <> 0 then do /* hostname */ /* set hostname */ line='ServerName ' hostname||':80' say 'changed line reads now:' say ' ' line end /* if pos */ if pos('LoadModule access_module ',line) <> 0 then do /* first module */ /* add PHP4 module before */ linephp4='LoadModule php4_module modules/modphp4.dll' call lineout newcfg,linephp4 say 'this line was added:' say ' ' linephp4 end /* if pos */ if pos('AddType application/x-tar ',line) <> 0 then do /* first appli */ /* add PHP4 type before */ lineapp='AddType application/x-httpd-php .php' call lineout newcfg,lineapp say 'this line was added:' say ' ' lineapp end /* if pos */ call lineout newcfg,line /* write changed lines */ end /* do while lines */ /* close files */ call stream oldcfg,'c','close' call stream newcfg,'c','close' say ' ' say 'creating program icon for Apache2' /* create start_apache.cmd for launching apache2 */ 'echo @echo off>' drive||apachedir||'\START_APACHE.CMD' 'echo echo Start Apache2 web server 2.0.53 under OS/2>>' drive||apachedir||'\START_APACHE.CMD' 'echo set home=C:\home\>>' drive||apachedir||'\START_APACHE.CMD' 'echo set beginlibpath='||apachedir||'\bin;'||apachedir||'\modules;>>' drive||apachedir||'\START_APACHE.CMD' 'echo bin\httpd -d '||apachedirunix||'/htdocs -f 'apachedirunix||'/conf/httpd.conf>>' drive||apachedir||'\START_APACHE.CMD' /* create Desktop Icon */ If SysCreateObject("WPProgram","Apache 2.0.53","",, "OBJECTID=;"||, "EXENAME="drive||apachedir||"\START_APACHE.CMD;"||, "STARTUPDIR="drive||apachedir||";"||, "PROGTYPE=WINDOWABLEVIO;") Then Say '" Program icon for Apache 2.0" created' Else Say '"Program icon for Apache 2.0" not created' /* Icon created */ say ' ' say 'You can now start Apache2 by double clicking on the Icon on the desktop' say 'html pages are in ' drive||apachedir||'\htdocs' say 'Launch your favorite browser an enter the following URL:' say 'http://localhost' say 'http://localhost/manual' say 'http://localhost/php_test.php' say ' ' say 'Would you like to start Apache2 now (Y/N)?' parse upper pull answer if answer=='Y' then do drive /* switch to drive with new installed apache */ 'cd ' apachedir 'start start_apache.cmd' say 'trying to start the browser with 2 test pages ...' say 'The default Apache2 main page and 15 seconds later the PHP test page' 'start netscape http://localhost' call SysSleep(15) 'start netscape http://localhost/php_test.php' 'cd \' end /* if answer */ cddrv /* switch back to installation drive */ ende: 'cd \'