php-switch.bat does not work on xp sp2

Problems with the Windows version of XAMPP, questions, comments, and anything related.

php-switch.bat does not work on xp sp2

Postby hanpedro » 20. April 2005 10:21

I could not switch php5 to 4 with php-switch.bat.

my machine is xp sp2.
hanpedro
 
Posts: 134
Joined: 09. February 2005 06:03
Operating System: SCientific Linux 6.1 x86

Postby prathapml » 22. April 2005 00:50

no idea what could be wrong with your machine.
I am on XPSP2, and the switching and paths-refreshing and all other functions work just fine.

Maybe giving detailed and deeper description of the underlying software environment, and the exact error noticed, could help us to help you.
prathapml
 
Posts: 87
Joined: 11. March 2005 23:03

Re: PHP Switch Does Not Work

Postby New10 » 30. April 2005 13:40

I just installed Xampp on Windows XP Home Edition with SP2 installed.
The PHP switch will not switch from PHP5 down to PHP4.
The PHP-switch.bat always says "The Apache is running."
But, Apache is not running. I have even removed Xampp, rebooted, re-installed Xampp, and PHP-switch.bat still says Apache is running. I turn off Apache, and PHP-switch.bat still says Apache is running.

I note that this is a dual boot PC with Linux & Windows XP. When I boot in Linux and install Xampp, I can switch between PHP5 and PHP4 with no problem.
New10
 
Posts: 1
Joined: 30. April 2005 13:28

Postby MPeace » 02. July 2005 19:45

Hi,

I have the same problem, so what I tried was to change the following in instal/php-switch.php

Code: Select all
<?php

/*
#### Installer PHP  1.4 RC2  ####
#### Author: Kay Vogelgesang for www.apachefriends.org 2004 #### 
*/   

print "\r\n  ########################################################################\n
  # ApacheFriends XAMPP PHP Switch win32 Version 1.0                     #\r\n
  #----------------------------------------------------------------------#\r\n
  # Copyright (c) 2002-2004 Apachefriends                                #\r\n
  #----------------------------------------------------------------------#\r\n
  # Authors: Kay Vogelgesang <kvo@apachefriends.org>                     #\r\n
  #          Oswald Kai Seidler <oswald@apachefriends.org>               #\r\n
  ########################################################################\r\n\r\n";

$host="127.0.0.1";
$timeout="1";
if (($handle = @fsockopen($host, 80, $errno, $errstr, $timeout)) == true)


to this

Code: Select all
<?php

/*
#### Installer PHP  1.4 RC2  ####
#### Author: Kay Vogelgesang for www.apachefriends.org 2004 #### 
*/   

print "\r\n  ########################################################################\n
  # ApacheFriends XAMPP PHP Switch win32 Version 1.0                     #\r\n
  #----------------------------------------------------------------------#\r\n
  # Copyright (c) 2002-2004 Apachefriends                                #\r\n
  #----------------------------------------------------------------------#\r\n
  # Authors: Kay Vogelgesang <kvo@apachefriends.org>                     #\r\n
  #          Oswald Kai Seidler <oswald@apachefriends.org>               #\r\n
  ########################################################################\r\n\r\n";

$host="127.0.0.1";
$timeout="1";
if (($handle = @fsockopen($host, 80, $errno, $errstr, $timeout)) == "Hello")


And then ran the php-switch again, making sure that Apache was not running and it worked a treat. I am now able to switch between the two. be careful when swtiching I have made this quick fix because I am using osCommerce which doesn't work with PHP5 so I will not be switching.

Maybe adding in a "Are you sure Apache is not running statement would be a good idea instead of forcing the exit when the is port 80 open check is made."
Matt Peace
MPeace
 
Posts: 2
Joined: 02. July 2005 19:29
Location: UK

Postby Wiedmann » 02. July 2005 20:19

That's really quick 'n dirty ;-)

We have a fix for this problem:

replace:
Code: Select all
$host="127.0.0.1";
$timeout="1";
if (($handle = @fsockopen($host, 80, $errno, $errstr, $timeout)) == true)
{
@fclose($handle);
echo "   The Apache is running! Please stop the Apache before make this procedure!\r\n";
echo "   Der Apache laeuft gerade! Bitte den Apache fuer diese Prozedur stoppen!\r\n";
echo "   PHP Switch exit ...\r\n\r\n";
exit();
}
else
{
@fclose($handle);


with:
Code: Select all
ini_set('default_socket_timeout', '3');
if (false !== ($handle = @fopen('http://127.0.0.1/', 'r'))) {
   fclose($handle);
   echo '   The Apache is running! Please stop the Apache before make this procedure!'."\n";
   echo '   Der Apache laeuft gerade! Bitte den Apache fuer diese Prozedur stoppen!'."\n";
   echo '   PHP Switch exit ...'."\n\n";
   exit;
} else {
   unset($handle);
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby MPeace » 04. July 2005 15:08

Quick 'n dirty just like my woman :wink:

Thanks for the correction to my workaround :coughs: it works nicely.
Matt Peace
MPeace
 
Posts: 2
Joined: 02. July 2005 19:29
Location: UK


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 134 guests