[英]PHP not executing correcting when running PHP and HTML files on my local server (Mac Snow Leopard)
[英]In need of some PHP/server help on my mac (Snow leopard)
我是第一次學習php和mySQL(使用Welling / Thomson),並且使用mac作為服務器。 為此,我打開了Web共享,並通過http://192.168.0.103/~myname/
或localhost/~myname/
。 我能夠運行基本的PHP腳本。 我使用本指南進行了所有設置。 我將每個示例分為幾章:要進入第1章項目,請在瀏覽器中瀏覽localhost/~myname/book/Chapter02/example.html
。 這些文件實際上存儲在/Users/myname/Sites/book/Chapter02/example.html
我正在嘗試打開文件並出現以下錯誤:
Warning: fopen(/Library/WebServer/Documents/../orders/orders.txt): failed to open stream: No such file or directory in /Users/myname/Sites/book/Chapter02/processorder.php on line 72
我首先以為是因為目錄和fopen不同,所以我沒有將文件存儲在localhost/~myname/
,而是嘗試了localhost/public_html/
將它們存儲在我的/Library/WebServer/Documents/public_html/
。電腦。 我仍然收到錯誤:
Warning: fopen(/Library/WebServer/Documents/../orders/orders.txt): failed to open stream: No such file or directory in /Library/WebServer/Documents/public_html/Chapter02/processorder.php on line 72
然后我在網上查詢了一下,發現它與權限有關。 我在/Library/WebServer/Documents/public_html/Chapter02/
創建了一個名為“ orders”的目錄,該目錄具有通過終端從每個人(與chmod完成)的讀寫權限,但是仍然出現相同的錯誤。 我不確定問題出在哪里。 如果是我的服務器設置,文件在哪里? 任何幫助將不勝感激。
如果您認為這會幫助http://pastebin.com/14gpim8e,這是php腳本
我正在盡我所能,但我確信這需要澄清,因此隨時詢問您是否需要更多信息。
找到了答案。
問題來自2種方式:
在這種情況下,它需要所有人的讀/寫許可權,並且必須在/ WebServer /目錄中,並且不能更低(就像我在除WebServer以外的每個目錄中所做的那樣。現在看來有點愚蠢,我不能不明白)。 謝謝大家的幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.