473,769 Members | 6,107 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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("r eport_page");
session_start() ;

include '../vars.php';

// Get variables from forms:
if (!empty($HTTP_P OST_VARS)) while(list($nam e, $value) =
each($HTTP_POST _VARS)) $$name = $value;

show_page_heade r();

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

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

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

Jul 17 '05 #1
1 1694
*** Ray Torres wrote/escribió (Tue, 14 Sep 2004 19:41:16 -0700):
<?php
session_name("r eport_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
21710
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 such file or directory (2) in C:\Program Files\Apache Group\Apache2\htdocs\session.php on line 3
3
2466
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 me. does anyone know why i am having this problem and what i can do to rectify it?
2
3210
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 'click' in the form entry box). After you hit refresh it works fine. IE doesn't report any error (reporting is turned on). It also works fine if I remove the "session_start()". Is this an IE bug or am I doing something wrong? Is there a fix or...
5
2085
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 site without fixing this and getting the login system to work Here are the errors: At the TOP of the page I get the following three errors,
9
2646
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'; global $LOGINDIR;
19
7928
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 limiter - headers already sent in /home/httpd/vhosts/monkeyclaus.org/httpdocs/media/audio/pdsIncludes/CommandStartSession.php on line 14
3
1775
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(); include_once("connection.php"); if($_POST!="") ## Submit a login button
5
2277
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 to already declared variables. I then echo them and can see on the resulting form that they are set correctly. <? session_start();
2
4340
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 displayed next. Immediately at this point, it logs out the user. It is logging out the user because after checking $_SESSION == '1' - it finds that its not 1, and therefore displays login section again and a related message. The website is being...
0
9589
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9994
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8870
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7408
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3958
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.