2012-02-15 58 views
1

好的,所以,在我的頁面上,每當我嘗試啓動會話時,都會收到這些錯誤。PHP session_start()錯誤

Warning: session_start() [function.session-start]: open(/var/chroot/home/content/*/*/*/***/tmp/(SESSIONID - Edited out), O_RDWR) failed: No such file or directory (2) in /home/content/*/*/*/*****/html/*******/index.php on line 3 
{Page Name} 
{Short 3 Word Description} 

Warning: Unknown: open(/var/chroot/home/content/*/*/*/***/tmp/(SESSIONID - Edited out), O_RDWR) failed: No such file or directory (2) in Unknown on line 0 

Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct() in Unknown on line 0 

我正在使用PHP。這裏是我的代碼:

<? 
ob_start(); 
session_start(); 
require('****.php'); 
?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
<title>Title - edited</title> 
</head> 

<body> 
<div id="top"> 
<h1>title</h1> 
<h3>edited</h3> 
</div> 

</body> 

它不驚人的代碼,但它是我做了什麼。請幫助,並感謝先進。如果這有所作爲,我將與Godaddy共享主機。

+0

您能否給我們提供完整的完整的錯誤信息,而不是編輯出來?你可以離開你的域名,但知道路徑的其餘部分將會非常有用。它看起來像你的虛擬主機提供商正在使用['session.save_path']的高級形式(http://www.php.net/manual/en/session.configuration.php#ini.session.save-path)設置,但尚未創建保存會話所需的目錄結構。如果沒有完整的錯誤措辭,我們無法確定。 – Charles 2012-02-15 02:10:43

+0

@Charles我不同意我們不能確定沒有完整的措辭。 「請確認session.save_path的當前設置是否正確」似乎就是這麼說的。 – Shea 2012-02-15 02:30:23

回答

2

它看起來像會話文件不是可讀/寫...

請創建一個新的文件,用下面的代碼。它會告訴你什麼是錯的:

<pre /><?php 
$path = session_save_path(); 
if (is_dir($path)) { 
    echo "directory exists\r\n"; 
    echo (is_readable($path) ? "directory is readable\r\n" : "directory is not readable\r\n"); 
    echo (is_writable($path) ? "directory is writable\r\n" : "directory is not writable\r\n"); 
} 
else "directory does not exist\r\n"; 

您可以使用session_save_path();定義自己的會話保存路徑。我推薦類似session_save_path(getcwd().'/yourowndir');getcwd將爲您提供腳本的完整路徑,您知道該腳本是可讀寫的。如果一切都失敗了,你可能需要chmod你的「yourowndir」目錄到777

session_save_path應在session_start之前調用。

作爲一個方面說明,我相信這是值得與GoDaddy支持。他們是一個專業的託管服務,這顯然是他們的PHP設置的問題,所以他們應該負責解決它。雖然,我在此期間爲您提供了一項解決方案。

+0

非常感謝!這完美的作品! – jbman223 2012-02-15 11:40:51