Click to See Complete Forum and Search --> : [Resolved] Apache working with cookies under Windows but not under Linux
Hi, I developed a Poll system that uses cookies. It works fine under Windows (Apache and MySQL), but it does not work properly under Linux.
Cookies does not work when I use the system under Linux (Apache and MySQL).
I already checked Webmin, php.ini but it does not read the cookie so the same visitor can vote more than one time.
Could you help me ?
Thank you!
Gabriel
ksandom
07-13-2003, 08:29 AM
When you say they are not working, what do you mean? Is it not setting the cookies? Is an error comming up?
I had a similar problem when I moved to Linux. For me it was because the newer versions of PHP (on any platform as far as I am aware) default "register_globals" to off. This can be set to on in the php.ini. However this should be a last resort. The reason "register_globals" is now defaulted to off is because of a security risk you are likley to expose by having it on.
For me, working with $_SESSION['varname'] and $_POST['varname'] help get my project working again. This won't be the right solution for you, but I suspect it might get you going in the right direction.
Thank you ksandom for your reply.
When I said "is not working" I meant that is not setting the cookie.
I have changed the system and now is using: $_SESSION['varname'] and $_POST['varname'].
register_globals is set to off in both Windows and Linux.
The same system works fine under Windows but not under RedHat 8.
There must be some setting within Linux that is not properly set, maybe directory permissions ?
Could anyone provide me ALL settings and ALL things to check under Linux related to Sessions ?
ksandom
07-31-2003, 07:08 AM
ok, let's check your permissions. I don't think this is it, but lets check anyway.
Where are your web docs stored?
Could you please get your fstab from /etc and post it here (/etc/fstab). Same for /etc/httpd/conf/httpd.conf . For efficiency do httpd.conf as an attachment and fstab by pasting it in the message, or do two separate posts if you prefer.
Also do 'ls / -l'. Specifically, look at tmp. It should look something like this:
drwxrwxrwt 15 root root 4096 Jul 31 21:09 tmp
As shown here, tmp should be accessible to all.
Might have to look at these files (mentioned above) before suggesting more.
stolzyboy
07-31-2003, 10:54 AM
how exactly are you setting the cookie, and when you want to check for it, you wouldn't use $_SESSION, use $_COOKIE
ksandom: I am pasting you part of the info you requested, the last one is the way the cookie file is written (is it correct apache as owner ?)
LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
/dev/hda3 swap swap defaults 0 0
/dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0
drwxrwxrwt 23 root root 4096 ago 5 18:25 tmp
-rw------- 1 apache apache 65 ago 4 18:08 sess_0603bc63c653dbeaa2532a700b87e05a
Do you need the entire httpd.conf file or just a part of it ?
Thank you in advance
ksandom
08-05-2003, 07:43 PM
Have you looked at stolzyboy's post? stolzyboy is quite right, I told you the wrong one to use there. If you haven't tried it, give it ago before trying anything further.
Newbies FAQ (http://www.phpbuilder.com/board/showthread.php?s=&threadid=10245251) - this has a section about sessions and cookies which gives good info. Have a look as it might add some good insight.
php.net - setcookie() (http://php.net/manual/en/function.setcookie.php) - This also has some good information.
If the above still fails, send in the the whole httpd.conf. Below the text area in this posting area, you can attach a file. Put it in there to save forum dignity ;) . The reason I have said the whole file is because if there is a problem, it's quite possible that it's in more than one place or that there is more than one problem spread over the config file.
Looking at the Newbies FAQ, I think you will find the solution there without having to modify any configuration.
PHP Builder
Copyright WebMediaBrands Inc. All Rights Reserved.