[RESOLVED] Warning: session_start() [function.session-start]: Cannot send session cache limiter
Results 1 to 7 of 7

Thread: [RESOLVED] Warning: session_start() [function.session-start]: Cannot send session cache limiter

  1. #1
    Junior Member
    Join Date
    Aug 2011
    Posts
    20

    resolved [RESOLVED] Warning: session_start() [function.session-start]: Cannot send session cache limiter

    im a newbee and I have the following error: if some one can help please

    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/eliebal1/public_html/jewelsbargain/includes/database_tables.php:339) in /home/eliebal1/public_html/jewelsbargain/includes/functions/sessions.php on line 5

    any help please
    thanx

  2. #2
    Pna lbh ernq guvf¿
    Join Date
    Jul 2004
    Location
    Kansas City area
    Posts
    19,432
    Welcome to PHPBuilder! Note that I've moved your post into its own thread; please start a new thread for discussion of your own issues rather than hijacking someone else's. (For reference, the old thread is here.)

    As for your issue, the error message is quite clear: You're attempting to start a session (which will usually attempt to modify the HTTP headers to send a cookie) after you've already sent output. Move the call to session_start() before you output anything.

  3. #3
    Junior Member
    Join Date
    Aug 2011
    Posts
    20
    i have tried that but no luck here is the html
    PHP Code:
    <?php
    /*
      $Id: sessions.php,v 1.1.1.1 2004/03/04 23:40:51 ccwjr Exp $

      osCommerce, Open Source E-Commerce Solutions
      [url]http://www.oscommerce.com[/url]

      Copyright (c) 2003 osCommerce

      Released under the GNU General Public License
    */

      
    if (STORE_SESSIONS == 'mysql') {
        if (!
    $SESS_LIFE get_cfg_var('session.gc_maxlifetime')) {
          
    $SESS_LIFE 1440;
        }

        function 
    _sess_open($save_path$session_name) {
          return 
    true;
        }

        function 
    _sess_close() {
          return 
    true;
        }

        function 
    _sess_read($key) {
          
    $value_query tep_db_query("select value from " TABLE_SESSIONS " where sesskey = '" tep_db_input($key) . "' and expiry > '" time() . "'");
          
    $value tep_db_fetch_array($value_query);

          if (isset(
    $value['value'])) {
            return 
    $value['value'];
          }

          return 
    false;
        }

        function 
    _sess_write($key$val) {
          global 
    $SESS_LIFE;

          
    $expiry time() + $SESS_LIFE;
          
    $value $val;

          
    $check_query tep_db_query("select count(*) as total from " TABLE_SESSIONS " where sesskey = '" tep_db_input($key) . "'");
          
    $check tep_db_fetch_array($check_query);

          if (
    $check['total'] > 0) {
            return 
    tep_db_query("update " TABLE_SESSIONS " set expiry = '" tep_db_input($expiry) . "', value = '" tep_db_input($value) . "' where sesskey = '" tep_db_input($key) . "'");
          } else {
            return 
    tep_db_query("insert into " TABLE_SESSIONS " values ('" tep_db_input($key) . "', '" tep_db_input($expiry) . "', '" tep_db_input($value) . "')");
          }
        }

        function 
    _sess_destroy($key) {
          return 
    tep_db_query("delete from " TABLE_SESSIONS " where sesskey = '" tep_db_input($key) . "'");
        }

        function 
    _sess_gc($maxlifetime) {
          
    tep_db_query("delete from " TABLE_SESSIONS " where expiry < '" time() . "'");

          return 
    true;
        }

        
    session_set_save_handler('_sess_open''_sess_close''_sess_read''_sess_write''_sess_destroy''_sess_gc');
      }

      function 
    tep_session_start() {
      
        
    $session_id '';
        
        if (isset(
    $_GET[tep_session_name()])) {
          if (
    preg_match('/^[a-zA-Z0-9]+$/'$_GET[tep_session_name()]) == false) {
            unset(
    $_GET[tep_session_name()]);
          } else {
            
    $session_id $_GET[tep_session_name()];
          }
          
        } elseif (isset(
    $_POST[tep_session_name()])) {
          if (
    preg_match('/^[a-zA-Z0-9]+$/'$_POST[tep_session_name()]) == false) {
            unset(
    $_POST[tep_session_name()]);
          } else {
            
    $session_id $_POST[tep_session_name()];
          }
          
        } elseif (isset(
    $_COOKIE[tep_session_name()])) {
          if (
    preg_match('/^[a-zA-Z0-9]+$/'$_COOKIE[tep_session_name()]) == false) {
            
    $session_data session_get_cookie_params();
            
    setcookie(tep_session_name(), ''time()-42000$session_data['path'], $session_data['domain']);
          } else {
            
    $session_id $_COOKIE[tep_session_name()];
          }
        }
        
        if (
    tep_not_null($session_id)) {
          
    tep_session_id($session_id);
        }
        
        return 
    session_start();
      }

      function 
    tep_session_register($variable) {
        global 
    $session_started;

        if (
    $session_started == true) {
          return 
    session_register($variable);
        } else {
          return 
    false;
        }
      }

      function 
    tep_session_is_registered($variable) {
        return 
    session_is_registered($variable);
      }

      function 
    tep_session_unregister($variable) {
        return 
    session_unregister($variable);
      }

      function 
    tep_session_id($sessid '') {
        if (!empty(
    $sessid)) {
          return 
    session_id($sessid);
        } else {
          return 
    session_id();
        }
      }

      function 
    tep_session_name($name '') {
        if (!empty(
    $name)) {
          return 
    session_name($name);
        } else {
          return 
    session_name();
        }
      }

      function 
    tep_session_close() {
        return 
    session_write_close();
      }

      function 
    tep_session_destroy() {
        return 
    session_destroy();
      }

      function 
    tep_session_save_path($path '') {
        if (!empty(
    $path)) {
          return 
    session_save_path($path);
        } else {
          return 
    session_save_path();
        }
      }

      function 
    tep_session_recreate() {
        
    $session_backup $_SESSION;

        unset(
    $_COOKIE[tep_session_name()]);

        
    tep_session_destroy();

        if (
    STORE_SESSIONS == 'mysql') {
          
    session_set_save_handler('_sess_open''_sess_close''_sess_read''_sess_write''_sess_destroy''_sess_gc');
        }

        
    tep_session_start();

        
    $_SESSION $session_backup;
        unset(
    $session_backup);
      }

    ?>
    Last edited by bradgrafelman; 08-02-2011 at 09:29 PM. Reason: PHP bbcode tags added

  4. #4
    Pna lbh ernq guvf¿
    Join Date
    Jul 2004
    Location
    Kansas City area
    Posts
    19,432
    When posting PHP code, please use the board's [php]..[/php] bbcode tags as they make your code much easier to read and analyze.

    What is the error message now?

  5. #5
    Junior Member
    Join Date
    Aug 2011
    Posts
    20
    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/eliebal1/public_html/jewelsbargain/includes/database_tables.php:339) in /home/eliebal1/public_html/jewelsbargain/includes/functions/sessions.php on line 5

  6. #6
    Pna lbh ernq guvf¿
    Join Date
    Jul 2004
    Location
    Kansas City area
    Posts
    19,432
    There is no call to session_start() on line 5 of the code you posted above, so you either didn't post sessions.php or you didn't post the correct error message.

  7. #7
    Junior Member
    Join Date
    Aug 2011
    Posts
    20
    again same problem this is been taking so long but here is the link for the page with the error
    http://www.elieballeh.com/jewelsbargain/
    i have tried adding this <?php
    session_start(); // start up your PHP session!
    ?> to the top of the header.php but no luck again
    btw am a newbee
    please help

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •