Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.