+ Reply to Thread
Page 1 of 3 123 LastLast
Results 1 to 10 of 22

Thread: php sessions not working?

  1. #1
    itman647's Avatar
    itman647 is offline x10Hosting Member itman647 is an unknown quantity at this point
    Join Date
    Jun 2008
    Location
    United Kingdom
    Posts
    45

    Exclamation php sessions not working?

    hey there x10hosting, im just curious as to why the error message keeps on coming up in my website every time i start a new session using php? is it the php configuation i have? can you upgrade me to the advanced php config if so?

    okay so this is what I have at the top of one of my pages

    <?php
    session_start();
    ?>

    when I save and view the page in the browser the following error messages are returned.

    Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/itman647/public_html/videodown/beta/indexed.php:1) in /home/itman647/public_html/videodown/beta/indexed.php on line 2

    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/itman647/public_html/videodown/beta/indexed.php:1) in /home/itman647/public_html/videodown/beta/indexed.php on line 2

    basically what I need the session php function for, is to send data from one page to another without having to use forms, etc... basically so that my members can surf my webpages with ease instead of having to submit lots of forms to transfer the members details from one page to another, using loads of forms could clog the server and its traffic. im quite advanced with php but just can't find the time to use forms as an alternative method because im currently doing my a-levels. so instead i just want to ease off lots of lines of coding to save time and processing power.

    thanks guys

  2. #2
    TechAsh's Avatar
    TechAsh is offline Retired TechAsh is an unknown quantity at this point
    Join Date
    Oct 2007
    Location
    UK
    Posts
    5,853

    Re: php sessions not working?

    This is a problem with you script not the x10 Servers. Basically your script is outputting information to the user's browser before you call the session_start() function.
    session_start() need to be right at the top of the script.

    *Moved to Programming Help*
    Useful Links:
    Terms of Service | Server News | Buy a Domain
    Free Domains: co.cc | Dot.tk -- Free File Storage: Dropbox -- Website Monitoring: Service Uptime


    My Websites:
    Earthtime Games & TechAsh's Blog

  3. #3
    itman647's Avatar
    itman647 is offline x10Hosting Member itman647 is an unknown quantity at this point
    Join Date
    Jun 2008
    Location
    United Kingdom
    Posts
    45

    Re: php sessions not working?

    the line

    <?php
    session_start();
    ?>

    is right at the top of my page before anything else including the document type declaration

    but it still outputs the same error message?

    I thought it might be because i dont have the advanced php configuation. and im not sure why x10 wont give me the full version because im quite experianced with php.

    so is it the php config or just my programming?

    this is the html

    <?php session_start(); ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html lang="en-gb">
    <head>
    <meta http-equiv="Content-Language" content="en-gb">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Control Panel<title>
    <style type="text/css">
    a {
    color: #4D4D4D;
    }
    a:visited {
    color: #A1C040;
    }
    a:active {
    color: #C6E666;
    }
    a:hover {
    color: #FFFFFF;
    }
    </style>
    </head>
    <body style="margin: 0; background-color: #333333">
    </body>
    </html>

    and this is the output

    Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/itman647/public_html/videodown/beta/indexed.php:1) in /home/itman647/public_html/videodown/beta/indexed.php on line 1

    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/itman647/public_html/videodown/beta/indexed.php:1) in /home/itman647/public_html/videodown/beta/indexed.php on line 1


    help!

  4. #4
    xmakina's Avatar
    xmakina is offline x10 Lieutenant xmakina is an unknown quantity at this point
    Join Date
    May 2008
    Location
    England
    Posts
    265

    Re: php sessions not working?

    Have you upgraded from basic? That could be the problem. It's certainly not x10's servers as I've never had a problem with Sessions before.
    IF($this->$post.content() == "SEE SIG"){
    w3Schools and Google
    }

  5. #5
    itman647's Avatar
    itman647 is offline x10Hosting Member itman647 is an unknown quantity at this point
    Join Date
    Jun 2008
    Location
    United Kingdom
    Posts
    45

    Re: php sessions not working?

    yeah about 3 months ago i think, but i havent used sessions until now so im not sure if it worked before the upgrade?
    Edit:
    thats weird it only shows 1 message now

    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/itman647/public_html/videodown/beta/indexed.php:1) in /home/itman647/public_html/videodown/beta/indexed.php on line 1
    Edit:
    thats weird it only shows 1 message now

    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/itman647/public_html/videodown/beta/indexed.php:1) in /home/itman647/public_html/videodown/beta/indexed.php on line 1
    Last edited by itman647; 10-29-2008 at 08:59 AM. Reason: Automerged Doublepost

  6. #6
    Jake's Avatar
    Jake is offline Developer Jake is an unknown quantity at this point
    Join Date
    Apr 2005
    Location
    Winona, MN
    Posts
    2,084

    Re: php sessions not working?

    Are you by any chance using a header("Location: index.php"); to get to your script here? because if so... the location changes but all headers are still initialized thus making it give an error... unless you have the header(); also above all the HTML in your document.
    Jake Omann | Developer
    █ 888-X10-9668 - jake[@]x10hosting.com
    x10Hosting - Giving Away Hosting Since 2004
    Premium Hosting | VPS Services

  7. #7
    itman647's Avatar
    itman647 is offline x10Hosting Member itman647 is an unknown quantity at this point
    Join Date
    Jun 2008
    Location
    United Kingdom
    Posts
    45

    Re: php sessions not working?

    nope i havent included any header function in my site

    im not sure because on firefox it says both error messages and on IE it shows just one, and to make sure that all the changes I've made in expression web have taken effect I press ctrl and f5 to full refresh the code. this is weird.
    Edit:
    do you think that resetting everything back to normal would solve this?
    like resetting all the htmlaccess files, logs, php files, etc. because i wouldn't mind that option lol as long as it works
    Last edited by itman647; 10-29-2008 at 09:20 AM. Reason: Automerged Doublepost

  8. #8
    TechAsh's Avatar
    TechAsh is offline Retired TechAsh is an unknown quantity at this point
    Join Date
    Oct 2007
    Location
    UK
    Posts
    5,853

    Re: php sessions not working?

    Your PHP version will not affect this, and resetting your account won't help. It is something in the script that is causing the problem.
    Is there a new line or a space at the top of the file?
    Useful Links:
    Terms of Service | Server News | Buy a Domain
    Free Domains: co.cc | Dot.tk -- Free File Storage: Dropbox -- Website Monitoring: Service Uptime


    My Websites:
    Earthtime Games & TechAsh's Blog

  9. #9
    Nahid_hossain is offline x10Hosting Member Nahid_hossain is an unknown quantity at this point
    Join Date
    Aug 2008
    Location
    Dhaka, Bangladesh
    Posts
    28

    Re: php sessions not working?

    you can add this line at the top of your script to hide error message
    PHP Code:
    <?php error_reporting(0); ?>
    remember this won't solve the issue, just hide the error message. To solve the issue you need to use session_start(); before any of your output. (i.e any header or html or any client side language). If you are not sure then put if at the top of your script just after the first <?php

  10. #10
    Jake's Avatar
    Jake is offline Developer Jake is an unknown quantity at this point
    Join Date
    Apr 2005
    Location
    Winona, MN
    Posts
    2,084

    Re: php sessions not working?

    Im assuming he wants the session to be initialized but if you were to stop all errors then you would be letting it run without a session =/ same as if you just deleted session_start();
    Jake Omann | Developer
    █ 888-X10-9668 - jake[@]x10hosting.com
    x10Hosting - Giving Away Hosting Since 2004
    Premium Hosting | VPS Services

+ Reply to Thread
Page 1 of 3 123 LastLast

Similar Threads

  1. php contact form in flash not working.
    By eddbrown in forum Free Hosting
    Replies: 2
    Last Post: 08-13-2008, 03:16 PM
  2. Some php functions not working properly
    By cheesycraps in forum Free Hosting
    Replies: 2
    Last Post: 08-13-2008, 10:18 AM
  3. Intermediate PHP Not working on Stoli?
    By tondopie in forum Free Hosting
    Replies: 1
    Last Post: 05-07-2008, 06:34 PM
  4. Sigo con problemas con phpbb2
    By reciecho in forum Soporte
    Replies: 7
    Last Post: 10-20-2007, 06:28 PM
  5. PHP not working, help needed.....
    By kaykim in forum Free Hosting
    Replies: 6
    Last Post: 10-10-2007, 11:21 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers