Page 1 of 1
PHP session problem
Posted: Sat Jul 19, 2003 8:30 pm
by systemphp

Need help!
I tested my PHP codes on my home linux box, they all worked fine. But they don't work on my hosted website.
I have Sessions in my code. I need search, login, and shopping cart function. Home page works with PHP/MySQL, but buttons like search, login don't work (blank page with PHPSESSID=****** in the URL). Strange is I can load my login.php and search.php directly, but again buttons in these page don't work and only give blank page.
I guess I have session problem.
Can anyone give me some hints? How to setup or write sessions in this case?
Thanks in advance!
Posted: Sat Jul 19, 2003 10:34 pm
by Stoker
WHat version of PHP at home and what version at your webhost?
Posted: Mon Jul 21, 2003 2:52 am
by twigletmac
What session information do you get if you put a script with
in it on the web host?
Mac
Posted: Tue Jul 22, 2003 12:32 am
by systemphp
Thank you all!
Webhost: PHP 4.3.1
max_input_time -1
register_globals on
y2k_compliance off
My Linux: PHP 4.3.0
max_input_time 60
register_globals off
y2k_compliance on
I only see these differences. I can get ride of PHPSESSID by adding ini_set('session.use_trans_sid', false);
but it still doesn't work.
This is what in the browser URL window: http://www.***.net/buttons.php?search=Search
Blank in brower.
In the buttons.php I have:
header("Location:search.php?{$_SERVER["QUERY_STRING"]}");
It doesn't redirect to search.php?!
I tested <?php header("Location:search.php?{$_SERVER["QUERY_STRING"]}"); ?> in a seperate file, and search.php did show up, but buttons on that page had same problem.
I still suspect PHP setting is the problem, but I don't know how to change it. I have a .htaccess file where I put my settings in.
Thanks again!
Posted: Tue Jul 22, 2003 8:24 am
by Stoker
syntax for http header Location is
Location: url
the colon should have no space in front and one space after (It has never been any other way, although some say certain PHP version(s) behaved different, the http spec is now... And remember, you must urlencode the query string if it has any spaces or slashes or any non-standard letters..
Another comment, what is the purpose of that redirect? seems rather useless, a simple include would work, or perhaps a mod_rewrite rule ?
Posted: Thu Jul 24, 2003 9:51 am
by systemphp
Thank you all!
The button php file might have problem, also the server PHP settings probably is a point too. After I contact with the hosting support, it works okay now.
Thanks again