You are here: Re: [PHP] Re: why are session only working with cookies? « PHP « IT news, forums, messages
Re: [PHP] Re: why are session only working with cookies?

Posted by Richard Lynch on 05/17/05 05:10

On Mon, May 16, 2005 6:24 am, Brian V Bonini said:
> On Sat, 2005-05-14 at 22:44, Richard Lynch wrote:
>> Using Cookies, or using URL, the session DATA will be stored on the
>> server
>> in /tmp files -- Unless you change php.ini to store them somewhere else,
>> in which case, again, the Cookie and URL only holds the ID and all the
>> data goes wherever you store it: database, shared memory, or an army of
>> elves for all PHP cares.
>>
>> If trans_sid is "not working" for you, let's narrow this down:
>>
>> If you do this:
>> <?php
>> session_start();
>> echo "<a href=\"yourdomainnamehere.com\">click me</a><br />\n";
>> ?>
>>
>> Do you see something like "?PHPSESSID=a847hjfu3734hgfjgurur" tacked on
>> to
>> the end of the URL?
>>
>> If not, trans_sid is NOT enabled.
>
> I don't see the session id string, BUT, I do have session.use_trans_sid
> = 1 set in php.ini and I did restart Apache after setting it.. I can see
> the session file being created in /tmp but the values are not being
> incremented as they should per script below.

I'm going to stop reading here. :-)

We know that somehow, some way, PHP is not using trans_sid, because your
URL isn't showing the session ID.

I dunno why, or what's in the php.ini that's not working, but don't try to
go beyond this step with XML, or anything else that complicates life.

The question now is why your php.ini changes are not taking effect.

The usual reason is you edited *A* php.ini file, but not the one Apache is
reading.

Does <?php phpinfo();?> show the same /path/to/php.ini as the one you edit?

Whatever path it shows, that is where your php.ini has to be. [*]

Edit the one that is there, or if there isn't one there, move the one you
edited to *BE* there, or copy php.ini.dist from your PHP source (or Google
for it) and use that.

It's also remotely possible that apachectl incorrectly reported successful
stop/start when, in fact, the old httpd is still running. This is rare,
but I've had it happen to me.

To be 100% certain, use 'stop' to stop Apache and then do:
ps auxwwww | grep httpd

You should see only the "grep httpd" output, or no output at all.

If you see a bunch of httpd process running, you didn't stop Apache.

Find a way to stop Apache. Either use some other script to stop it (like
whatever is in your /etc/rc.d/* files) or some other version of apachectl
that works better with your httpd or... Hell, kill -9 it, I guess...

Then start Apache, and triple check <?php phpinfo();?> shows the php.ini
file being read from the same directory you edited php.ini

[*] I'm told that in Apache 2, there is a phpIniDir directive you can set
in httpd.conf to tell PHP where to find php.ini instead of being forced to
re-compile or (easier) move your php.ini where your PHP Module binary
expects it. While that may be true, I'm sticking with an answer that fits
all situations. Let him fight with phpIniDir some other day.

--
Like Music?
http://l-i-e.com/artists.htm

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация