2011-02-10 4 views
2

내 젠드 프로젝트와 젠드 세션 오류 다음에 봉착 : 나는 이유를 알 수없는젠드 세션 치명적인 오류

include('include.php'); 
include "Zend/Loader.php"; 

Zend_Loader::registerAutoload(); 
Zend_Session::start(); 

: 나는 부트 스트랩 파일에이 코드를 작성했다

Fatal error: Uncaught exception 'Zend_Session_Exception' with message 'Zend_Session::start() - /home/besthomes/public_html/Zend/Session.php(Line:426): Error #2 session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cache limiter - headers already sent (output started at /home/besthomes/public_html/Zend/Exception.php:1) Array' in /home/besthomes/public_html/Zend/Session.php:432 Stack trace: #0 /home/besthomes/public_html/index.php(47): Zend_Session::start() #1 {main} thrown in /home/besthomes/public_html/Zend/Session.php on line 432 

이 오류가 발생했습니다. 이 문제를 해결하는 데 도움을주십시오. 감사합니다. .

답변

2

파일에 추가 문자가 없는지 확인하십시오. - 예를 들어
이 코드는 오류 트리거되지 않습니다

<?php 
session_start(); 

을하지만 하나는 :

(blank line here!) 
<?php 
session_start(); 

같은 일이 포함 된 파일에 적용됩니다. 그러나 파일을 포함 할 때 태그를 clossing 한 후에는 추가 행이 없다는 것을 알아야합니다 (사용하는 경우).

<?php 
    //content of included file 
?> 

을하지만, 그런 일을하지 않습니다 :이 작동합니다 어떤 사람들은 not using closing tag in php scripts 좋은 연습을 고려하는 이유

<?php 
    //content of included file 
?>  
(blank line here!) 
(!and here) 

가 그래서입니다.

는 또한 ob_startob_end_flush를 사용하여이 문제를 해결할 수 있지만, 같은 나는 말했다 - 그것은 해결하지 솔루션입니다.

2

코드에서 PHP가 HTTP 헤더를 보내는 출력이 있습니다. HTTP 헤더는 이미 전송되었으므로 세션을 시작하려고 할 때 다시 보낼 수 없습니다. 세션을 사용하려면 먼저 세션을 시작하거나 먼저하는 것이 좋습니다.

반면에 내 앱에서 별도의 오류를 출력하여 HTTP 헤더를 보내는 경우이 오류가 발생했습니다.

추가 정보 문서에서 참조하시기 바랍니다 : http://framework.zend.com/manual/en/zend.session.html

즉 "세션 시작"이라는 섹션 http://framework.zend.com/manual/en/zend.session.advanced_usage.html

팁 : 제거/세션을 시작 줄을 주석 , 그리고 무엇이 출력되는지보십시오. 코드와 관련이없는 다른 오류가있을 수 있습니다.

+0

thanx하지만이 코드는 내 코드를 제거했지만이 코드가 부트 스트랩 파일에서 완벽하게 작동하는 이유를 모르겠지만 어떤 종류의 악의적 인 코드가 내 부트 스트랩 파일에 추가되었을 때 발생합니다 . – Shaily

+0

이것이 캐시와 관련이 있다고 생각 했습니까? – Shaily

+0

PHP 태그를 열기 전에 공백이 있습니까? – opHASnoNAME