Jump to content

session_start() problem


veeraa2003

Recommended Posts

Hello everybody........


I used session function to start it in my PHP page . I got some error , Please give some ideas to rectify it.

I provided both of sample of my code and error message. Please go through it .
[code]
<?php
ini_set('mbstring.internal_encoding', 'UTF-8');
ini_set('mbstring.http_output', 'UTF-8');
ini_set('mbstring.detect_order', 'UTF-8');
ini_set('mbstring.substitute_character', '12307');

// When did we start?
define('START_TIME', microtime(true));
   
$sys_path = str_replace('/system', '', dirname(__FILE__));

// Setup paths
define('DS', DIRECTORY_SEPARATOR);
define('ROOT', $sys_path);
define('APP', ROOT . DS . 'app');
define('APP_MODELS', APP . DS . 'models');
define('APP_CONTROLLERS', APP . DS . 'controllers');
define('APP_VIEWS', APP . DS . 'views');
define('SYS', ROOT . DS . 'system');
define('SYSDRIVERS', ROOT . DS . 'system' . DS . 'drivers');
define('LIB', ROOT . DS . 'lib');
define('CONFIG', ROOT . DS . 'config');

define('SESSION_USER', 'user');
echo ROOT;
session_save_path(ROOT . DS . 'tmp' . DS . 'sessions');
session_name(SESSION_USER);
session_start();
?>
[/code]


And the errors are here........

[color=red]
/opt/lampp/htdocs/askpert/public
Warning: session_start() [function.session-start]: open(/opt/lampp/htdocs/askpert/public/tmp/sessions/sess_b3654529b951ba4f34b61d78e9a19194, O_RDWR) failed: Permission denied (13) in /opt/lampp/htdocs/askpert/public/veeraa.php on line 28

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /opt/lampp/htdocs/askpert/public/veeraa.php:25) in /opt/lampp/htdocs/askpert/public/veeraa.php on line 28

Warning: Unknown: open(/opt/lampp/htdocs/askpert/public/tmp/sessions/sess_b3654529b951ba4f34b61d78e9a19194, O_RDWR) failed: Permission denied (13) 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 (/opt/lampp/htdocs/askpert/public/tmp/sessions) in Unknown on line 0
[/color]
Link to comment
https://forums.phpfreaks.com/topic/34970-session_start-problem/
Share on other sites

the first error is your problem. the others are a knock-on effect. Is it a server you have full access to? If so, you'll need to make sure the permissions on the sessions directory are set up correctly to allow the session files to be created.

is there any reason why you need to set up a custom session save path? if not, remove/comment out this line:

[code]
<?php
session_save_path(ROOT . DS . 'tmp' . DS . 'sessions');
?>
[/code]

and try again
Link to comment
https://forums.phpfreaks.com/topic/34970-session_start-problem/#findComment-164930
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.