Asked  2 Years ago    Answers:  5   Viewed   416 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, August 31, 2022
  • 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.

Monday, November 21, 2022

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.

Friday, September 23, 2022

session_destroy() destroys the active session. If you do not initialized the session, there will be nothing to be destroyed.

Thursday, September 29, 2022

use session_save_path() on page starting

refer :

Thursday, November 24, 2022
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :

Browse Other Code Languages