473,396 Members | 2,085 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Problem with session_start

I get a warning and cannot start a session. I understand from reading
through the documentation and other posts that session_start must occur in
the php script before any HTML tags or output to the browser. In my
script, the session_name and session_start are the first two lines in
thescript; so I can't see what the problem could be.

I have used sessions on other pages in a similar fashion (in the same web
project, on the same server) and do not have any problems.

I would greatly appreciate if anyone has any ideas of what could be causing
the problem.

The warning as reported by the web server is as follows:
----------
Warning: Cannot send session cookie - headers already sent by (output
started at /home/parking2/secure_html/ControlPanel/adminCtrl.php:2) in
/home/parking2/secure_html/ControlPanel/adminCtrl.php on line 4

Warning: Cannot send session cache limiter - headers already sent (output
started at /home/parking2/secure_html/ControlPanel/adminCtrl.php:2) in
/home/parking2/secure_html/ControlPanel/adminCtrl.php on line 4
-----------

// The first lines of my php script source code are as follows:

<?php
session_name("report_page");
session_start();

include '../vars.php';

// Get variables from forms:
if (!empty($HTTP_POST_VARS)) while(list($name, $value) =
each($HTTP_POST_VARS)) $$name = $value;

show_page_header();

if ($logout)
{
$_SESSION['time'] = 0;
}

if(!($_SESSION['time'] > (time() - 3600) ))
{
do_login();
exit;
}

// end php code snippet ------------------------------------------

Jul 17 '05 #1
1 1679
*** Ray Torres wrote/escribió (Tue, 14 Sep 2004 19:41:16 -0700):
<?php
session_name("report_page");
session_start();


If session_start() is in line 4, then you have a blank line in the
beginning of the file. That counts as output.

--
-- Álvaro G. Vicario - Burgos, Spain
-- Thank you for not e-mailing me your questions
--
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: sky2070 | last post by:
session_start(); $_SESSION++; print 'You have visited here '.$_SESSION.' times.'; returned: Warning: session_start() : open(/tmp\sess_c8bf2007256f6e15a938c0254adb21e4, O_RDWR) failed: No...
3
by: Sticks | last post by:
i have been having difficulty with session variables - i seem to be able to set them, but when i wish to have another page update them, they remain as they were. this makes them utterly useless to...
2
by: Paul | last post by:
Dear experts, I have a problem with session_start() and JavaScript. In IE6 (but not Mozilla) the first time the page below loads the JavaScript doesn't work (clicking on the graphic should write...
5
by: cowofchaos | last post by:
when I use the session_start() function at the top of my scripts I get 5 errors on the page If anyone can help please do this has been a problem for a while and I cannot do much more work on my...
9
by: Bartosz Wegrzyn | last post by:
I need help with sessions. I createt set of web site for nav with authorization. first I go into main.php which looks like this: <?php //common functions include_once '../login/common.php';...
19
by: lawrence k | last post by:
How can I find out where my script is outputting to the screen for the first time? My error logs are full of stuff like this: PHP Warning: session_start(): Cannot send session cache...
3
by: anis2007 | last post by:
Hi, following code run our server but this is not run client server:- index code is: PUT YOUR CODE BETWEEN code OR php TAGS!! It is absolutely unreadeable! <?php ob_start(); session_start();...
5
by: Garry Jones | last post by:
This is a excerpt from the code where I collect data with a form. <FORM action="index15dq.php" method="post" name="stegscf_pwd_edit" id="stegscf_pwd_edit"> I am setting three session variables...
2
by: jwhite68 | last post by:
The essence of my problem is this. 1. I login to my website with user/password. 2. I select any option, which effectively re-calls index2.php with some additional parameters, to control whats...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.