Web lists-archives.com

Re: [PHP] SESSION ID Problem.




On Thu, Nov 2, 2017 at 12:46 PM, Adam Jon Richardson <adamjonr@xxxxxxxxx>
wrote:

> On Thu, Nov 2, 2017 at 12:39 PM, Tedd Sperling <tedd@xxxxxxxxxxxx> wrote:
>
>> Hi gang:
>>
>> Normally when I want to start a session, I use --
>>
>> <?php session_start();
>>
>> — and this has worked for me for years.
>>
>> Starting last semester, my PHP class started having problems with session
>> ID’s.
>>
>> The problem occurs as follows:
>>
>> Student “A" runs their code (using session_start() ) and everything works.
>>
>> Student “B" runs their code (using session_start() ) and the server
>> reports "Permission denied (13) in…” — AND displays the exact same session
>> ID as the first student (Student A).
>>
>> Oddly enough, after a while, things work out and the server starts
>> generating different session ID's for each student.
>>
>> Anyone have an ideas as to why this happens?
>>
>> Keep in mind, that both students have their own separate account on the
>> school's server AND they are running their own scripts . Even my scripts
>> are not immune to this problem. For example try running my script here:
>>
>> http://citw.lcc.edu/~sperlt/citw185/examples/session-page1.php
>>
>> Currently, my script generates:
>>
>> Warning: session_start(): open(/var/cpanel/php/sessions/
>> ea-php56/sess_qsabg71cg8u6i2dfgpsbmfth74, O_RDWR) failed: Permission
>> denied (13) in /home/sperlt/public_html/citw185/examples/session-page1.php
>> on line 3
>>
>> However, yesterday the script ran without error.
>>
>
> Sometimes this can mean that there are disk space issues. I've had this
> issue in the past, and one of the answers on SO (by Haz) suggests the same
> thing:
> https://stackoverflow.com/questions/4585086/how-can-i-
> fix-the-permission-error-when-i-call-session-start
>

And, as David Goodwin noted on that same SO link, it seems like I also had
a garbage collection issue long ago that proved just as unpredictable. If
the issue persists, you could always use a custom handler with MySQL or
SQLite to circumvent it just to ensure your students can avoid issues until
you can figure out the issues. Sometimes I completely purge the tmp
directory (or whatever directory is being written to) just to make sure
there aren't any file permission issues.

Adam