Asked  7 Months ago    Answers:  5   Viewed   53 times

Possible Duplicate:
How can I fix the Permission error when I call session_start()?

I'm getting the following error:

PHP Warning:  session_start() [<a href='function.session-start'>function.session-start</a>]: open(/tmp/sess_49a20cbe1ef09a2d0262b3f7eb842e7b, O_RDWR) failed: Permission denied (13) in /home/------/public_html/includes/libs/ on line 1

The problem doesn't happen all the time, but comes and goes.

This the code at line on 1 in

<?php session_start(); ?>



You don't appear to have write permission to the /tmp directory on your server. This is a bit weird, but you can work around it. Before the call to session_start() put in a call to session_save_path() and give it the name of a directory writable by the server. Details are here.

Wednesday, March 31, 2021
answered 7 Months ago

If you even have blank lines before the <?php tag, then you can't set headers. Your start of file, with line numbers, should look like this:

1. <?php
2. session_start();
3. header('Cache-control: private');

The message says "headers sent at line 2", so you're outputting something (a space, a blank line, whatever) on line 4 of home.php

If this file is an include, you should put your session_start(); at the top of home.php instead, and then you don't need it in this file.

Wednesday, March 31, 2021
answered 7 Months ago
  • As a test (preferably in a development environment) give the IIS user full access to the parent folder. If this makes it work, slowly start taking away privileges to see which ones you need.

  • Try changing:




Windows ignores the mode option. Might be some weird bug causing it to fail.

Additionally for your $target variable could you try forcing it to link to the full Windows path? Such as C:Program Files IIS...

I've ran into situations with windows before where access was denied attempting to use a relative path, but the full path works just fine.

EDIT: Looking at the comments on the documentation for mkdir() one commenter mentions that you might also need to add execute permissions to the user:

If you're getting a Permission Denied error, but are certain the permissions and ownership where you are trying to create the directory are correct, check again:

The location where you are trying to create the directory in must have the Execute permission for the owner trying to create it, regardless of if the folder is Readable, or Writable.

This may be obvious to some, but was not to me at first. Hopefully this will save you the trouble I went through.

Wednesday, March 31, 2021
answered 7 Months ago

the php-memcached extension supports session locking

the memcache and memcached extensions look syntactically similar so it may not be too much of a headache to give it a try. (memcached has a stable version 2.1.0 released 2012-08-07).

if you are set on using memcache 2.2.7 you will most likely have to implement the lock yourself by setting some "session_is_locked" variable in your session and then releasing/unsetting it when the script is done writing to the session. Then you'd always need to check if that variable is set before continuing with any scripts which write to the session.

Wednesday, March 31, 2021
answered 7 Months ago

use session_save_path() on page starting

refer :

Thursday, August 19, 2021
Andras Zoltan
answered 2 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :