i was using phpmyadmin before, everything was good, but i changed php version in server from 7.2 to 8.2 then i got this error
i didn't find any solution
Error during session start; please check your PHP and/or webserver log file and configure your PHP installation properly. Also ensure that cookies are enabled in your browser.
session_start(): open(SESSION_FILE, O_RDWR) failed: No such file or directory (2)
session_start(): Failed to read session data: files (path: /var/cpanel/php/sessions/ea-php80)
i tried to create tmp directory but didn't work
the cause of the problem was two files
after deleting these files it worked probably without any issues..
these files was on server that has Cpanel i was using before, i moved to CloudWays i copied the whole project so it came with it.
the solution for my problem: i did created tmp file and set read and write permissions
as showing here
session_start(): open(SESSION_FILE, O_RDWR) failed: No such file or directory (2) session_start():
then deleted these two files.
.htaccesss
.user.ini
Related
I have the following PHP code:
include './globallyUsedFunctions/connectToDatabase.php';
include './globallyUsedFunctions/hashInput.php';
session_start();
For some reason, it causes this error:
<br />
<b>Warning</b>: session_start(): open(\xampp\tmp\sess_4p70knkr6lb7r9ha0pitktl3fe, O_RDWR) failed: No such file or directory (2) in <b>D:\foundationtests\src\assets\php\login.php</b> on line <b>2</b><br />
<br />
<b>Warning</b>: session_start(): Failed to read session data: files (path: \xampp\tmp) in <b>D:\foundationtests\src\assets\php\login.php</b> on line <b>2</b><br />
Now I think that the reason for this lies outside the code, so here is some info about my system:
I have the most recent version of a no-install XAMPP, I run apache and mariaDB in it.
This is running on a windows 10 machine, on a user account without admin privileges (thats why I chose the no-install version of XAMPP).
The website is also running inside the ZURB Foundation Framework (ZURB Template 6.4) which is based on webpack4, gulp and babel7.
EDIT:
Alternatives I already tried:
suggested by "code builders" (see answers)
session_start();
require_once $_SERVER['DOCUMENT_ROOT'].'/globallyUsedFunctions/connectToDatabase.php';
require_once $_SERVER['DOCUMENT_ROOT'].'/globallyUsedFunctions/hashInput.php';
Result =>
<br />
<b>Warning</b>: session_start(): open(\xampp\tmp\sess_14rr40ahtg7rbgb20fvqocet83, O_RDWR) failed: No such file or directory (2) in <b>D:\foundationtests\src\assets\php\login.php</b> on line <b>2</b><br />
<br />
<b>Warning</b>: session_start(): Failed to read session data: files (path: \xampp\tmp) in <b>D:\foundationtests\src\assets\php\login.php</b> on line <b>2</b><br />
<b>Warning</b>: session_start(): open(\xampp\tmp\sess_4p70knkr6lb7r9ha0pitktl3fe, O_RDWR) failed: No such file or directory (2) in <b>D:\foundationtests\src\assets\php\login.php</b> on line <b>2</b><br />
The path where session_start() attempts to write its data to does not have a drive letter. Since you are running your code from D:\foundationtests\src\assets\php\login.php, it's assumed to be at D: as well. You say the actual path should be at E:. Here you are the problem.
I'm not familiar with third-party bundles (some times they seem to cause more problems than they solve) but it'll surely has a php.ini file somewhere with an incomplete session.save_path directive. Find it and fix it.
Apart from that, a better long term solution is to enable a custom session directory for each application. The mechanism is roughly the same:
Create a directory in your codebase (somewhere in D:\foundationtests\src I guess) that's outside DOCUMENT_ROOT.
Configure session.save_path before you call session_start().
This has the added benefit of providing full control on session timeout.
session_start(); should always be the first line of code in your project.
Using relative paths will get you into trouble. Try using an absolute path with $_SERVER['DOCUMENT_ROOT'], then dictate where the file is.
require_once $_SERVER['DOCUMENT_ROOT']."/connectToDatabase.php";
Just create a folder "xampp/tmp" in your root directory where all your projects are. For example:
I have xampp installed (as default) on my C:/ and All Projects root directory I have is D:/ So I created a folder structure like this: D:/xampp/tmp
I had the same problem. I finally figured out it was caused by me copying the .htaccess file from cPanel. If you're using cPanel and have the same .htaccess file on your local XAMPP server, look for this line...
BEGIN cPanel-generated php ini directives, do not edit
The code below it sets up the php.ini values for the version of PHP installed on cPanel, and something in there is interfering with XAMPP. Remove that block of code (you don't need it with XAMPP) and that should fix your problem.
Hey guys i am using a Windows 2016 VPS Server and i installed IIS Web server on it along with php but i am getting this error with sessions.
Warning: session_start(): open(C:\Windows\temp\sess_qbageacapafd73fbj19idjbtd3, O_RDWR) failed: Permission denied (13) in C:\inetpub\wwwroot\system\global.php on line 6
I got the same error when i choose a different session path
Warning: session_start(): open(C:\Windows\PHPSessions\sess_qbageacapafd73fbj19idjbtd3, O_RDWR) failed: No such file or directory (2) in C:\inetpub\wwwroot\system\global.php on line 6
Is there a way to fix this?
You need to update the permissions of the temp folder so the user that IIS runs as has write permissions.
Another option is to change the session folder to a folder that is inside your document root. This is not recommended on public websites for security reasons since it can allow hackers to access your session information.
The best option is to give write permission to the IUSER or whatever user IIS runs under
Without any changes, we suddenly received the following error while wanting to access our mysql dbase via phpmyadmin:
Warning: Unknown: open(/var/lib/php/session/sess_8i4gv03ka359ktq4tp4h81oufs638cig, O_RDWR) failed: Read-only file system (30) 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 (/var/lib/php/session) in Unknown on line 0
Does anyone know why this happened & how I can solve ?
thx
bart
Your problem is that your sessions directory is not writable by the web server. This disables your ability to create sessions.
First check that the directory /var/lib/php/session/ exists. If so, check if it's on a writable medium. Because the message Read-only file system makes me a little unsure.
Then make the directory /var/lib/php/session/ and its current contents writable for the web server. Try chowning the directory to the user that runs your web server. Or (easier, but a bit less secure) chmod 777 /var/lib/php/session followed by chmod 666 /var/lib/php/session/*
I have a website hosted by FatCow.
I am trying to install the Securimage PHP CAPTCHA on my site by mimicking their quickstart guide, but it failed to work off the bat, so I ran their PHP Test Script on my site to determine the problem.
It threw this error:
The following error occurred when attempting to call session_start():
session_start() [function.session-start]: open(/temp/sess_5e72461407b4ac6283d9897cc49dc4e3, O_RDWR) failed: No such file or directory (2)
Now, I had an issue before surrounding sessions, so I made a temp folder through my FTP client on my domain's home ('/') folder, and set its file permissions to 777. Then I had proceeded to put a php.ini file also in my domain's home folder with the following declarations:
session.save_path = "/temp"
session.cookie_path = "/temp"
What is the issue? Why can't it create these sessions?
If the system doesn't contain a temp/tmp directory, this appears to be a hosting configuration issue, so you'd have to take that up with your provider.
Your solution to create your own temp directory may work, but your path wouldn't be correct. "/" is only the root as perceived by your FTP session because FTP sessions are typically chroot'd. Your home's root directory as perceived by the web server is going to be your home directory, which may be something like /home/my-domain. You can use the PHP getcwd() function to find out exactly what it is.
I'm trying to install berta (v 0.6.3b) and I get this error:
Warning: session_start() [function.session-start]:
open(/var/php_sessions/sess_a0d6b8422181739d10066fb60cebfe5d, O_RDWR)
failed: No such file or directory (2) in
/hermes/bosweb/web010/b100/ipg.ellieniemeyercom/engine/_classes/class.bertasecurity.php
on line 75 The error seems to happen on line 75 of class.bertasecurity.php (view source code)
What is wrong and how can I fix it?
Make sure that session directory is writable or you can set a path yourself with:
session_save_path
This comment is also useful if you are using above function.
I think the folder containing the session data cannot be accessed by the PHP process.
If you have not touched your php.ini, the default session.save_handler should be files (which means that session data will be stored in a folder on your file system). The value of session.save_path contains that folder, you should check that it exists and its permissions for your php process.
If you're changing the path that is being used for sessions.
You also might consider, fixing this problem by changing session.save_path variable in your php.ini file.
Then you'll be fixing in your configuration file and not only in your script.
Sessions are saved on the harddisk of your server. Most likely your session save path does not exist. Try setting it to a directory that does exist or that you have read/write rights to.
We encountered this problem when migrating a website from a cPanel server to a different host.
The session.save_path was configured in php.ini and .user.ini inside our public_html/ folder, and was presumably overwriting a default path the host would have wanted to use.
We decided the files were not needed at all, just a hangover from the old server, and deleted/renamed them out of the way, and this fixed the problem.