部署PHP代碼到阿里虛擬雲主機,出現錯誤,而在本地一切正常,服務器上卻是一版空白。
這個問題困擾了三天,終於解決。
在頁面跳轉時發現以下錯誤信息:
Warning: Cannot modify header information - headers already sent by (output started at
/data/home/qxu2309260022/htdocs/config/config.php:1) in
/data/home/qxu2309260022/htdocs/celive/include/celive.class.php on line 66
Warning: Cannot modify header information - headers already sent by (output started at
/data/home/qxu2309260022/htdocs/config/config.php:1) in
/data/home/qxu2309260022/htdocs/celive/include/celive.class.phpon line 68
---------------------------------------------------------------------------------------------
是因爲程序需要輸出緩衝區數據塊output_buffering參數開啓,虛擬主機默認該參數設置爲關閉狀態導致。
解決方法:登錄http://cp.hichina.com控制面板,點擊左側網站高級環境設置--php.ini設置,將【輸出緩衝區數據塊設置】設置爲【啓用】,重啓服務後生效,設置生效後再測試訪問即可恢復正常。