Warning: Session_Start() Failed: No Such File or Directory

Warning: session_start() failed: No such file or directory

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.

PHP session_start error (no such file or directory found)

It's a configuration error.

Check the line below on your php.ini file:

session.save_path = "/tmp"

Or in your PHP script:

session_save_path('/home/example.com/sessions');

That line tells to PHP where session files will be saved.

The system user that are running the server need to have write privileges on this folder.

session_start() causes error: No such file or directory (fresh, portable XAMPP)

<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:

  1. Create a directory in your codebase (somewhere in D:\foundationtests\src I guess) that's outside DOCUMENT_ROOT.

  2. Configure session.save_path before you call session_start().

This has the added benefit of providing full control on session timeout.

when I send value from a page to another page using session, the following error appears

Your session directory /var/cpanel/php/sessions/ea-php56/ on sever may be not exist or you do not have permissons to access to it.

Create directory if not exist with proper permissions or change session directory in php.ini file. If you dont have access to server contact your service provider.

You can set below line before accesing or creating sesssion to change session directory for your script.

ini_set('session.save_path', '/path/to/your/folder')

https://www.php.net/manual/en/function.session-save-path.php



Related Topics



Leave a reply



Submit