Results 1 to 2 of 2

Thread: session_start() Permission denied

  1. #1
    Join Date
    Oct 2011
    Location
    London
    Posts
    41
    Thanks
    19
    Thanked 1 Time in 1 Post

    Default session_start() Permission denied

    hi guys i was working on my site when this error came up for no reason does any one know why

    Warning: session_start() [function.session-start]: open(/tmp/sess_79beb3aeefcc73f4e665579affcc61f2, O_RDWR) failed: Permission denied (13) in /home/chsitesc/public_html/ac2/index.php on line 1

  2. #2
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    looks like you don't have write access to the /tmp directory (where sessions are saved by default). Does your host advertise that they allow PHP sessions? There are two possibilities:

    1. you can specify another directory to save session files in.
    This is actually preferable anyway, since it closes a BIG security hole by moving session information OUT of /tmp, which is a shared directory on most webhosts. Try the following:
    PHP Code:
    <?php
    // this is the directory below your web root:
    //   you should actually create a new directory there to handle your sessions
    //   (so you don't have session files mixed up with other stuff).
    //   as written, this code will tell you IF this solution will work,
    //     but you shouldn't just use it "as-is."
    /*
    FOR EXAMPLE, if your web root is something like /home/users/TwitterRooms/public_html/, 
    you can create the directory /home/users/TwitterRooms/session_tmp/
    (and use that path as $sessionPath).
    */
    $sessionPath realpath$_SERVER['DOCUMENT_ROOT'].'../' ).'/';
    session_set_path$sessionPath );
    session_start();
    /* rest of your code here */
    2. your web host doesn't allow PHP sessions (or something that sessions require, like filesystem access).
    If this is the case, you need to find a better web host.
    Even free hosts are "useless" and "inexcusably lousy" if they support PHP, but disable these basic features.
    Try this:
    PHP Code:
    <?php
    print phpinfo();
    ?>
    you need to look for the section entitled "session" and check if "Session Support" says "enabled" or "disabled."
    If you need further help determining if your host allows PHP sessions, you'll need to contact them directly.
    Last edited by traq; 02-02-2012 at 05:06 PM.

  3. The Following User Says Thank You to traq For This Useful Post:

    TwitterRooms (02-02-2012)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •