关于session_start()的问题我看了很多资料还是不法解决。说的一大推就是关于什么字符编码。打开这个网页报错:
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /admin/includes/init_includes/init_file_db_names.php:20) in /html/boseonsale/includes/functions/sessions.php on line 108还有个报错说什么头部信息不能改Cannot modify header information - headers already sent by (output started at )高手说下具体的解决方案吧。本网站是开源的zencart网店

解决方案 »

  1.   

    ob_start();要写在所有执行代码的前面
      

  2.   

    这个错误就是因为header缓存开启之前有输出内容
      

  3.   

    ZEND CART不太懂帮你顶一下,,,
      

  4.   

    这个错误信息是说:
    在执行 sessions.php 第108行处的 session_start() 时,发现在 init_file_db_names.php 的第20行处有输出
    你应该检查 init_file_db_names.php 第20行及附近代码从 init_file_db_names.php 这个文件名看,可能是读写文件时出错
      

  5.   

    http://blog.csdn.net/cailiang517502214/archive/2009/11/27/4882038.aspx
      

  6.   

    init_file_db_names.php20行前面有代码if (!defined('IS_ADMIN_FLAG')) {
      die('Illegal Access');
    }应该关系不大吧
      

  7.   

    你如果是用ftp上傳的話...
    可能是
    你的session_start() 前面就有二進制文字.但是顯示不出來...
    就好比:<?
    session_start();
    ?>你看起來已經到最前面了..
    其實不是.
    決絕辦法 可以用EditPlus 3新建一個php頁面.然後除去session_start()這一段不要複製.自己手寫.
    在上傳...試試..
      

  8.   

    保证<?php ?> 标签内外都不要有字符输出;这样是不会出这种错误的.
      

  9.   

    帖出
    init_file_db_names.php 前30行代码有没有关系不由你决定
      

  10.   

    <?php
    session_start();
    /**
     * @package admin
     * @copyright Copyright 2003-2006 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: init_file_db_names.php 4240 2006-08-24 10:38:16Z drbyte $
     */
    if (!defined('IS_ADMIN_FLAG')) {
      die('Illegal Access');
    }
    /**
     * load the filename/database table names and he compatiblity functions
     *
     * @package admin
     * @copyright Copyright 2003-2005 zen-cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
    **/
    // set the type of request (secure or not)
      $request_type = (strtolower($_SERVER['HTTPS']) == 'on' || $_SERVER['HTTPS'] == '1' || strstr(strtoupper($_SERVER['HTTP_X_FORWARDED_BY']),'SSL') || strstr(strtoupper($_SERVER['HTTP_X_FORWARDED_HOST']),'SSL')  ? 'SSL' : 'NONSSL');// set php_self in the local scope
      if (!isset($PHP_SELF)) $PHP_SELF = $_SERVER['PHP_SELF'];// include the list of project filenames
      require(DIR_FS_CATALOG . DIR_WS_INCLUDES . 'filenames.php');// include the list of project database tables
      require(DIR_FS_CATALOG . DIR_WS_INCLUDES . 'database_tables.php');// include the list of compatibility issues
      require(DIR_FS_CATALOG . DIR_WS_FUNCTIONS . 'compatibility.php');// include the list of extra database tables and filenames
    $extra_datafiles_dir = DIR_WS_INCLUDES . 'extra_datafiles/';
    if ($dir = @dir($extra_datafiles_dir)) {
      while ($file = $dir->read()) {
        if (!is_dir($extra_datafiles_dir . $file)) {
          if (preg_match('/\.php$/', $file) > 0) {
            require($extra_datafiles_dir . $file);
          }
        }
      }
      $dir->close();
    }
    ?>
      

  11.   

    init_file_db_names.php  这个是正确的
    <?php
    /**
     * @package admin
     * @copyright Copyright 2003-2006 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: init_file_db_names.php 4240 2006-08-24 10:38:16Z drbyte $
     */
    if (!defined('IS_ADMIN_FLAG')) {
      die('Illegal Access');
    }
    /**
     * load the filename/database table names and he compatiblity functions
     *
     * @package admin
     * @copyright Copyright 2003-2005 zen-cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
    **/
    // set the type of request (secure or not)
      $request_type = (strtolower($_SERVER['HTTPS']) == 'on' || $_SERVER['HTTPS'] == '1' || strstr(strtoupper($_SERVER['HTTP_X_FORWARDED_BY']),'SSL') || strstr(strtoupper($_SERVER['HTTP_X_FORWARDED_HOST']),'SSL')  ? 'SSL' : 'NONSSL');// set php_self in the local scope
      if (!isset($PHP_SELF)) $PHP_SELF = $_SERVER['PHP_SELF'];// include the list of project filenames
      require(DIR_FS_CATALOG . DIR_WS_INCLUDES . 'filenames.php');// include the list of project database tables
      require(DIR_FS_CATALOG . DIR_WS_INCLUDES . 'database_tables.php');// include the list of compatibility issues
      require(DIR_FS_CATALOG . DIR_WS_FUNCTIONS . 'compatibility.php');// include the list of extra database tables and filenames
    $extra_datafiles_dir = DIR_WS_INCLUDES . 'extra_datafiles/';
    if ($dir = @dir($extra_datafiles_dir)) {
      while ($file = $dir->read()) {
        if (!is_dir($extra_datafiles_dir . $file)) {
          if (preg_match('/\.php$/', $file) > 0) {
            require($extra_datafiles_dir . $file);
          }
        }
      }
      $dir->close();
    }
    ?>
      

  12.   

    报的两处错都是指向init_file_db_names.php 20行的(另一处错误:Warning: Cannot modify header information - headers already sent by (output started at /html/boseonsale/admin/includes/init_includes/init_file_db_names.php:20) in /html/boseonsale/admin/includes/init_includes/init_templates.php on line 36
    也是指向init_file_db_names.php 20行的
    )。但这里是代码没动过,以前都是好好的能运行,换服务器就不行了。
      

  13.   

    不是副本,就是ftp里面的文件。
      

  14.   

    我以前遇到過你這樣的情況..也是ftp上傳到server就這樣了...
    也查詢了很多資料..說改 php.ini..啦...==
    但是我也是無意中自己試了我剛才說的那種方法..再上傳就ok了..
    記得選擇另存為...選擇對應項目的編碼.
      

  15.   

    问题找到了,我晕了,数据库里面的一个字段session值路径不正确。
      

  16.   

    Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /admin/includes/init_includes/init_file_db_names.php:20) in /html/boseonsale/includes/functions/sessions.php on line 108楼主你这个问题最后咋解决的啊,我遇到同样的问题了,麻烦说下
      

  17.   

    进入后台 Configuration->Sessions 看第一个Value值 是否正确