Premission denied to start session - PHP [duplicate] - php

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

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

PHP Warning: chdir(): No such file or directory (errno 2) [duplicate]

This question already has an answer here:
php include error not findind the path
(1 answer)
Closed 7 years ago.
I have php file on web site c:\inetpub\www\domain.com\httpdocs\test.php with two lines below:
line 13 chdir('/app/files/');
line 14 include ('insert.php');
Willing to include the file at c:\inetpub\www\domain.com\httpdocs\app\files\insert.php but having on log files as below:
PHP Warning: chdir(): No such file or directory (errno 2) in C:\Inetpub\www\domain.com\httpdocs\test.php on line 13 php_error
PHP Warning: include(s_insert.php): failed to open stream: No such file or directory in C:\Inetpub\www\domain.com\httpdocs\test.php on line 14
I assume line 14 error due line 13 result. What missing in line 13 ?
I set the open_basedir to none, should I leave as none ?
As commented by #VolkerK, the problem was solved with chdir('/app/files/'). That would change the working directory to c:\app\files.

phpMyAdmin - Error Mysql error during session start

I had a problem with MySQL, this problem appears after I clean chrome browsing data.
The error looks like this.
This error appears every time I access PHPMyAdmin, and also I can't access my databases.
What I already did so far are :
https://github.com/rtCamp/easyengine/issues/302 - not work
Access PHPMyAdmin from other browsers -same result
Prepare for the worst, how to back up my databases?, because I can't access my databases from terminal.
UPDATE :
I have been following this link and create php_error.php file this is the result
Warning: session_start(): open(/opt/lampp/temp//sess_eobqtotm38tean46jjthbih1m3, O_RDWR) failed:
Permission denied (13) in /opt/lampp/htdocs/portofolio1/php_error.php
on line 6
If a session could be started successfully you should not see any
Warning(s), otherwise check the path/folder mentioned in the
warning(s) for proper access rights. The current "session.save_path"
is "/opt/lampp/temp/". Session file name:
"sess_eobqtotm38tean46jjthbih1m3".
Warning: Unknown:
open(/opt/lampp/temp//sess_eobqtotm38tean46jjthbih1m3, 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
(/opt/lampp/temp/) in Unknown on line 0
Now what I should do next?
SOLVED!
Follow this web
By typing this on terminal
sudo chmod -R 705 /opt/lampp/temp/sess_su8nntc1mvi9t3t6b3vu67kuquc9p012
and
sudo chown -R $user /opt/lampp/temp/sess_su8nntc1mvi9t3t6b3vu67kuquc9p012
change $user with your username
sess_su8nntc1mvi9t3t6b3vu67kuquc9p012 is my session file, it should be different on your system
Thanks, axiac^^
Try like this
sudo chown root:root /opt/lampp/temp/sess_243ca2147169ded5d73ae8290b2f68fe

Warning: session_start(): failed: Permission denied (13)

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

PHP open_basedir error

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\

Categories