0
我的腳本在plesk最新版本上運行,並且plesk沒有寫入權限。我必須使用數據庫中的值編寫配置文件。php以root用戶身份寫入文件
我嘗試以下,
$pathconn = $_SERVER['DOCUMENT_ROOT']."/mysite/_conn.php";
if(file_exists($pathconn)){
chmod($pathconn, 0777);
}
$file_contents = file_get_contents($pathconn);
$file_contents = str_replace("webuser_admin", $username."_admin", $file_contents);
$file_contents = str_replace("webpass", $mysql_password, $file_contents);
$file_contents = str_replace("web_db", $username."_ss", $file_contents);
file_put_contents($pathconn, $file_contents);
的PHP變量從數據庫快到了,我需要更新_conn.php
文件,這些變量來運行網站。由於權限問題,我無法這樣做。
是否有任何其他方式做到這一點?我在某處讀到我們可以將其作爲apache
或root
用戶。但我不確定這是什麼意思。幫助請..
我想,這也許鏈接有用你的情況 http://unix.stackexchange.com/questions/35711/giving-php-permission-to-write-to-files-and-folders – Nassim
我不知道如何使用這些命令。 –
你與Plesk卡住了嗎?我沒有使用它,但我沒有問題寫入或使用Apache和cPanel創建新文件,或者我的WAMP設置... –