homepage Welcome to WebmasterWorld Guest from 54.226.252.142
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Remote server and local server behave differently
abovenbeyond




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

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

 

ag_47




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

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

Pico_Train




msg:3650981
 3:59 pm on May 15, 2008 (gmt 0)

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!

abovenbeyond




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

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>";
?>

ag_47




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

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

abovenbeyond




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

many thanks ag_47...

My this problem is now solved...

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved