Page 1 of 1
session_start() not working.
Posted: Sat Sep 20, 2003 3:58 pm
by voodoo9055
I assign my session from the previous page like this
Code: Select all
session_start();
$_SESSIONї'permission'] = 1;
On the very next page, I have
Code: Select all
session_start();
echo $_SESSIONї'permission'];
Nothing happens.

Posted: Sat Sep 20, 2003 4:38 pm
by volka
try
Code: Select all
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
session_start();
$_SESSION['permission'] = 1;
and
Code: Select all
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
session_start();
echo $_SESSION['permission'];
Posted: Sat Sep 20, 2003 5:17 pm
by jason
Out of curiosity, what version of PHP are you running? A page that outputs:
would be helpful.
Posted: Sat Sep 20, 2003 7:09 pm
by voodoo9055
After doing what you ask, I got
Code: Select all
Warning: session_start(): open(\sessiondata\sess_a4ba3326b7e453f7b3d7cb0525f94d84, O_RDWR) failed: No such file or directory (2) in C:\Apache Group\Apache2\htdocs\development\service\modules\validate.php on line 7
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at C:\Apache Group\Apache2\htdocs\development\service\modules\validate.php:7) in C:\Apache Group\Apache2\htdocs\development\service\modules\validate.php on line 7
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at C:\Apache Group\Apache2\htdocs\development\service\modules\validate.php:7) in C:\Apache Group\Apache2\htdocs\development\service\modules\validate.php on line 7
Warning: Cannot modify header information - headers already sent by (output started at C:\Apache Group\Apache2\htdocs\development\service\modules\validate.php:7) in C:\Apache Group\Apache2\htdocs\development\service\index.php on line 21
Warning: Unknown(): open(\sessiondata\sess_a4ba3326b7e453f7b3d7cb0525f94d84, 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 (\sessiondata) in Unknown on line 0
So I took a look at my sessiondata folder in the PHP folder and wola, sess_a4ba3326b7e453f7b3d7cb0525f94d84 is no were to be found. There are three other sessions in there.
Is there a way I can stop it from looking for this session?
BTW, i am using PHP 4.3.3.
Part of the phpinfo()
Code: Select all
allow_call_time_pass_reference On On
allow_url_fopen On On
always_populate_raw_post_data Off Off
arg_separator.input & &
arg_separator.output & &
asp_tags Off Off
auto_append_file no value no value
auto_prepend_file no value no value
browscap no value no value
default_charset no value no value
default_mimetype text/html text/html
define_syslog_variables Off Off
disable_classes no value no value
disable_functions no value no value
display_errors On On
display_startup_errors Off Off
doc_root no value no value
docref_ext no value no value
docref_root no value no value
enable_dl On On
error_append_string no value no value
error_log no value no value
error_prepend_string no value no value
error_reporting 2039 2039
expose_php On On
extension_dir ./ ./
file_uploads On On
gpc_order GPC GPC
highlight.bg #FFFFFF #FFFFFF
highlight.comment #FF8000 #FF8000
highlight.default #0000BB #0000BB
highlight.html #000000 #000000
highlight.keyword #007700 #007700
highlight.string #DD0000 #DD0000
html_errors On On
ignore_repeated_errors Off Off
ignore_repeated_source Off Off
ignore_user_abort Off Off
implicit_flush Off Off
include_path .;c:\php4\pear .;c:\php4\pear
log_errors Off Off
log_errors_max_len 1024 1024
magic_quotes_gpc On On
magic_quotes_runtime Off Off
magic_quotes_sybase Off Off
max_execution_time 30 30
max_input_time 60 60
open_basedir no value no value
output_buffering no value no value
output_handler no value no value
post_max_size 8M 8M
precision 12 12
register_argc_argv On On
register_globals Off Off
report_memleaks On On
safe_mode Off Off
safe_mode_exec_dir no value no value
safe_mode_gid Off Off
safe_mode_include_dir no value no value
sendmail_from me@localhost.com me@localhost.com
sendmail_path no value no value
serialize_precision 100 100
short_open_tag On On
SMTP localhost localhost
smtp_port 25 25
sql.safe_mode Off Off
track_errors Off Off
unserialize_callback_func no value no value
upload_max_filesize 2M 2M
upload_tmp_dir C:\PHP\uploadtemp C:\PHP\uploadtemp
user_dir no value no value
variables_order EGPCS EGPCS
xmlrpc_error_number 0 0
xmlrpc_errors Off Off
y2k_compliance On On
Apache Environment
Variable Value
HTTP_ACCEPT */*
HTTP_ACCEPT_LANGUAGE en-us
HTTP_ACCEPT_ENCODING gzip, deflate
HTTP_USER_AGENT Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
HTTP_HOST 127.0.0.1
HTTP_CONNECTION Keep-Alive
HTTP_COOKIE PHPSESSID=a4ba3326b7e453f7b3d7cb0525f94d84
PATH C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Common Files\Adaptec Shared\System
SystemRoot C:\WINDOWS
COMSPEC C:\WINDOWS\system32\cmd.exe
PATHEXT .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
WINDIR C:\WINDOWS
SERVER_SIGNATURE <address>Apache/2.0.47 (Win32) PHP/4.3.3RC1 Server at 127.0.0.1 Port 80</address>
SERVER_SOFTWARE Apache/2.0.47 (Win32) PHP/4.3.3RC1
SERVER_NAME 127.0.0.1
SERVER_ADDR 127.0.0.1
SERVER_PORT 80
REMOTE_ADDR 127.0.0.1
DOCUMENT_ROOT C:/Apache Group/Apache2/htdocs
SERVER_ADMIN localhost
SCRIPT_FILENAME C:/Apache Group/Apache2/htdocs/development/phpinfo.php
REMOTE_PORT 1347
GATEWAY_INTERFACE CGI/1.1
SERVER_PROTOCOL HTTP/1.1
REQUEST_METHOD GET
QUERY_STRING no value
REQUEST_URI /development/phpinfo.php
SCRIPT_NAME /development/phpinfo.php
HTTP Headers Information
HTTP Request Headers
HTTP Request GET /development/phpinfo.php HTTP/1.1
Accept */*
Accept-Language en-us
Accept-Encoding gzip, deflate
User-Agent Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Host 127.0.0.1
Cookie PHPSESSID=a4ba3326b7e453f7b3d7cb0525f94d84
HTTP Response Headers
X-Powered-By PHP/4.3.3RC1
Transfer-Encoding chunked
Content-Type text/html; charset=ISO-8859-1
Posted: Sat Sep 20, 2003 7:32 pm
by volka
it tries to create the file for the new session.
So I took a look at my sessiondata folder in the PHP folder
if you set
session.save_path =\sessiondata
in your php.ini it does not mean
<path to php>\sessiondata but
<current drive>:\sessiondata, in your case it probably tries to use c:\sessiondata. Does this directory exist? Usually it's better to provide an absolute path (including the drive at a win32 system), something like d:/chumbawamba/session.dir
Posted: Sun Sep 21, 2003 1:25 am
by voodoo9055
Ok, I change it to
session.save_path = C:\PHP\sessiondata
and it appears to be working now. Thanks a lot guys.