2

我讓我的服務器上的一些有趣的結果,當我嘗試訪問任何目錄或文件通過一些Function.I設置了所有我的文件&目錄權限爲777和已經改變內容所有者到Apache,但我仍然得到錯誤messages.Code:
move_uploaded_file($_FILES['file']['tmp_name'], '/var/www/html/fileContent_Site/userData/'.$_SESSION['username'].DIRECTORY_SEPARATOR.$_FILES['file']['name']);
或者 file_put_contents('userData/userData.txt', $result,FILE_APPEND); mkdir("userData/".$register['username']);PHP:「未能打開流:權限被拒絕」

對於 'move_uploaded_file()以' 我得到:

move_uploaded_file(/var/www/php/Site/userData/radi/110729.png):未能打開流:權限在/var/www/php/Site/upload.php

move_uploaded_file否認( ):無法在/var/www/php/Site/upload.php

移動 '/ TMP/phpUFvMcn' 到 '/var/www/php/Site/userData/radi/110729.png'

而對於 'file_put_content()' 和 '的mkdir()'

file_put_contents(用戶數據/ userData.txt):未能打開流:允許在/var/www/php/Site/register.php否認

的mkdir():權限/var/www/php/Site/register.php

+0

我覺得這是一個所有者錯誤。 PHP所有者是守護進程,以便你能請檢查您的服務器配置 – Hkachhia

回答

0

開放的http.conf(在/opt/lampp/etc/httpd.conf)文件。

編輯這一部分:

<IfModule unixd_module> 
# 
# If you wish httpd to run as a different user or group, you must run 
# httpd as root initially and it will switch. 
# 
# User/Group: The name (or #number) of the user/group to run httpd as. 
# It is usually good practice to create a dedicated user and group for 
# running httpd, as with most system services. 
# 
User hostname 
Group hostname 
</IfModule> 

看,如果工程。

+0

當我改變其運行.httpd下我開始收到更多的錯誤,即使是在sudoers文件的用戶指定用戶。 – Radi

+0

什麼是你的項目的用戶和組名?它是WWW的數據? –

+0

沒有路徑工程是/ var/WWW/PHP /網站.The所有者所有文件和文件夾在PHP是我的用戶和組是Apache的,但即使我「喬敦 - R的阿帕奇:阿帕奇PHP」還是什麼也沒發生一樣錯誤 – Radi

0

使用

否認
$_SERVER["DOCUMENT_ROOT"]."/myFolder/path to upload folder". 

和檢查一次

相關問題