2010-07-15 20 views
2

open_basedir的限制,我有一些PHP代碼,將創建一組目錄中的新文件:PHP目錄的錯誤 - 事實上

$target_path = "reports/" . basename($Report_Filename) . ".php"; 
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { /* code here */ } 

這是工作完美,現在已經做了好幾年,不幸的是,我們剛剛移動到一個新的服務器,我現在得到這個錯誤:

[15-Jul-2010 16:15:48] PHP Warning: Unknown: open_basedir restriction in effect. File(C:\Windows\TEMP\) is not within the allowed path(s): (C:\inetpub\wwwroot) in Unknown on line 0 
[15-Jul-2010 16:15:48] PHP Warning: File upload error - unable to create a temporary file in Unknown on line 0 

任何建議,在此方式請繞過嗎?我已經檢查了文件夾的權限(包括我想上傳到的文件夾以及Windows TEMP文件夾),沒有任何快樂。我也嘗試了一些對php.ini文件的調整,特別是'open_basedir'這一行,但沒有任何運氣。

感謝

+0

您是否在更改php.ini後重新啓動了Web服務器? – MrWhite 2010-07-15 15:53:11

+1

你檢查了一個phpinfo()頁面來獲取php.exe實際使用的php.ini文件的位置嗎?很可能有多個php.ini文件,並且您正在編輯錯誤的文件。 – 2010-07-15 15:55:35

回答

3

I've also tried a couple of tweaks to the php.ini file and in particular the 'open_basedir' line, but no luck with that either

然後再試一次 - 你沒有錯的第一次。也許別的地方有另一個設置(例如在web服務器配置中)。

如果失敗,找出open_basedir是什麼,並確保您的php.ini中的upload_tmp_dir和代碼中的$ target_path都在裏面。

C.

+1

你先生,是明星! upload_tmp_dir = 「C:\ WINDOWS \ TEMP \」 & 的open_basedir = 「C:\ WINDOWS \ TEMP \」 工作一種享受,非常感謝。 – Nick 2010-07-15 15:59:48