dongzhanyan3667 2012-08-02 13:42
浏览 80
已采纳

从Windows迁移到Linux服务器,现在出现会话错误

I recently migrated from a Windows to Linux server... now I am getting a bunch of session warnings and some of the content is being loaded properly. On the Windows server, everything worked smooth and I never had any errors, as soon as the migration to Linux took place, I started getting session warnings such as the one below on every page that uses sessions.

I have no idea what I should try or where to begin to address these problems and would appreciate any advice.

I suspect that if session_start() was actully was the problem, I would have gotten a similar warning on the Windows server.

Also my site is hosted by goaddy and I do not have access to the php.ini file...

        Warning: session_start() [function.session-start]: Cannot send session
 cookie - headers already sent by (output started 
    at /home/content/12/9453412/html/mainsearch.php:32) 
    in /home/content/12/9453412/html/mainsearch.php on line 36
  • 写回答

1条回答 默认 最新

  • drtj40036 2012-08-02 13:49
    关注

    Your problem is, that in

    /home/content/12/9453412/html/mainsearch.php line 32
    

    (and possibly also in the following ones) you do some kind of output (echo, print, blanks outside of <?php ... ?> etc.), before you do session_start(); on line 36. This is not allowed, as session_start() wants to send headers which is not possible after some kind of output already occured.

    Solution: Put your session_start(); to the top of your php file, or at least before you do any kind of output.

    And Michael pointed out correctly that this didn't work correctly on you Windows server either, you just didn't know because error reporting was set not to display warnings.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)