問題描述
我正在嘗試將查詢寫入文件以進行調試.該文件位于 database/execute.php
中.我要寫入的文件是 database/queries.php
.
I am trying to write a query to a file for debugging. The file is in database/execute.php
. The file I want to write to is database/queries.php
.
我正在嘗試使用 file_put_contents('queries.txt', $query)
但是我得到了
file_put_contents(queries.txt) [function.file-put-contents]:無法打開流:權限拒絕
file_put_contents(queries.txt) [function.file-put-contents]: failed to open stream: Permission denied
我將 queries.txt
文件修改為 777,可能是什么問題?
I have the queries.txt
file chmod'd to 777, what could the issue be?
推薦答案
嘗試調整目錄權限.
從終端運行 chmod 777 database
(從包含數據庫文件夾的目錄)
from a terminal, run chmod 777 database
(from the directory that contains the database folder)
如果 chmodd 正確,apache 和任何人都無法訪問此目錄.
apache and nobody will have access to this directory if it is chmodd'ed correctly.
另一件事是回顯getcwd()".這將顯示當前目錄,如果這不是/something.../database/",那么您需要將query.txt"更改為服務器的完整路徑.
The other thing to do is echo "getcwd()". This will show you the current directory, and if this isn't '/something.../database/' then you'll need to change 'query.txt' to the full path for your server.
這篇關于file_put_contents - 無法打開流:權限被拒絕的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!