Page 1 of 1

session_start() error

Posted: Wed May 23, 2007 10:31 am
by victorsk
Hello,

I am trying to store object information in session in file1.php and then make file2.php get that session information. When I use session_start() call I get the following errors:

Code: Select all

Warning: session_start() [function.session-start]: open(/root/tmp/sess_f38d1b1f591c8126c53090d3ddea0f5a, O_RDWR) failed: Permission denied (13) in /var/www/html/test/doVacationsSearch_test.php on line 4

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /var/www/html/test/doVacationsSearch_test.php:4) in /var/www/html/test/doVacationsSearch_test.php on line 4

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /var/www/html/test/doVacationsSearch_test.php:4) in /var/www/html/test/doVacationsSearch_test.php on line 4
Could somebody please tell me what is going wrong here or how I can fix this?

Thank you,
Victor.

Posted: Wed May 23, 2007 10:34 am
by volka
php by default stores session data in files. The account running the php script does not have permissions to access these files.
The config parameter session.save_path sets the directory where these files are located, currently /root/tmp/
/root/tmp ?

Posted: Wed May 23, 2007 10:37 am
by victorsk
Hi,

Yes, I think I fixed by making everything executable (I think) in tmp with this command:

chmod -R +x /root/tmp

which I guess set everything to highest permissions possible. But I have other problems now on how to register an object in a session and have file2.php obtain that object.

Thanks,
Victor.

Posted: Wed May 23, 2007 10:51 am
by volka
chmod -R +x /root/tmp

which I guess set everything to highest permissions possible.
no, that would be +rwx to allow every- and anybody read/write/execute permissions.

Code: Select all

// file1
require 'class_foo.php';
session_start();

$_SESSION['obj'] = new foo;

Code: Select all

// file2
require 'class_foo.php';
session_start();

$_SESSION['obj']->bar();

Posted: Wed May 23, 2007 11:11 am
by victorsk
volka wrote:
chmod -R +x /root/tmp

which I guess set everything to highest permissions possible.
no, that would be +rwx to allow every- and anybody read/write/execute permissions.

Code: Select all

// file1
require 'class_foo.php';
session_start();

$_SESSION['obj'] = new foo;

Code: Select all

// file2
require 'class_foo.php';
session_start();

$_SESSION['obj']->bar();
Thank you so much for clarification. I have been doing this approach but every time I put require 'foo.php' (it's not a class just a PHP file that calls SOAP API methods) I get these methods being called when I launch file2.php but with parameters intended to be passed into file2.php, very strange. Does this mean that foo.php *must* be a class? I get the sense that if it is a class then foo.php's methods would be called only when invoked. But I'm new to PHP so I'd rather get some knowledgeable comments before I start converting foo.php into a standalone class.

Thank you,
Victor.

Posted: Wed May 23, 2007 4:46 pm
by volka
Sorry, I don't understand.

Posted: Wed May 23, 2007 5:05 pm
by victorsk
Hi,

This problem has been transformed into a different thread, I hope you could help me with this please.

viewtopic.php?t=68153

Thank you,
Victor.