Welcome to WebmasterWorld Guest from 54.166.152.121

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Remote server and local server behave differently

     
2:41 am on May 15, 2008 (gmt 0)

5+ Year Member



Hi friends

I am having the problem with some PHP script which wont run properly when uploaded in remote web server though they work nicely in local web server...for example

In my php login script remote server gives an error like cannot modify header information

thanks

3:53 am on May 15, 2008 (gmt 0)

5+ Year Member



Do both servers have the same PHP version? You may be using some methods not supported by older versions. Also double check your php.ini files to make sure they are similar where needed
3:59 pm on May 15, 2008 (gmt 0)

10+ Year Member



you might be sending a header location redirect, move it a couple lines or re-order the logic and see if that works.

also do a phpinfo() on both servers and compare...

and posting your script might help too!

1:22 am on May 16, 2008 (gmt 0)

5+ Year Member



ag_47....

my local server has php 5.0.4 and remote has got 5.2.6....will that affect?

my script is very basic...
FILE: logincheck.php
<?php
session_start();

if(isset($_POST['username']) && isset($_POST['password']))
{
$username=$_POST['username'];
$password=$_POST['password'];
if ($username=="xyz" && $password=="xyz")
{
session_register('login');
$_SESSION['login']=true;
}
else
echo "incorrect username or password";
}
?>
/////
Some HTML Code
/////
<?PHP
if(isset($_SESSION['login']) && $_SESSION['login']==true)
{

echo "<a href='../admin/logout.php'>Logout</a>";
}
else
echo "<a href='../admin/index.php'>Login</a>";
?>

1:40 am on May 16, 2008 (gmt 0)

5+ Year Member



Don't use session_register();
$_SESSION['login']=true; is enough. Use of session_register() is deprecated.
[ca.php.net...]

Other than that it looks fine. GL

3:29 am on May 16, 2008 (gmt 0)

5+ Year Member



many thanks ag_47...

My this problem is now solved...

 

Featured Threads

Hot Threads This Week

Hot Threads This Month