2011-12-10 123 views
0

我收到以下錯誤的原因:PHP:無法弄清楚的fopen錯誤

Warning: fopen() [function.fopen]: Unable to access Archive-Report-Sat-Dec-2011 12-12-42.xls/var/www/vhosts/eample.com/httpdocs/_files/Archive-Report-Sat-Dec-2011 12-12-42.xls in /var/www/vhosts/shares-predict.com/httpdocs/include/functions.php on line 194

Warning: fopen(Archive-Report-Sat-Dec-2011 12-12-42.xls/var/www/vhosts/example.com/httpdocs/_files/Archive-Report-Sat-Dec-2011 12-12-42.xls) [function.fopen]: failed to open stream: No such file or directory in /var/www/vhosts/example.com/httpdocs/include/functions.php on line 194

事情是我的本地桌面和其他遠程服務器上工作正常,但在這裏我得到的錯誤。可能是什麼問題

+0

可能的文件權限或無效的路徑。 – Corbin

+0

只看錯誤是不夠的,你需要發佈代碼示例。但是我發現在你的文件名中有一個空格,如果你在Windows上開發語言並且你的服務器是Linux,或者反過來,這可能是問題。 –

+1

文件名中的空格很醜,但在兩個系統上都允許。 – ThiefMaster

回答

5

看看路徑..你顯然在路徑前加上文件名,這顯然不是你想要的。

除非你確實有,當然你的工作目錄內的路徑Archive-Report-Sat-Dec-2011 12-12-42.xls/var/www/vhosts/eample.com/httpdocs/_files/;)

+0

+1擊敗了我。 –

+0

哈哈!傻我。萬分感謝。 – Volatil3

0

這是相當明顯的是,你試圖打開該文件不存在。我建議迴應你想要打開的文件路徑字符串的realpath(),以確保它包含你認爲它的作用。

0

也許你的意思是:

fopen("/var/www/vhosts/example.com/httpdocs/_files/Archive-Report-Sat-Dec-2011/12-12-42.xls"); 

相反的:

fopen(Archive-Report-Sat-Dec-2011 12-12-42.xls/var/www/vhosts/example.com/httpdocs/_files/Archive-Report-Sat-Dec-2011 12-12-42.xls);