Page 1 of 1

Trouble when I run session_start()

Posted: Thu May 31, 2012 6:47 pm
by jtomai
Hi all and thanks for looking at my post>

when I upload and run this very short file ( my file contains nothing but the below php) on my linux shared hosting account:

<?php
session_start();
$_SESSION['username'] = 'admin';
?>

I get the following errors

Warning: session_start() [function.session-start]: open(/var/chroot/home/content/17/6372417/tmp/sess_n5f5h2u94h0dkfg24johvs15v7, O_RDWR) failed: No such file or directory (2) in /home/content/17/6372417/html/admin_login_process.php on line 3

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/content/17/6372417/html/admin_login_process.php:3) in /home/content/17/6372417/html/admin_login_process.php on line 3

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/17/6372417/html/admin_login_process.php:3) in /home/content/17/6372417/html/admin_login_process.php on line 3

Warning: Unknown: open(/var/chroot/home/content/17/6372417/tmp/sess_n5f5h2u94h0dkfg24johvs15v7, 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

Do I need to add a php.ini file to my root directory? Currently there is none. I have no access to any php.ini files under the structrure of shared hosting. Still there must be a way to get sessions to work.

Thanks for any help or advice in advance,

JT

Re: Trouble when I run session_start()

Posted: Thu May 31, 2012 7:33 pm
by TylerH4
It looks like your "session.save_path" directory is not set:
Please verify that the current setting of session.save_path is correct () in Unknown on line 0
Open up your php.ini file and specify a directory that your web-server process has read and write access to. Currently, on my Ubuntu server, it is set to "/var/lib/php5" running PHP Version 5.3.2-1ubuntu4.15.

Hope that helps!

Re: Trouble when I run session_start()

Posted: Thu May 31, 2012 8:41 pm
by jtomai
creating my own php5.ini file at the root with one line of code

session.save_path = tmp/

solved the problem.

Thanks!