Sessions not working in Yahoo Small business

This is a discussion on Sessions not working in Yahoo Small business within the PHP Language forums, part of the PHP Programming Forums category; Hi, I developed web app using Php and used sessions. Everything works on my test server but sessions just dont ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-03-2005
phpvial
 
Posts: n/a
Default Sessions not working in Yahoo Small business

Hi,
I developed web app using Php and used sessions. Everything works on
my test server but sessions just dont work on the clients server which
uses Yahoo Small Business to host their site.

For example:
<?php
session_start();
if (!$_SESSION['count']) {
echo "Not registered<BR>";
$_SESSION['count'] = 1;
$count = 1;
} else {
$count = $_SESSION['count']++;
}
echo "count is '$count'";
?>


Always shows count as 1.


The yahoo site uses PHP Version 4.3.6.
The only difference relevant I can see in the two sites is
session.use_trans_sid which is off on Yahoo. Enabling this with ini_set
didnt help. Saving session information in the DB using custome session
handlers didnt help either.
Any ideas as to why this may be happenning?

Thanks in advance!

Other relevant php info is pasted below:

Session Support enabled
Registered save handlers files user

Directive Local Value Master Value
session.auto_start Off Off
session.bug_compat_42 On On
session.bug_compat_warn On On
session.cache_expire 180 180
session.cache_limiter nocache nocache
session.cookie_domain no value no value
session.cookie_lifetime 0 0
session.cookie_path / /
session.cookie_secure Off Off
session.entropy_file no value no value
session.entropy_length 0 0
session.gc_divisor 100 100
session.gc_maxlifetime 1440 1440
session.gc_probability 1 1
session.name PHPSESSID PHPSESSID
session.referer_check no value no value
session.save_handler files files
session.save_path /tmp /tmp
session.serialize_handler php php
session.use_cookies On On
session.use_only_cookies Off Off
session.use_trans_sid Off Off

Reply With Quote
  #2 (permalink)  
Old 04-04-2005
NC
 
Posts: n/a
Default Re: Sessions not working in Yahoo Small business

phpvial wrote:
>
> I developed web app using Php and used sessions. Everything
> works on my test server but sessions just dont work on the
> clients server which uses Yahoo Small Business to host their
> site.


I have a site hosted there. Sessions work correctly.

> For example:
> <?php
> session_start();
> if (!$_SESSION['count']) {
> echo "Not registered<BR>";
> $_SESSION['count'] = 1;
> $count = 1;
> } else {
> $count = $_SESSION['count']++;
> }
> echo "count is '$count'";
> ?>
>
> Always shows count as 1.


I have encountered this behavior before. What happens here
is a typing issue. PHP seems to think that every variable
in the predefined variables is a string. So the ++ operator
has no effect on any of those variables. What you should do
is to give PHP a hint that $_SESSION['count'] should be
treated as an integer:

$count = $_SESSION['count'] + 1;

This will solve your problem.

Cheers,
NC

Reply With Quote
  #3 (permalink)  
Old 04-04-2005
phpvial
 
Posts: n/a
Default Re: Sessions not working in Yahoo Small business

Hi NC,
Thanks for your reply. Its not just that the count is never
incremented, no session variables seem to be saved at all. I was just
using the above as an example (because of the underlying problem even
changing it to "$count = $_SESSION['count'] + 1;" didnt work for me).
Any other possibility? Do I need to initialize anything else? Any per
user config options?

Thanks!

Reply With Quote
  #4 (permalink)  
Old 04-17-2005
phpvial
 
Posts: n/a
Default Re: Sessions not working in Yahoo Small business

I found the solution to this problem and wanted to share it with the
group in case anyone else has it too.
Yahoo Small Business requires a tmp directory to be created at the root
of the users home directory. This is where sessions information is
stored.

Reply With Quote
  #5 (permalink)  
Old 04-18-2005
jp777
 
Posts: n/a
Default re:Sessions not working in Yahoo Small business

DOOD. I figured it out

http://help.yahoo.com/help/us/webhosting/php/php-29.htm

All you have to do is create a /tmp directory on your site. It wil
all work after that

SWEEET

Jaso
http://eye.cc -php- web design
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 10:53 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0