I am getting the error:
Warning: Unknown: open(/tmp/sess_beaac196b5082a77131f957bcfa35ee7, 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 have checked the /tmp directory and it is writable (using this code):
$filename = '/tmp';
if (is_writable($filename)) {
echo 'The file is writable';
} else {
echo 'The file is not writable';
}
The php.ini file says session.save_path is /tmp
Is there something obvious I'm missing?
EDIT: I have tried setting a new session path but even after CHMOD 777 it gives me a tells me:
Warning: session_start(): open(/sessions/sess_beaac196b5082a77131f957bcfa35ee7, O_RDWR) failed: No such file or directory (2)
use session_save_path() on page starting
refer : http://php.net/manual/en/function.session-save-path.php
I eventually managed to get it working by putting the full path of my new folder in..
session_save_path('/home/scittwebhost/sessions');
I still do not know why I couldn't write to /tmp - the permissions were 777
Thanks all
Related
I've been trying to run a Cakephp app inside vagrant box which is equipped with Apache2, mysql, neo4j, everything needed for the app to run. The site is opening and when I try to login in the local it's giving me this bunch of errors.
Here's the debug log :
2015-06-29 19:04:38 Warning: Warning (512): /vagrant/app/tmp/cache/ is not writable in [/vagrant/cake/libs/cache/file.php, line 267]
2015-06-29 19:04:38 Warning: Warning (512): /vagrant/app/tmp/cache/persistent/ is not writable in [/vagrant/cake/libs/cache/file.php, line 267]
2015-06-29 19:04:38 Warning: Warning (512): /vagrant/app/tmp/cache/models/ is not writable in [/vagrant/cake/libs/cache/file.php, line 267]
2015-06-29 19:04:38 Warning: Warning (2): session_start(): open(/vagrant/app/tmp/sessions/sess_ojvjndme1tqt1bn4dnra8erq96, O_RDWR) failed: Permission denied (13) in [/vagrant/cake/libs/cake_session.php, line 587]
2015-06-29 19:04:38 Warning: Warning (2): Unknown: open(/vagrant/app/tmp/sessions/sess_ojvjndme1tqt1bn4dnra8erq96, O_RDWR) failed: Permission denied (13) in [Unknown, line 0]
2015-06-29 19:04:38 Warning: Warning (2): Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/vagrant/app/tmp/sessions) in [Unknown, line 0]
2015-06-29 19:04:49 Warning: Warning (2): session_start(): open(/vagrant/app/tmp/sessions/sess_p2utf2okm73g71cv2ed361a8c7, O_RDWR) failed: Permission denied (13) in [/vagrant/cake/libs/cake_session.php, line 587]
2015-06-29 19:04:49 Warning: Warning (2): session_write_close(): open(/vagrant/app/tmp/sessions/sess_p2utf2okm73g71cv2ed361a8c7, O_RDWR) failed: Permission denied (13) in [/vagrant/cake/libs/controller/controller.php, line 694]
I opened all permissions (by doing "sudo chmod -R 777 ." in ./tmp folder) to all folders in /tmp and still the error persists. Not sure why the app is unable to create a new session file inside the tmp directories.
Edits & New developments : So, I realize that as the code is being shared with the host and vagrant guest os, the tmp folder in the code is actually mounted which may be, is the reason for the permission-not-granted error.
Now the problem is now reduced to how do I create a 'tmp' folder outside of /vagrant/ folder and write all the logs, cache, sessions etc in that external folder inside the virtual os filesystem?
I've tried using the suggestions in : http://singletonio.blogspot.in/2009/01/changing-tmp-directory-of-cakephp-so-it.html
But, the new logs, sessions are not being written on ~/tmp(which is where I've set my cache, sessions, logs folders)?
Can you please help me out here?
What I did was changing Apache user in my development server from "www-data" to "vagrant".
Edit /etc/apache2/envvars:
export APACHE_RUN_USER=vagrant
export APACHE_RUN_GROUP=vagrant
Been trying to install php today and I ran into this problem when trying to launch my website:
PHP Warning: session_start(): open_basedir restriction in effect. File(C:\Windows\TEMP) is not within the allowed path(s): (C:\Users\Administrator\Desktop\website) in C:\Users\Administrator\Desktop\website\bootstrap.php on line 21
I have set my php.ini to the following settings:
open_basedir = "C:\Users\Administrator\Desktop\website\"
and
upload_tmp_dir = "C:\Windows\TEMP\"
I tried changing the directory for upload_temp_dir to C:\Users\Administrator\Desktop\website\temp but the error keeps telling me that C:\Windows\TEMP is not valid - even though I changed the dir.
Any ideas?
Thanks.
EDIT:
Now I am getting:
PHP Warning: session_start(): open(C:\Windows\TEMP\\sess_ca0ea257d89dfecd355e375071e30d7e, O_RDWR) failed: Permission denied (13) in C:\Users\Administrator\Desktop\website\bootstrap.php on line 21
PHP Warning: Unknown: open(C:\Windows\TEMP\sess_ca0ea257d89dfecd355e375071e30d7e, O_RDWR) failed: Permission denied (13) in Unknown on line 0
PHP Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (C:\Windows\TEMP) in Unknown on line 0
open_basedir limits the files that can be opened by PHP within a directory-tree.
You should config session.save-path to some path inside
C:\Users\Administrator\Desktop\website\
Or add the session directory to the list of folders that PHP script can access
session.save-path = "C:\Windows\TEMP\"
open_basedir = "C:\Users\Administrator\Desktop\website\;C:\Windows\TEMP\"
NOTE: I had to remove the quotes from the open_basedir path on Windows 10, PHP 7.3 (in the php.ini file)
Does not work: open_basedir = "C:\Windows\TEMP\;C:\Some\Other\Path\"
Works open_basedir = C:\Windows\TEMP\;C:\Some\Other\Path\
I have a problem with session, i have change repertory with php like this
session_save_path('/w/w/session');
session_start();
The message error:
Warning: session_start() [function.session-start]: open(/w/w/session/sess_bace6057bf24184f0c1c26c002bf9141, O_RDWR) failed: Permission denied (13) in /w/w/config.php on line 3
I have add chmod 777 in filezila but not work
I have tested with .htaccess i have error 500
I dont have access to php.ini in my host.
How can i fix this ?
The path in session_save_path('/w/w/session'); is not the one you need.
Try one of those:
session_save_path('./session');
session_save_path('/session');
session_save_path('/tmp');
On a shared host, you are not as flexible as on a rootserver, and your /www is chrooted, that means, the real path, which you cannot access then is something like /var/www/user3183123/www.
This question already has answers here:
How can I fix the Permission error when I call session_start()?
(16 answers)
Closed 9 years ago.
I have the following error:
Warning: session_start():
open(---temp\sess_u800qhordqngjf1c9mlspmb1c6, O_RDWR) failed:
Permission denied (13) in ---login.php on line 2
Warning: Unknown: open(---temp\sess_u800qhordqngjf1c9mlspmb1c6, 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
(---\temp) in Unknown on line 0
instead the path displayed I wrote ---.
This error wasn't displayed until now (I'm on localhost).
I tried to find the solution on the web, but I can't figure what exactly should I do...
How can I fix it?
Thanks!
In your php.ini file it is specifying the session.save_path to be ---\temp.
That means one of the following is your problem:
1) That path does not exist
2) That path is not writable
As a solution, you have three options:
1) Make the path exist
2) Make the path writable
3) Change it to another path
I'm getting this error in the log....
What can I do to fix this?
2012-06-22T10:53:13+10:00 ERR (3): Zend_Session::start() - /home/commstrat2_web/webrepos/zend/library/Zend/Session.php(Line:469): Error #2 session_start() [<a href='function.session-start'>function.session-start</a>]: open(/var/lib/php/session/sess_ta9eajdp2oirutoitjuk3vss10, O_RDWR) failed: Permission denied (13) Array
/home/commstrat2_web/webrepos/zend/library/Zend/Session.php(Line:479): Error #2 session_write_close() [<a href='function.session-write-close'>function.session-write-close</a>]: open(/var/lib/php/session/sess_ta9eajdp2oirutoitjuk3vss10, O_RDWR) failed: Permission denied (13) Array
/home/commstrat2_web/webrepos/zend/library/Zend/Session.php(Line:479): Error #2 session_write_close() [<a href='function.session-write-close'>function.session-write-close</a>]: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php/session) Array - Thrown by: /home/commstrat2_web/webrepos/zend/library/Zend/Session.php on line 482
make your resources.session.save_path writable.
You can do :
chmod 775 /path/to/data/session
In Zend Framework Bootstrap yourProject/application/configs/application.ini:
resources.session.save_path = APPLICATION_PATH "/../data/session"
If you are using selinux, add selinux rule:
semanage fcontext -a -t httpd_sys_rw_content_t '/path/to/session'
restorecon -v '/path/to/session'