How to fix 'failed: Permission denied (13)' - php

Yesterday I was trying to install a panel on my VPS, Pterodactyl. But it ended up giving problems and I gave up. But, I got this error
PHP 7.3, Apache 2.0 and MySQL 5
Warning in ./libraries/session.inc.php#105
session_start(): open(/var/lib/php/session/sess_eok8aia21ebtl8i59i6p4u6sa5, O_RDWR) failed: Permission denied (13)
Backtrace
./libraries/session.inc.php#105: session_start()
./libraries/common.inc.php#350: require(./libraries/session.inc.php)
./index.php#12: require_once(./libraries/common.inc.php)
Warning in ./libraries/session.inc.php#105
session_start(): Failed to read session data: files (path: /var/lib/php/session)
Backtrace
./libraries/session.inc.php#105: session_start()
./libraries/common.inc.php#350: require(./libraries/session.inc.php)
./index.php#12: require_once(./libraries/common.inc.php)

Related

PHP Randomly Warning Permission denied (13) on session_start()

I have randomly this issue:
WARNING: FILE: [PATH_PROJECT]\class\session.class.php
MESSAGE: session_start(): open([PATH_SESSION]\sess_966tkue45v5mm6ftvqgqhnd21r, O_RDWR) failed: Permission denied (13)
I write without problem in [PATH_SESSION]
For example this issue It shows up 10 times in day and in the other cases working fine.
I use PHP 8.0 on Windows Server.
I think you will need to change your session.save_path php.ini directive
You can do that using session_save_path
for more information: https://www.php.net/manual/en/function.session-save-path.php

open(/var/lib/php/session/...sesionid, O_RDWR) failed: Permission denied (13)

I am running my website on using ec2 nginx.
I have done a update on the instance and now I getting this error when the site loads.
open(/var/lib/php/session/sessionid, O_RDWR) failed: Permission denied (13) in /var/www/html/includes/session.php on line 17
session_start(): Failed to read session data: files (path: /var/lib/php/session) in /var/www/html/includes/session.php on line 17
I am wondering how to fix this?
Appreciate any help
Thanks
You install PHP from zero in this machine? You already tried to put a complete permission in this folder?
Ex: sudo chmod 777 -R /var/lib/php/session

Why do I get a failed to read session_start()

I have just moved to a new webhost called Eurobia and just noticed that at times, I have been getting the following errors. Is this error due to the webhost?
Warning: session_start():
open(/var/cpanel/php/sessions/ea-php73/sess_45073c3b96060f25f10e5a1bd15e842b,
O_RDWR) failed: No such file or directory (2) in
/home/pianocou/domains/pianocourse101.com/public_html/header2.php on
line 2
Warning: session_start(): Failed to read session data: files (path:
/var/cpanel/php/sessions/ea-php73) in
/home/pianocou/domains/pianocourse101.com/public_html/header2.php on
line 2

Cakephp in Vagrant: Unable to create sessions, cache, cached models

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

php session_start: failed: Permission denied (13)

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.

Categories