Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
In earlier versions the same was working. Even the simple scripts as below are not working.
Code:
<?php
// page1.php
session_start();
echo 'Welcome to page #1';
$_SESSION['favcolor'] = 'green';
$_SESSION['animal'] = 'cat';
$_SESSION['time'] = time();
// Works if session cookie was accepted
echo '<br /><a href="page2.php">page 2</a>';
// Or maybe pass along the session id, if needed
echo '<br /><a href="page2.php?' . SID . '">page 2</a>';
?>
and
Code:
<?php
// page2.php
session_start();
echo 'Welcome to page #2<br />';
echo $_SESSION['favcolor']; // green
echo $_SESSION['animal']; // cat
echo date('Y m d H:i:s', $_SESSION['time']);
// You may want to use SID here, like we did in page1.php
echo '<br /><a href="page1.php">page 1</a>';
?>
what error messages are you getting in the apache logs? If you are getting segmentation faults then it could be to do with some of the PHP packages that you have installed.
I had the same problem, and I removed all the PHP packages that I was not using for my build and the session problem went away.
Hello friends,
In php.ini:
session.save_path = "/var/lib/php/session"
The permissions of this directory are : drwxrwx---
The httpd log is
log
Code:
PHP Warning: session_start() [<a href='function.session-start'>function.session-start</a>]:
open(/var/lib/php/session/sess_m4hrl8r4cqfv3vttctdg9bm6c1, O_RDWR)
failed: Permission denied (13) in /var/www/html/main_menu.php on line
2[client 127.0.0.1] PHP Notice: Undefined index: user_id in
/usr/include/php/include/genl_func.php on line 62
[client 127.0.0.1] PHP Notice: Undefined index: user_id in
/var/www/html/main_menu.php on line 5
[client 127.0.0.1] PHP Warning: Unknown:
open(/var/lib/php/session/sess_m4hrl8r4cqfv3vttctdg9bm6c1, O_RDWR)
failed: Permission denied (13) in Unknown on line 0
[client 127.0.0.1] PHP 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
I changed permissions to drwxrwx-wx
But still it does not work.
Prabhat Soni
Last edited by prabhatsoni; 03-13-2006 at 06:43 AM.
Hello,
Sorry for taking time to respond. In fact I was out of station for a few days. And In India "HOLI" the festival of colors is celebrated with much gusto and enthusiasm, and I was busy in it.
Ok, the problem.
After changing the permissions of the directory /var/lib/php/sessions to drwxrwx-wx, I shut down the PC and restarted it, and I find that the sessions are working ok.
Thanks a lot for this help.
The directory is owned by root. Would not it create any problem if instead of allowing "others" to "write" and "cd" into it, I simply chown it to apache.
What is the established norms or practice. Ibelieve both would serve the purpose insofar as the sessions are concerned. Will it have any implications for the security ?
Prabhat Soni
Last edited by prabhatsoni; 03-15-2006 at 10:54 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.