home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2008 February / PCWFEB08.iso / Software / Resources / Developers / XAMPP 1.5.4 / Windows installer / xampp-win32-1.5.4-installer.exe / xampp / install / install.php < prev    next >
Encoding:
PHP Script  |  2005-12-28  |  22.6 KB  |  749 lines

  1. <?php
  2.     /*
  3.     #### Installer PHP  1.5 ####
  4.     #### Author: Kay Vogelgesang & Carsten Wiedmann for www.apachefriends.org 2005 ####
  5.     */
  6.  
  7.     echo "\r\n  ########################################################################\n";
  8.     echo "  # ApacheFriends XAMPP setup win32 Version 1.5                          #\r\n";
  9.     echo "  #----------------------------------------------------------------------#\r\n";
  10.     echo "  # Copyright (c) 2002-2005 Apachefriends                                #\r\n";
  11.     echo "  #----------------------------------------------------------------------#\r\n";
  12.     echo "  # Authors: Kay Vogelgesang <kvo@apachefriends.org>                     #\r\n";
  13.     echo "  #          Carsten Wiedmann <webmaster@wiedmann-online.de>             #\r\n";
  14.     echo "  ########################################################################\r\n\r\n";
  15.  
  16.     /// Where I stand? ///
  17.     $curdir = getcwd();
  18.     list($partition, $nonpartition) = split (':', $curdir); //Fix by Wiedmann
  19.     $partwampp = substr(realpath(__FILE__), 0, strrpos(dirname(realpath(__FILE__)), '\\'));
  20.     $directorwampp = NULL;
  21.     $awkpart = str_replace("&", "\\\\&", eregi_replace ("\\\\", "\\\\", $partwampp)); //Fix by Wiedmann
  22.     $awkpartslash = str_replace("&", "\\\\&", ereg_replace ("\\\\", "/", $partwampp)); //Fix by Wiedmann
  23.     $phpdir = $partwampp;
  24.     $dir = ereg_replace("\\\\", "/", $partwampp);
  25.     $ppartition = "$partition:";
  26.  
  27.     /// I need the install.sys + update.sys for more xampp informations
  28.     $installsys = "install.sys";
  29.     $installsysroot = $partwampp."\install\\".$installsys;
  30.  
  31.     /// Some addon|update.sys files
  32.     $perlupdatesys = "perlupdate.sys";
  33.     $pythonupdatesys = "pythonupdate.sys";
  34.     $serverupdatesys = "serverupdate.sys";
  35.     $utilsupdatesys = "utilsupdate.sys";
  36.     $javaupdatesys = "javaupdate.sys";
  37.     $otherupdatesys = "otherupdate.sys";
  38.  
  39.     /// XAMPP main directrory is ...
  40.     $substit = "\\\\\\\\xampp";
  41.     $substitslash = "/xampp";
  42.  
  43.     /// Globale variables
  44.     $BS = 0;
  45.     $CS = 0;
  46.     $slashi = 1;
  47.     $bslashi = 1;
  48.     $awkexe = ".\install\awk.exe";
  49.     $awk = ".\install\config.awk";
  50.     $awknewdir = "\"".$awkpart."\"";
  51.     $awkslashdir = "\"".$awkpartslash."\"";
  52.     if (file_exists("$partwampp\install\.version")) {
  53.         include_once "$partwampp\install\.version";
  54.     }
  55.     $confhttpdroot = $partwampp."\apache\\conf\\httpd.conf";
  56.  
  57.     // Find the install status for xampp basic package in the install.sys file
  58.     if (file_exists($installsysroot)) {
  59.         $i = 0;
  60.         $datei = fopen($installsysroot, 'r');
  61.         while (!feof($datei)) {
  62.             $zeile = fgets($datei, 255);
  63.             $sysroot[] = $zeile;
  64.             $i += 1;
  65.         }
  66.         fclose($datei);
  67.  
  68.         $sysroot[2] = str_replace('perl', 'server', $sysroot[2]); // Fix by Wiedmann
  69.         file_put_contents($installsysroot, implode('', $sysroot));
  70.  
  71.         list($left, $right) = split (' = ', $sysroot[0]);
  72.         $right = eregi_replace ("\r\n", "", $right);
  73.         if (strtolower($partwampp) == strtolower($right)) {
  74.             $xamppinstaller = "nothingtodo";
  75.         } else {
  76.             $xamppinstaller = "newpath";
  77.             $substit = eregi_replace ("\\\\", "\\\\\\\\", $right);
  78.             $substitslash = eregi_replace("\\\\", "/", $right);
  79.         }
  80.     } else {
  81.         $installsys = fopen($installsysroot, 'w');
  82.         $wamppinfo = "DIR = $partwampp\r\nxampp = $xamppversion\r\nserver = 0\r\nperl = 0\r\npython = 0\r\nutils = 0\r\njava = 0\r\nother = 0";
  83.         fputs($installsys, $wamppinfo);
  84.         fclose($installsys);
  85.         $xamppinstaller = "newinstall";
  86.     }
  87.  
  88.     /// Find some *update.sys files and modify the install.sys ...
  89.     $path = $partwampp."\install\\";
  90.     $hdl = opendir($path);
  91.     while ($res = readdir($hdl)) { //Searching all xampp sys files
  92.         $array[] = $res;
  93.      }
  94.     closedir($hdl);
  95.     $werte = count($array);
  96.     for ($q = 2; $q < $werte; $q++) {
  97.         if (($array[$q] == $perlupdatesys) || ($array[$q] == $pythonupdatesys) || ($array[$q] == $serverupdatesys) || ($array[$q] == $utilsupdatesys) || ($array[$q] == $javaupdatesys) || ($array[$q] == $otherupdatesys)) {
  98.             $updatesysroot = $partwampp."\install\\".$array[$q];
  99.             if (file_exists($updatesysroot)) {
  100.                 $datei = fopen($updatesysroot, 'r');
  101.                 unset($updatezeile);
  102.  
  103.                 $i = 0;
  104.                 while (!feof($datei)) {
  105.                     $zeile = fgets($datei, 255);
  106.                     $updatezeile[] = $zeile;
  107.                     @list($left, $right) = split('=', $updatezeile[0]);
  108.                     $left = eregi_replace(" ", "", $left);
  109.                     $left = eregi_replace("\r\n", "", $left);
  110.                     $right = eregi_replace("\r\n", "", $right);
  111.                     $update = $left;
  112.                     $update = strtolower($update);
  113.                     $updateversion = trim($right);
  114.                     $updateversionzahl = preg_split('|[.-]|', $updateversion); // Fix by Wiedmann
  115.                     if (!isset($updateversionzahl[3])) {
  116.                         $updateversionzahl[3] = '';
  117.                     }
  118.                     $updateinc = "xampp".$update.".inc";
  119.                     $updateconf = $update.".conf";
  120.                     echo "  Configure for $update $updateversion\r\n";
  121.                     $i++;
  122.                 }
  123.                 fclose($datei);
  124.  
  125.                 if (file_exists($installsysroot)) {
  126.                     $datei = fopen($installsysroot, 'r');
  127.                     unset($newzeile);
  128.                     $i = 0;
  129.                     while (!feof($datei)) {
  130.                         $zeile = fgets($datei, 255);
  131.                         $newzeile[] = $zeile;
  132.                         $i++;
  133.                     }
  134.                     fclose($datei);
  135.  
  136.         /// Analyze install.sys to *update.syse for todo 
  137.         
  138.         //// Vogelgesang 28.12.2005 => Must take old Section for addon functality
  139.         $datei = fopen($installsysroot,'w'); 
  140.         if($datei) 
  141.             { 
  142.                 for($z=0;$z<$i+1;$z++) 
  143.                 { 
  144.                     if (0 === stripos(trim($newzeile[$z]), trim($update))) // Fix by Wiedmann
  145.  
  146.                     {
  147.                         list ($left, $right) = split ('=', $newzeile[$z]);
  148.                         
  149.                         $left = eregi_replace (" ","",$left);
  150.                         $left = eregi_replace ("\r\n","",$left);
  151.                         $right = trim(eregi_replace ("\r\n","",$right));
  152.                         $currentversionzahl = eregi_replace ("\.","",sprintf('%0-6s',$right)); // Fix by Wiedmann
  153.                         if ($currentversionzahl == 0 )
  154.                         {
  155.                             $updatemake="makenew"; // New installation
  156.                             $putnew="$update = $updateversion\r\n";
  157.                             fputs($datei, $putnew);
  158.                         }
  159.                         elseif ($currentversionzahl < $updateversionzahl)
  160.                         {
  161.                             $updatemake="update";  // Update installation
  162.                             $putnew="$update = $updateversion\r\n";  //Fix by Wiedmann
  163.                             fputs($datei, $putnew);
  164.                         }
  165.                         else
  166.                         {
  167.                             $updatemake="doppelt"; // Installation is current
  168.                             fputs($datei,$newzeile[$z]); 
  169.                         }
  170.  
  171.                     }
  172.                     else 
  173.                     { 
  174.                     fputs($datei,$newzeile[$z]); 
  175.                     }
  176.                 }
  177.             }
  178.     fclose($datei);
  179. //// Vogelgesang 28.12.2005 => Old Section for addon functality end here
  180.  
  181.                 
  182.                     if (($updatemake == "makenew") || ($updatemake=="doppelt")) {
  183.                         include_once "$partwampp\install\\$updateinc";
  184.                     }
  185.                 }
  186.                 // httpd.conf modification for Perl, Python or Java (only single)
  187.                 ////// PATH CHANGING SINCE APACHE 2.2 
  188.                 if ($update == "perl") {
  189.                     $includehttpdconf = "\r\n\r\nInclude conf/extra/perl.conf";
  190.                 }
  191.                 if ($update == "python") {
  192.                     $includehttpdconf = "\r\n\r\nInclude conf/extra/python.conf";
  193.                 }
  194.                 if ($update == "java") {
  195.                     $includehttpdconf = "\r\n\r\nInclude conf/extra/java.conf";
  196.                 }
  197.         if ((($update == "perl") || ($update == "python") || ($update == "java")) && ($updatemake == "makenew")) {
  198.                     $datei = fopen($confhttpdroot, 'a');
  199.                     if ($datei) {
  200.                         fputs($datei, $includehttpdconf);
  201.                     }
  202.                     @fclose($datei);
  203.                     /* $datei = fopen($confhttpd2root, 'a');
  204.                     if ($datei) {
  205.                         fputs($datei, $includehttpdconf);
  206.                     }
  207.                     fclose($datei);
  208.                     $datei = fopen($confhttpd3root, 'a');
  209.                     if ($datei) {
  210.                         fputs($datei, $includehttpdconf);
  211.                     }
  212.                     fclose($datei); */ //Vogelgesang 28.12.06 because obsolet
  213.                 }
  214.  
  215.                 unlink($updatesysroot);
  216.             }
  217.         }
  218.     }
  219.  
  220.     if (($xamppinstaller == "newinstall") || ($xamppinstaller == "newpath")) {
  221.         if ($xamppinstaller == "newinstall") {
  222.             /// First initialization only main packages
  223.             if (file_exists("$partwampp\install\\xamppbasic.inc")) {
  224.                 include_once "$partwampp\install\\xamppbasic.inc";
  225.             }
  226.             if (file_exists("$partwampp\install\\xamppserver.inc")) { // Fix by Wiedmann
  227.                 include_once "$partwampp\install\\xamppserver.inc";
  228.             }
  229.         } else {
  230.             /// Find all the packages
  231.             if (file_exists("$partwampp\install\\xamppbasic.inc")) {
  232.                 include_once "$partwampp\install\\xamppbasic.inc";
  233.             }
  234.             if (file_exists("$partwampp\install\\xamppserver.inc")) {
  235.                 include_once "$partwampp\install\\xamppserver.inc";
  236.             }
  237.             if (file_exists("$partwampp\install\\xamppperl.inc")) {
  238.                 include_once "$partwampp\install\\xamppperl.inc";
  239.             }
  240.             if (file_exists("$partwampp\install\\xampppython.inc")) {
  241.                 include_once "$partwampp\install\\xampppython.inc";
  242.             }
  243.             if (file_exists("$partwampp\install\\xampputils.inc")) {
  244.                 include_once "$partwampp\install\\xampputils.inc";
  245.             }
  246.             if (file_exists("$partwampp\install\\xamppjava.inc")) {
  247.                 include_once "$partwampp\install\\xamppjava.inc";
  248.             }
  249.             if (file_exists("$partwampp\install\\xamppother.inc")) {
  250.                 include_once "$partwampp\install\\xamppother.inc";
  251.             }
  252.             $updatemake = "nothingtodo";
  253.         }
  254.     }
  255.  
  256.     $scount = count($slashrootreal);
  257.     $bcount = count($backslashrootreal);
  258.  
  259.     /////////////////// xampp path is changing ///////////////////
  260.     if ($xamppinstaller == "newpath") {
  261.         set_time_limit(0);
  262.         define('NEWSTDIN', fopen("php://stdin", "r")); // Fix by Wiedmann
  263.         while ($BS == "0") {
  264.             echo "\n  Do you want to refresh the XAMPP installation?\n";
  265.             echo "  Soll die XAMPP Installation jetzt aktualisiert werden?\n\n";
  266.             echo "  1) Refresh now! (Jetzt aktualisieren!)\n";
  267.             echo "  x) Exit (Beenden)\n";
  268.  
  269.             switch (trim(fgets(NEWSTDIN, 256))) { // Fix by Wiedmann
  270.                 case 1:
  271.                     $BS = 1;
  272.                     echo "\r\n  XAMPP is refreshing now ...\r\n";
  273.                     echo "  XAMPP wird nun aktualisiert ...\r\n\r\n";
  274.                     sleep(1);
  275.                     break;
  276.  
  277.                 case "x":
  278.                     echo "\r\n  The refresh is terminating on demand ...  exit\r\n";
  279.                     echo "  Die Aktualisierung wurde auf Wunsch abgebrochen ...\r\n";
  280.                     sleep(3);
  281.                     exit;
  282.  
  283.                 default:
  284.                     exit;
  285.             }
  286.         }
  287.         fclose(NEWSTDIN); // Fix by Wiedmann
  288.     }
  289.  
  290.     /////////////////// You can configure the addon modules for httpd ///////////////////
  291.     if (file_exists($installsysroot)) {
  292.         $datei = fopen($installsysroot, 'r');
  293.         unset($newzeile);
  294.         $i = 0;
  295.         while (!feof($datei)) {
  296.             $zeile = fgets($datei, 255);
  297.             @list($left, $right) = split ('=', $zeile);
  298.             $left = eregi_replace(" ", "", $left);
  299.             $left = eregi_replace("\r\n", "", $left);
  300.             $right = eregi_replace("\r\n", "", $right);
  301.             $right = eregi_replace("\.", "", $right);
  302.             if (strtolower($right) > 0) {
  303.                 if (strtolower($left) == "perl") {
  304.                     $perlactive = "yes";
  305.                 }
  306.                 if (strtolower($left) == "python") {
  307.                     $pythonactive = "yes";
  308.                 }
  309.                 if (strtolower($left) == "java") {
  310.                     $javaactive = "yes";
  311.                 }
  312.             }
  313.         }
  314.         fclose($datei);
  315.     }
  316.  
  317.     /////////////////// Case new install ///////////////////
  318.     if (($xamppinstaller == "newinstall") || ($BS == 1) || ($updatemake == "makenew") || ($updatemake == "doppelt")) {
  319.         if ($BS == "1") {
  320.             echo "  Refreshing all paths in config files ... \r\n\r\n";
  321.         }
  322.  
  323.         echo "  Configure XAMPP with awk for ";
  324.         $system = system("echo '%os%'");
  325.         if ($system != "'Windows_NT'") {
  326.             $system = "Windows";
  327.             echo "  $system 98/ME/HOME (not NT)";
  328.         }
  329.         echo "  Please wait ...";
  330.         if ($xamppinstaller == "newinstall") {
  331.             if ($system == "Windows") {
  332.                 $confhttpdroot = $partwampp."\apache\\conf\\httpd.conf";
  333.                 $includewin = "Win32DisableAcceptEx\r\n";
  334.                 echo "\r\n  Disable AcceptEx Winsocks v2 support (only NT)";
  335.                 $datei = fopen($confhttpdroot, 'r');
  336.                 unset($newzeile);
  337.                 $i = 0;
  338.                 while (!feof($datei)) {
  339.                     $zeile = fgets($datei, 255);
  340.                     $newzeile[] = $zeile;
  341.                     $i++;
  342.                 }
  343.                 fclose($datei);
  344.                 $datei = fopen($confhttpdroot, 'w');
  345.                 if ($datei) {
  346.                     for ($z = 0; $z < $i + 1; $z++) {
  347.                         if (eregi("Win32DisableAcceptEx", $newzeile[$z])) {
  348.                             fputs($datei, $includewin);
  349.                         } else {
  350.                             fputs($datei, $newzeile[$z]);
  351.                         }
  352.                     }
  353.                 }
  354.                 fclose($datei);
  355.             } else {
  356.                 $confhttpdroot = $partwampp."\apache\\conf\\httpd.conf";
  357.                 $includewin = "# Win32DisableAcceptEx\r\n";
  358.                 echo "\r\n  Enable AcceptEx Winsocks v2 support for NT systems";
  359.                 $datei = fopen($confhttpdroot, 'r');
  360.                 $i = 0;
  361.                 unset($newzeile);
  362.                 while (!feof($datei)) {
  363.                     $zeile = fgets($datei, 255);
  364.                     $newzeile[] = $zeile;
  365.                     $i++;
  366.                 }
  367.                 fclose($datei);
  368.                 $datei = fopen($confhttpdroot, 'w');
  369.                 if ($datei) {
  370.                     for ($z = 0; $z < $i + 1; $z++) {
  371.                         if (eregi("Win32DisableAcceptEx", $newzeile[$z])) {
  372.                             fputs($datei, $includewin);
  373.                         } else {
  374.                             fputs($datei, $newzeile[$z]);
  375.                         }
  376.                     }
  377.                 }
  378.                 fclose($datei);
  379.             }
  380.         }
  381.  
  382.         $substit = "\"".$substit."\"";
  383.         $trans = array(
  384.             "^" => "\\\\^",
  385.             "." => "\\\\.",
  386.             "[" => "\\\\[",
  387.             "$" => "\\\\$",
  388.             "(" => "\\\\(",
  389.             ")" => "\\\\)",
  390.             "+" => "\\\\+",
  391.             "{" => "\\\\{"
  392.         );
  393.         $substit = strtr($substit, $trans);
  394.         for ($i = 0; $i <= $bcount; $i++) {
  395.             ///// 08.08.05 Vogelgesang: For all files with identical file names /////
  396.             if ($backslash[$i] == "") {
  397.                 $upbackslashrootreal = $backslashrootreal[$i];
  398.             } else {
  399.                 $configname = $backslash[$i];
  400.                 $upbackslashrootreal = $backslashrootreal[$configname].$configname;
  401.  
  402.             }
  403.             $backslashawk = eregi_replace("\\\\", "\\\\", $upbackslashrootreal);
  404.             $backslashawk = "\"".$backslashawk;
  405.  
  406.             $awkconfig = $backslashawk."\"";
  407.             $awkconfigtemp = $backslashawk."temp\"";
  408.             $configreal = $upbackslashrootreal;
  409.             $configtemp = $upbackslashrootreal."temp";
  410.  
  411.             ///////////// Section SET  NEW configfiles for addons/update OR DELETE /////////////
  412.             $configrealnew = $upbackslashrootreal.".new";
  413.             if (!file_exists($configreal) && file_exists($configrealnew)) {
  414.                 if (!@copy($configrealnew, $configreal)) {
  415.                 } else {
  416.                     unlink($configrealnew);
  417.                 }
  418.             } elseif (file_exists($configrealnew)) {
  419.                 unlink($configrealnew);
  420.             }
  421.  
  422.             if ($updatemake == "doppelt") {
  423.                 break;
  424.             }
  425.  
  426.             $awkrealm = $awkexe." -v DIR=".$awknewdir." -v CONFIG=".$awkconfig. " -v CONFIGNEW=".$awkconfigtemp. "  -v SUBSTIT=".$substit." -f ".$awk;
  427.  
  428.             if (file_exists($awk) && file_exists($awkexe) && file_exists($configreal)) {
  429.                 $handle = popen($awkrealm, 'w'); // Fix by Wiedmann
  430.                 pclose($handle);
  431.             }
  432.  
  433.             if (file_exists($configtemp) && file_exists($configreal)) {
  434.                 if (!@copy($configtemp, $configreal)) {
  435.                 } else {
  436.                     unlink($configtemp);
  437.                 }
  438.             }
  439.         }
  440.  
  441.         $substitslash = "\"".$substitslash."\"";
  442.         $trans = array(
  443.             "^" => "\\\\^",
  444.             "." => "\\\\.",
  445.             "[" => "\\\\[",
  446.             "$" => "\\\\$",
  447.             "(" => "\\\\(",
  448.             ")" => "\\\\)",
  449.             "+" => "\\\\+",
  450.             "{" => "\\\\{"
  451.         );
  452.         $substitslash = strtr($substitslash, $trans);
  453.         for ($i = 0; $i <= $scount; $i++) {
  454.             ///// 08.08.05 Vogelgesang: For all files with identical file names /////
  455.             if ($slash[$i] == "") {
  456.                 $upslashrootreal = $slashrootreal[$i];
  457.             } else {
  458.                 $configname = $slash[$i];
  459.                 $upslashrootreal = $slashrootreal[$configname].$configname;
  460.             }
  461.             $slashawk = eregi_replace("\\\\", "\\\\", $upslashrootreal);
  462.             $slashawk = "\"".$slashawk;
  463.             $awkconfig = $slashawk."\"";
  464.             $awkconfigtemp = $slashawk."temp\"";
  465.             $configreal = $upslashrootreal;
  466.             $configtemp=$upslashrootreal."temp";
  467.  
  468.             ///////////// Section SET  NEW configfiles for addons/update OR DELETE /////////////
  469.             $configrealnew = $upslashrootreal.".new";
  470.             if (!file_exists($configreal) && file_exists($configrealnew)) {
  471.                 if (!@copy($configrealnew, $configreal)) {
  472.                 } else {
  473.                     unlink($configrealnew);
  474.                 }
  475.             } elseif (file_exists($configrealnew)) {
  476.                 unlink($configrealnew);
  477.             }
  478.  
  479.             if ($updatemake == "doppelt") {
  480.                 break;
  481.             }
  482.  
  483.             $awkrealm = $awkexe." -v DIR=".$awkslashdir." -v CONFIG=".$awkconfig. " -v CONFIGNEW=".$awkconfigtemp. "  -v SUBSTIT=".$substitslash." -f ".$awk;
  484.  
  485.             if (file_exists($awk) && file_exists($awkexe) && file_exists($configreal)) {
  486.                 $handle = popen($awkrealm, 'w'); // Fix by Wiedmann
  487.                 pclose($handle);
  488.             }
  489.  
  490.             if (file_exists($configtemp) && file_exists($configreal)) {
  491.                 if (!@copy($configtemp, $configreal)) {
  492.                 } else {
  493.                     unlink($configtemp);
  494.                 }
  495.             }
  496.         }
  497.  
  498.         if (($xamppinstaller == "newpath") || ($BS == 1)) {
  499.             if (file_exists($installsysroot)) {
  500.                 $datei = fopen($installsysroot, 'r');
  501.                 unset($newzeile);
  502.                 $i = 0;
  503.                 while (!feof($datei)) {
  504.                     $zeile = fgets($datei, 255);
  505.                     $newzeile[] = $zeile;
  506.                     $i++;
  507.                 }
  508.                 fclose($datei);
  509.             }
  510.  
  511.             $datei = fopen($installsysroot, 'w');
  512.             if ($datei) {
  513.                 for ($z = 0; $z < $i + 1; $z++) {
  514.                     if (eregi("DIR", $newzeile[$z])) {
  515.                         $includenewdir = "DIR = $partwampp\r\n";
  516.                         fputs($datei, $includenewdir);
  517.                     } else {
  518.                         $includenewdir = $newzeile[$z];
  519.                         fputs($datei, $includenewdir);
  520.                     }
  521.                 }
  522.             }
  523.             fclose($datei);
  524.         }
  525.  
  526.         ////////// Replace (copy) some newer files ////////////////
  527.         $phpversion = trim(@file_get_contents($partwampp."\\install\\.phpversion")); //Fix by Wiedmann
  528.         switch ($phpversion) {
  529.             case 4:
  530.                 $phpbin = $partwampp."\\apache\\bin\\php.ini";
  531.                 $phpcgi = $partwampp."\\php\\php4\\php.ini";
  532.                 @copy($phpbin, $phpcgi);
  533.                 $phpbin = $partwampp."\\php\\php5.ini";
  534.                 $phpcgi = $partwampp."\\php\\php.ini";
  535.                 @copy($phpbin, $phpcgi);
  536.                 break;
  537.  
  538.             default:
  539.                 $phpbin = $partwampp."\\apache\\bin\\php.ini";
  540.                 $phpcgi = $partwampp."\\php\\php.ini";
  541.                 @copy($phpbin, $phpcgi);
  542.                 $phpbin = $partwampp."\\php\\php4\\php4.ini";
  543.                 $phpcgi = $partwampp."\\php\\php4\\php.ini";
  544.                 @copy($phpbin, $phpcgi);
  545.                 break;
  546.         }
  547.  
  548.         $workersbin = $partwampp."\\tomcat\\conf\\workers.properties";
  549.         $workersjk = $partwampp."\\tomcat\\conf\\jk\\workers.properties";
  550.         if (file_exists($workersbin)) {
  551.             copy($workersbin,$workersjk);
  552.         }
  553.  
  554.         echo "  DONE!\r\n\r\n";
  555.         echo "\r\n  ##### Have fun with ApacheFriends XAMPP! #####\r\n\r\n\r\n";
  556.         sleep(3);
  557.     }
  558.  
  559.     //////////////// Selection for modules  ////////////////
  560.     if ((($perlactive == "yes") || ($pythonactive == "yes") || ($javaactive == "yes")) && ($update == "")) {
  561.         $u = 1;
  562.  
  563.         if ($perlactive == "yes") {
  564.             $moduleconf = "conf/extra/perl.conf";
  565.             $moduleconfigure = "MOD_PERL";
  566.             $u++;
  567.         }
  568.         if ($pythonactive == "yes") {
  569.             $moduleconf = "conf/extra/pyton.conf";
  570.             $moduleconfigure = "MOD_PYTHON";
  571.             $u++;
  572.         }
  573.         if ($javaactive == "yes") {
  574.             $moduleconf = "conf/extra/java.conf";
  575.             $moduleconfigure = "MOD_JDK";
  576.             $u++;
  577.         }
  578.  
  579.         set_time_limit(0);
  580.         define('NEWSTDIN', fopen("php://stdin", "r"));
  581.         while ($CS == "0") {
  582.             echo "\n  Please select your choice!\n";
  583.             echo "  Bitte jetzt auswaehlen!\n\n";
  584.             if ($perlactive == "yes") {
  585.                 echo "  1) Configuration with MOD_PERL (mit MOD_PERL)\n";
  586.                 echo "  2) Configuration without MOD_PERL (ohne MOD MOD_PERL)\n";
  587.             }
  588.             if ($pythonactive == "yes") {
  589.                 echo "  3) Configuration with MOD_PYTHON (mit MOD_PYTHON)\n";
  590.                 echo "  4) Configuration without MOD_PYTHON (ohne MOD_PYTHON)\n";
  591.             }
  592.             if ($javaactive == "yes") {
  593.                 echo "  5) Configuration with MOD_JDK (mit MOD_JDK)\n";
  594.                 echo "  6) Configuration without MOD_JDK (ohne MOD_JDK)\n";
  595.             }
  596.             echo "  x) Exit (Beenden)\n";
  597.  
  598.             switch (trim(fgets(NEWSTDIN, 256))) {
  599.                 case 1:
  600.                     $CS = 1;
  601.                     echo "\r\n  Starting configure XAMPP with MOD_PERL ...\r\n";
  602.                     sleep(1);
  603.                     break;
  604.  
  605.                 case 2:
  606.                     $CS = 2;
  607.                     echo "\r\n  Starting configure XAMPP without MOD_PERL ...\r\n";
  608.                     sleep(1);
  609.                     break;
  610.  
  611.                 case 3:
  612.                     $CS = 3;
  613.                     echo "\r\n  Starting configure XAMPP with MOD_PYTHON ...\r\n";
  614.                     sleep(1);
  615.                     break;
  616.  
  617.                 case 4:
  618.                     $CS = 4;
  619.                     echo "\r\n  Starting configure XAMPP without MOD_PYTHON ...\r\n";
  620.                     sleep(1);
  621.                     break;
  622.  
  623.                 case 5:
  624.                     $CS = 5;
  625.                     echo "\r\n  Starting configure XAMPP with MOD_JDK ...\r\n";
  626.                     sleep(1);
  627.                     break;
  628.  
  629.                 case 6:
  630.                 $CS = 6;
  631.                 echo "\r\n  Starting configure XAMPP without MOD_JDK ...\r\n";
  632.                 sleep(1);
  633.                 break;
  634.  
  635.                 case "x":
  636.                     echo "\r\n  Setup is terminating on demand ...  exit\r\n";
  637.                     echo "  Das Setup wurde auf Wunsch abgebrochen ...\r\n";
  638.                     sleep(3);
  639.                     exit;
  640.  
  641.                 default:
  642.                     exit;
  643.             }
  644.         }
  645.         fclose(NEWSTDIN);
  646.  
  647.         if ($CS == 1) {
  648.             $include = "Include conf/extra/perl.conf"; $searchstring="conf/extra/perl.conf";
  649.         }
  650.         if ($CS == 2) {
  651.             $include = "# Include conf/extra/perl.conf"; $searchstring="conf/extra/perl.conf";
  652.         }
  653.         if ($CS == 3) {
  654.             $include = "Include conf/extra/python.conf"; $searchstring="conf/extra/python.conf";
  655.         }
  656.         if ($CS == 4) {
  657.             $include = "# Include conf/extra/python.conf"; $searchstring="conf/extra/python.conf";
  658.         }
  659.         if ($CS == 5) {
  660.             $include = "Include conf/extra/java.conf"; $searchstring="conf/extra/java.conf";
  661.         }
  662.         if ($CS == 6) {
  663.             $include = "# Include conf/extra/java.conf"; $searchstring="conf/extra/java.conf";
  664.         }
  665.  
  666.         if ($CS > 0) {
  667.             $i = 0;
  668.             $datei = fopen($confhttpdroot, 'r');
  669.             while (!feof($datei)) {
  670.                 $zeile = fgets($datei, 255);
  671.                 $newzeile[] = $zeile;
  672.                 $i++;
  673.             }
  674.             fclose($datei);
  675.             $datei = fopen($confhttpdroot, 'w');
  676.             if ($datei) {
  677.                 for ($z = 0; $z < $i + 1; $z++) {
  678.                     if (eregi($searchstring, $newzeile[$z])) {
  679.                         fputs($datei, $include);
  680.                     } else {
  681.                         fputs($datei, $newzeile[$z]);
  682.                     }
  683.                 }
  684.             }
  685.             fclose($datei);
  686.             unset($newzeile);
  687.             
  688.             /// Vogelgesang 28.12.06 because obsolet since 1.51
  689.             /* $i = 0;
  690.             $datei = fopen($confhttpd2root, 'r');
  691.             while (!feof($datei)) {
  692.                 $zeile = fgets($datei, 255);
  693.                 $newzeile[] = $zeile;
  694.                 $i++;
  695.             }
  696.             fclose($datei);
  697.             $datei = fopen($confhttpd2root, 'w');
  698.             if ($datei) {
  699.                 for($z = 0; $z < $i + 1; $z++) {
  700.                     if (eregi($searchstring, $newzeile[$z])) {
  701.                         fputs($datei, $include);
  702.                     } else {
  703.                         fputs($datei, $newzeile[$z]);
  704.                     }
  705.                 }
  706.             }
  707.             fclose($datei);
  708.             unset($newzeile);
  709.             $i = 0;
  710.             $datei = fopen($confhttpd3root, 'r');
  711.             while (!feof($datei)) {
  712.                 $zeile = fgets($datei, 255);
  713.                 $newzeile[] = $zeile;
  714.                 $i++;
  715.             }
  716.             fclose($datei);
  717.             $datei = fopen($confhttpd3root, 'w');
  718.             if ($datei) {
  719.                 for ($z = 0; $z < $i + 1; $z++) {
  720.                     if (eregi($searchstring, $newzeile[$z])) {
  721.                         fputs($datei, $include);
  722.                     } else {
  723.                         fputs($datei, $newzeile[$z]);
  724.                     }
  725.                 }
  726.             }
  727.             fclose($datei);
  728.             unset($newzeile);*/ 
  729.             echo "  Done!\r\n\r\n";
  730.         }
  731.     }
  732.  
  733.     if (file_exists($partwampp.'\install\serverupdate.inc')) { // Fix by Wiedmann
  734.         include $partwampp.'\install\serverupdate.inc';
  735.         unlink($partwampp.'\install\serverupdate.inc');
  736.         echo "\r\n".'Ready.'."\r\n";
  737.     }
  738.  
  739.     if ($updatemake == "") {
  740.         $updatemake="nothingtodo";
  741.     }
  742.  
  743.     if (($updatemake == "nothingtodo") && ($xamppinstaller == "nothingtodo") && (($CS < 1) || ($CS == ""))) {
  744.         echo "\r\n\r\n Sorry, but ... nothing to do!\r\n\r\n\r\n";
  745.     }
  746.  
  747.     exit;
  748. ?>
  749.