I have Ubuntu 9.10 running on Oracle Virtual Box in my Windows Vista computer. I have XAMPP running on both. The host is currently set to 192.168.10.4 and the Virtual machine at 192.168.10.3.

I tried running the same code independently on both computers and it runs fine on Windows. In Ubuntu, I get the error message:

The page isn't redirecting properly
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

I tried calling the Windows pages on Ubuntu(using 192.168.10.4/code.php) and it ran fine. I tried running the Ubuntu pages on Windows and got the same error above. This led me to the conclusion that the server on Ubuntu has some problems. Any idea where I should edit? I haven't added anything on the Ubuntu config files. Its a fresh install of XAMPP/LAMP consisting of Apache 2.2.14, MySQL 5.1.41, PHP 5.3.1.

I've never come across that message before but what Firefox is telling you is that the site is redirecting you in a loop E.g. Page A sends you to Page B which sends you to Page A.
An alternative is to install Google Chrome and see if you get a similar error message, if that fails:
Could be a cookies problem - have you cleared the cache on your virtual host?
Could you post the contents of /etc/apache2/sites-available/default

Just found this on the ubuntu forum:

"You can remedy this by installing a simple Firefox extension called User Agent Switcher, effectively allowing you to switch your user agent string within the browser, allowing you to view sites that are IE only, etc.

After you get it installed, restart Firefox, and then modify your User Agent string via Tools > User Agent Switcher. Then choose Internet Explorer 6 (Windows XP). Then view the site you were trying to view before. Bingo!

Here's the link: https://addons.mozilla.org/firefox/59/"

Hello, thanks for the replies and the suggestions. I installed that User Agent Switcher and followed the instructions. Sadly, the problem still remains.

I have a new discovery though. I downloaded Opera and the code runs well. However, the most important thing is for it to run on Firefox. Firefox on the Virtual Machine(Ubuntu 9.10) and host(Windows Vista) are still unable to run the php code hosted on the Ubuntu machine.

I also downloaded Google Chrome and got "This webpage has a redirect loop." error. All in all, tested on 3 browsers and it only runs on Opera.

Here is the content of /etc/apache2/sites-available/default

<VirtualHost *:80>
	ServerAdmin webmaster@localhost

	DocumentRoot /var/www
	<Directory />
		Options FollowSymLinks
		AllowOverride None
	</Directory>
	<Directory /var/www/>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride None
		Order allow,deny
		allow from all
	</Directory>

	ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
	<Directory "/usr/lib/cgi-bin">
		AllowOverride None
		Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
		Order allow,deny
		Allow from all
	</Directory>

	ErrorLog /var/log/apache2/error.log

	# Possible values include: debug, info, notice, warn, error, crit,
	# alert, emerg.
	LogLevel warn

	CustomLog /var/log/apache2/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

Hmm that's a strange one... There's nothing wrong with your config file.

There was a guy posting about this same problem earlier. You can find his thread here http://www.daniweb.com/forums/thread320621.html

He said that his problem was with an infinite loop caused by header redirects. Are you using header redirects in your code? If you are, perhaps try and comment them out and see if the problem remains.

Thanks for the help. I do have header redirects but when commented out, the problem still remains. I modified the previous post, don't know if you noticed it. I just mentioned that the problem is also the same in Chrome. Still don't understand why it does run on Opera.

This could possibly be a problem specific to WAMP/LAMP or whatever you're using. You could try removing it completely and do a fresh install of each piece of software e.g. apache / php5 / mysql seperately. But it could be a lot of work if it turns out to not work!

Here are the packages you'll need if you decide to go down that route:

sudo apt-get install apache2
sudo apt-get install mysql-server php5-mysql mysql-client-5.1
sudo apt-get install php5 php5-cli

thanks for the suggestion. i will give it a go later and post the results as soon as possible.

Can you explain what it is your code does? Do you set cookies etc in your code? Do all your scripts produce this same error, or is it just one that's causing the problem? Perhaps commenting out blocks of your code will narrow down the issue (should your problem reside in your code).

Also found this on linuxquestions forum:

"However, after many hours of searching and reading the solution to my problem was rather simple.
In the Preference/Privacy menu you have to change the Firefox will: to "Use custom settings for history" and there is "Accept cookies from sites" Exceptions box. In it was my problem web site.
Problem resolved."

Hope this works for you!

Cookies are not a problem. With or without them, the program does not run. All my scripts produce this error so I guess it is not a code issue.

Bump. Thanks for the help. Still unresolved though. :(

Update:

I am using sessions here. Is there anything that I am missing? I tried commenting this part of my code and the loop disappears. Still, I need this code for logging in though.

<?
	include("authenticate.php");

		$sql = "SELECT * FROM admin WHERE Logged_in = '$session_id'";
		$q = mysql_query($sql) or 	die(mysql_error());
		
		if(mysql_num_rows($q) !=0)
		{
			$r = mysql_fetch_assoc($q);
			$old= "";
			$r['Logged_in'] = $session_id;

			session_destroy();
	
			$sql="update admin set Logged_in='$old' where Logged_in='$session_id' ";
			$q = mysql_query($sql) or die(mysql_error());
			header("Location:home_admin.php");
		}
		else
		{
			header("Location:login.php");
		}
?>

As mentioned earlier, I commented out the header redirects and the problem persisted. Without the entire code, problem is solved. What is wrong? Hope someone can help. Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.