I kept having issues with a Document Management System I'm trying to install as, at the first step of the installation process, it would error with:

Warning: Unknown: open(/tmp/sess_d39cac7f80834b2ee069d0c867ac169c, O_RDWR) failed: Permission denied (13) in Unknown on line 0

Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0

I looked in /tmp and saw the sess_* files have the following permissions

---------- 1 vanced vanced 1240 Jan 20 08:48 sess_d39cac7f80834b2ee069d0c867ac169c

All the session files look like this. So obviously, they're unusable by PHP and it's causing me lots of problems.

How can I get PHP to set the correct permissions? I've tried changing the directory which php.ini uses to /tmp/phpsessions and the same thing occurs. The directories are a+rwx.

  • Why is the php session file being created under the user ID? You running under cgi-bin/phpsuexec or something similar? I suspect something is changing your default umask. – jeffatrackaid Feb 21 '10 at 3:31

The /tmp folder is a default placeholder for session files. Better use your own custom session folder

If Your host has allowed .htaccess overrides permission, you can place the following directive in your .htaccess under public_html or httpdocs folder

php_value session.save_path '/yourpath/sessionfolder'

If you are NOT running php in suphp mode, Make sure the folder is writable by others (777)


Is there a special umask setting for this account? It looks like somewhere, someone may have set it improperly. It should return something like:

% umask
  • How can I check this? The 'vanced' user has no shell as I didn't allow it when creating the hosting account on my VPS (WebHost Manager) – vanced Jan 20 '10 at 1:10
  • I enabled shell access, switched users and checked the umask. It's 0022. The problem, however, is still occurring. – vanced Jan 20 '10 at 1:21

To find the umask of a running process:



Try changing the umask in the actual application.

Find the index.php or bootstrap file, and add at the top:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy