Sessions with php and Zend, Failed to write session data - php

First of all I have to ask sorry for my english, that's not so good but I hope you'll understand.
I started studying Zend framework, I have a problem with sessions, but I think that's not related with zend...
anyway i have an error message when I use:
$risultato=$auth->authenticate($adapter);
On my login page I have this message:
Message: Zend_Session::start() - C:\ZendFramework-1.12.0\library\Zend\Session.php(Line:477): Error #2 session_start(): open(C:\xampp\htdocs\ZendDue\application/../data/session\sess_4beo9fvfqenb6s2b67q5cj5ap6, O_RDWR) failed: No such file or directory (2) C:\ZendFramework-1.12.0\library\Zend\Session.php(Line:487): Error #2 session_write_close(): open(C:\xampp\htdocs\ZendDue\application/../data/session\sess_4beo9fvfqenb6s2b67q5cj5ap6, O_RDWR) failed: No such file or directory (2) C:\ZendFramework-1.12.0\library\Zend\Session.php(Line:487): Error #2 session_write_close(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (C:\xampp\htdocs\ZendDue\application/../data/session)
I'm using xampp and in php.ini file I have
session.save_path = "C:\xampp\tmp"
I don't know what to do, I'm getting depressed because of this, right now I thought I had understood...

Related

Session error after uploading wordpress site on live

Following errors come after uploading site to live:
Warning: session_start() [function.session-start]:
open(D:\TEMP\PHP\sess_h7pba1el9krq2dpt2klsm0v6c1, O_RDWR) failed: No
such file or directory (2)
Warning: Unknown: open(D:\TEMP\PHP\sess_h7pba1el9krq2dpt2klsm0v6c1,
O_RDWR) failed: No such file or directory (2) 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 (D:\TEMP\PHP)
in Unknown on line 0
On the local system the site is working fine. The above errors come only after it is uploaded.
how do I get them resolved?
PHP can't save it's session files. In spite of you're using wp the problem isn't related with it, it's a server problem.
Depending on the type of server you should:
Ask hosts support to fix it OR
Edit the session.save_path var in your php.ini
Hope it helps!

Set localhost sessions folder to 0070 using OS X & MAMP

newb here, new to working with localhost in OS X.
I am running a MAMP stack on OS X. My session test file returns a series of warnings which I believe is due to the inability to write to the sessions folder which I have not been able to set to 0700.
I've checked for:
white space
file path http://localhost/sessions/
folder name (sessions)
I believe the problem is a permission issue. I am looking to be able to write to my localhost directory session folder. To do this I need to set the permission of the folder to 0700. I am hoping to find an solution that I can replicate with my limited level of expertise at this time.
This is the code:
<?php
ini_set('session.save_path','/htdocs/sessions');
session_start();
$_SESSION['test'] = "If you can read this, sessions are working!";
print $_SESSION['test'] . "<br>";
print "Session ID is: ". session_id()."<br>";
?>
These are the errors which only appear when i run local:
Warning: session_start(): open(/htdocs/sessions/sess_d1c5ef5a18bb844bfc667a0fc911191f, O_RDWR) failed: No such file or directory (2) in /Applications/MAMP/htdocs/review/itc240f/a_070-adminer/sessionTest.php on line 3
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /Applications/MAMP/htdocs/review/itc240f/a_070-adminer/sessionTest.php:3) in /Applications/MAMP/htdocs/review/itc240f/a_070-adminer/sessionTest.php on line 3
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /Applications/MAMP/htdocs/review/itc240f/a_070-adminer/sessionTest.php:3) in /Applications/MAMP/htdocs/review/itc240f/a_070-adminer/sessionTest.php on line 3
If you can read this, sessions are working!
Session ID is: d1c5ef5a18bb844bfc667a0fc911191f
Warning: Unknown: open(/htdocs/sessions/sess_d1c5ef5a18bb844bfc667a0fc911191f, O_RDWR) failed: No such file or directory (2) 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 (/htdocs/sessions) in Unknown on line 0
/htdocs/sessions
does it exist? And, why would you choose to use a root directory in MacOSX? Perhaps you should map it to your user folder.
/Users/username/htdocs/session

Zend project hosting session issues

I'm hosting a Zend project in the server. After solving some .htaccess problems now I'm facing session issues.
this is the error i see :
exception 'Zend_Session_Exception' with message 'Zend_Session::start() - /home/*/public_html///library/Zend/Session.php(Line:477): Error #2 session_start() [function.session-start]: open(/tmp/sci/sess_0c949aecb59cfcaa46f46dd45ab9313a, O_RDWR) failed: No such file or directory (2) /home/*/public_html///library/Zend/Session.php(Line:487): Error #2 session_write_close()
/tmp/sci/ is an existing folder but i can't see any session file inside it. It seems to me, that Zend is trying to look for a session file form a session id which is not already created.
Help much appreciated.

Is it normal for hosting company to disable sessions on server?

I have just moved over to a linux server on my shared hosting to see if it is less rubbish than a windows server on godaddy (I have been stupid enough to have paid them 12 months up front so I am stuck with those idiots now). I am now no longer able to use any kind of sessions at all.
They have got back to me saying that it is up to me to resolve the issue to get it to work... yes that is right... TO GET SESSIONS TO WORK! Excuse me if I seem a little irate but I am furious.
Can someone please inform me how I can in some way get sessions to work on an Apache server? I have never had to set this up before because it has never been a problem. As soon as I do:
<?php session_start() ?>
... it is just coming up with about 8 lines of errors saying that:
Warning: session_start() [function.session-start]: open(/var/chroot/home/content/30/10247530/tmp/sess_sgruthqkbhfms6ekcle2l0n6i5, O_RDWR) failed: No such file or directory (2) in /home/content/30/10247530/html/sessionthing.php on line 2
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/content/30/10247530/html/sessionthing.php:2) in /home/content/30/10247530/html/sessionthing.php on line 2
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/30/10247530/html/sessionthing.php:2) in /home/content/30/10247530/html/sessionthing.php on line 2
Warning: Unknown: open(/var/chroot/home/content/30/10247530/tmp/sess_sgruthqkbhfms6ekcle2l0n6i5, O_RDWR) failed: No such file or directory (2) 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 () in Unknown on line 0
I have tried creating a php.ini file and I still cannot get it to work properly. I have checked the settings using phpinfo() and I genuinely do not know where to go from here.
EDIT: There are a few things appearing down the side of the page now pointing to similar problems. For some reason I did not come up with those when I did a search. One of them is even closed: https://stackoverflow.com/questions/11374110/session-start-errors-on-godaddy-server?rq=1
That one says that they got it resolved with Godaddy so I think I will have to go back to them and tell them to sort it out. It is not that I do not want to learn how to configure the server... it is just that sessions should just work.
Make sure that there are no other <?php session_start() ?> declared, and try set your own session temp path,
<?php
if (!is_dir(session_save_path())) {
session_save_path ('your/custom/existing/directory');
}
session_start();
?>
PHP is trying to save the session in /var/chroot/home/content/30/10247530/tmp/, and it can't open that directory (either because it doesn't exist or because it doesn't have write permissions to it). Investigate PHP's access to this path and I believe that you'll get your sessions working - maybe you overlooked a config variable when you migrated your code to the new server?

PHP: Session_start() directory does not exist error

I have looked around on the issue - but it seems that all I can find about it is people who are having the problem connecting to a local database or something (not really sure). I am having the problem on my website (any time I make an ajax call to a file that has a session_start())
Anyways, this is the error message I am getting:
Warning: session_start() [function.session-start]: open(/usr/local/apache/bin/httpd/sess_5840483107c1db9753c32214723b64a6, O_RDWR) failed: Not a directory (20) in /data/in/r/reiconsultants/www/employee/user_page_login.php on line 3
Warning: Unknown(): open(/usr/local/apache/bin/httpd/sess_5840483107c1db9753c32214723b64a6, O_RDWR) failed: Not a directory (20) 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 (/usr/local/apache/bin/httpd) in Unknown on line 0
I haven't touched the code in a while - and I can be quite sure that no one else has either, so I am not sure why the error is occurring. I read a bunch about people going in and setting the php.ini file, but I have never had to do that before - and can't even find the file.
Like I said - the error is occurring on my company website, not when trying to connect to a local database.
The error just popped up today - I got flooded with emails about it, and it is on more than one web page being hosted on the server - all the pages I have that include a session_start() at the top have the issue.
Could it be a server side issue that I can't fix? or what...
sorry if I am not descriptive enough - I have absolutely no idea what is going on, and therefore don't know what to say. Just ask me for any clarification you need.
Thanks!
Paul
The error is indicating that /usr/local/apache/bin/httpd/ is set as your folder to save session data in. Does that folder exist and is writable by the user Apache is running as? Does the Linux server have any other security measures like SELinux running that might be stopping writing to that directory?
Did you verify that the current setting of session.save_path is correct? Is /usr/local/apache/bin/httpd correct folder for saving session data?
Try set session.save_path = "/tmp" in you php.ini to ensure that problem is in folder.
you can also change the session path at run time:
string session_save_path([string $path])

Categories