PHP Scripts open_basedir Restriction in Effect Error PHP腳本和open_basedir的限制,實際上是錯誤
PHP open_basedir protection tweak is a Safe Mode security measure that prevents users from opening files or scripts located outside of their home directory with PHP, unless the folder has specifically excluded. PHP中的open_basedir保護調整,是一種安全模式,安全的措施,阻止用戶打開文件或腳本位於以外的其主目錄用PHP ,除非該文件夾已明確排除在外。 PHP open_basedir setting if enabled, will ensure that all file operations to be limited to files under certain directory, and thus prevent php scripts for a particular user from accessing files in unauthorized user’s account. PHP中的open_basedir設置如果啟用,將可確保所有的文件操作是有限的檔案在某些目錄中,從而防止PHP腳本為某特定用戶從存取檔案,在未經授權的用戶的帳戶中。 When a script tries to open a file with, for example, fopen() or gzopen(), the location of the file is checked.當一個腳本試圖打開一個文件,例如fopen ( )或者gzopen ( ) ,該文件的位置被選中。 When the file is outside the specified or permissible directory-tree, PHP will refuse to open it and the following errors may occur:當文件以外的指定或許可的目錄樹, PHP將拒絕打開它和下面的錯誤,可能會發生:
Warning: file_exists() [function.file-exists]: open_basedir restriction in effect.警告: file_exists ( ) [ function.file -存在] : open_basedir上的限制作用。 File(/home/user_name/public_html/wp-content/uploads/2006/12/picture.jpg) is not within the allowed path(s): (/home/user_name:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/user_name/public_html/wp-admin/inline-uploading.php on line 226文件( / home/user_name/public_html/wp-content/uploads/2006/12/picture.jpg )不屬於允許路徑( ) : ( /首頁/用戶名:在/ usr /庫/ PHP的:在/ usr / local / lib中/ PHP的: / tmp的)在/ home /用戶名/ public_html /可濕性粉劑-政府當局/內置- uploading.php上線226
The above error message appears on a Apache httpd web server error log (error_log) hosting Wordpress blog.上述錯誤訊息出現在阿帕奇的httpd的Web Server錯誤日誌( error_log )主辦的WordPress博客。 However, the problem may happen to all system or websites that use PHP as scripting language.不過,問題可能出現的所有系統或網站使用PHP作為腳本語言。
The solution or workaround to open_basedir restriction problem is that disable the PHP open_basedir protection altogether, or to exclude the protection for certain privileged user accounts, or to allow access to the additional directory for PHP scripts.該解決方案或替代方法,以和open_basedir的限制,問題是禁用的PHP和open_basedir的保護完全,或排除保護某些特權用戶帳戶,或讓獲得額外的目錄PHP腳本。
If you’re using cPanel WebHost Manager (WHM), you can easily disable PHP open_basedir protection or exclude certain users from the protection with WHM.如果您使用的cPanel網頁主機服務經理(的WHM ) ,您可以輕鬆地禁用的PHP和open_basedir保護或排除某些用戶從保護的WHM 。 Simply go to “Tweak Security” under the “Security” section, then select “Configure” link for “Php open_basedir Tweak”.簡單地去“調整安全”下“安全”一節,然後選擇“配置”鏈接“的PHP和open_basedir調整” 。 Inside it, you can enable or disable php open_basedir Protection, or exclude and include hosts from the protection.內,您可以啟用或禁用的PHP和open_basedir的保護,或排除和包括主機保護。
If you’re using Plesk hosting control panel, you may need to manually edit Apache configuration file of vhost.conf and vhost_ssl.conf, and add in or edit the following php_admin_value open_basedir lines to the following:如果您使用的plesk主機控制面板,您可能需要手動編輯Apache配置文件vhost.conf和vhost_ssl.conf ,並在添加或編輯以下php_admin_value open_basedir上線如下:
<Directory /full/path/to/the/directory/httpdocs> <directory /full/path/to/the/directory/httpdocs>
php_admin_value open_basedir none php_admin_value open_basedir上無
</Directory> < /目錄>
<Directory /full/path/to/the/directory/httpdocs> <directory /full/path/to/the/directory/httpdocs>
php_admin_value open_basedir /full/path/to/dir:/full/path/to/directory/httpdocs:/tmp php_admin_value open_basedir上/全/路徑/ /迪爾: /充分/路徑/ /目錄/ httpdocs : /川芎嗪
</Directory> < /目錄>
Note: For SSL hosts in the vhost_ssl.conf file, the Directory path will end with “httpsdocs” instead of “httpdocs”.注意:對於SSL主機,在vhost_ssl.conf文件,目錄路徑將結束與“ httpsdocs ” ,而不是“ httpdocs ” 。
The paths (above is example only and to be replaced with real path) that behind open_basedir are the directories that specifically allowed for the PHP scripts in the vhost domain account to access, so you can add in more directories that files are been stored and needed to be opened by PHP, each seperated by color “:”.路徑(以上是例子,只需要更換與實際路徑)的背後,和open_basedir是目錄,明確允許為PHP腳本,在vhost網域帳戶來訪問,使您可以添加更多的目錄,檔案被存放和需要以開放,由PHP ,每個分隔的顏色“ : ” 。 But be careful as it might expose your system to security fraud.但要小心,因為它可能暴露您的系統安全的欺詐行為。
Once done, run the command below to make the changes effective, and then restart Apache httpd web server (apache2ctl restart or httpd restart):一旦這樣做,運行該命令下面作出的變化,有效,然後重新啟動的Apache的httpd Web伺服器( apache2ctl重新啟動或重新啟動的httpd ) :
$PRODUCT_ROOT_D/admin/sbin/websrvmng -v -a元product_root_d /管理/ sbin / websrvmng - V型1
If you have to manually edit the Apache configuration file to disable PHP open_basedir protection, simply open up the httpd.conf file, and search for the lines that starts with the following characters:如果您有手動編輯Apache配置文件中禁用的PHP和open_basedir的保護,只要打開了httpd.conf文件,並搜索該行開始與以下字符:
php_admin_value open_basedir ….. php_admin_value open_basedir上… ..
Replace the whole line under the virtual host for the domain user account that you want to disable protection with the following line to disable it:取代整個線下,虛擬主機為域用戶帳戶您想要停用的保護與下列命令行以禁用它:
php_admin_value open_basedir none php_admin_value open_basedir上無
You can also opt to allow your PHP scripts to access additional directory instead without disabling the protection.您也可以選擇,讓您的PHP腳本,以獲得更多目錄,而不是無禁用的保障。 Additional directory can be added to the line, separated with color “:”.額外的目錄中可以添加到線,分離與顏色“ : ” 。 For example, to add /new_directory to the allow list:例如,要添加/ new_directory ,以允許名單:
php_admin_value open_basedir “/home/user_account/:/usr/lib/php:/usr/local/lib/php:/tmp” php_admin_value open_basedir上“ /首頁/ user_account / :是/ usr / lib中/ PHP的:是/ usr / local / lib目錄/ PHP的: / tmp的”
php_admin_value open_basedir “/home/user_account/:/usr/lib/php:/usr/local/lib/php:/tmp:/new_directory” php_admin_value open_basedir上“ /首頁/ user_account / :是/ usr / lib中/ PHP的:是/ usr / local / lib目錄/ PHP的: / tmp的: / new_directory ”
Restart the Apache after finished editing.重新啟動的Apache後,完成編輯。 Note that the directory allowed list restriction above is actually a prefix, not a directory name.請注意,目錄獲准名單的限制,上述實際上是一個前綴,而非一個目錄名。 This means that “open_basedir = /dir/incl” also allows access to “/dir/include” and “/dir/incls” if they exist.這也就是說“ open_basedir = /迪爾/ incl ”也會允許訪問“ / dir /包括”和“ / dir / incls ” ,如果它們存在的話。 When you want to restrict access to only the specified directory, end with a slash.當您要將訪問限制在僅為指定的目錄,在結尾加上一個斜線。 For example: “open_basedir = /dir/incl/”.例如: “ open_basedir = /迪爾/含/ ” 。
IMPORTANT : This is a machine translated page which is provided "as is" without warranty. 重要說明 :這是一個機器翻譯網頁是“按原樣”提供的擔保。 Machine translation may be difficult to understand.機器翻譯可能很難理解。 Please refer to請參閱 original English article英文原版的文章 whenever possible.只要有可能。
Share and contribute or get technical support and help at分享和貢獻,或取得技術的支持和幫助,在 My Digital Life Forums 我的數字生活論壇 . 。
Related Articles相關文章
- PHP Parse Error: syntax error, unexpected $end PHP的解析錯誤:語法錯誤,意想不到的元月底
- PHP Allowed Memory Size Exchausted Fatal Error PHP的允許內存大小exchausted致命錯誤
- PHP 5 Unable to Open HTTP Request Stream with fopen or fsockopen Functions PHP 5中無法打開HTTP請求流與fopen或fsockopen職能
- Install XCache PHP Accelerator in Linux by Compiling from Source安裝xcache的PHP加速器,在Linux的編制從源
- WordPress MySQL SQL Query Error in WPDB Class在WordPress MySQL的SQL查詢錯誤在wpdb級
- gmmktime Error in WordPress and MagpieRSS gmmktime誤差在WordPress和magpierss
- Email Bounces Back with “unrouteable mail domain” Error電子郵件反彈與“ unrouteable的郵件域”的錯誤
- Oracle Database Import Error 3113/3114 Oracle數據庫的進口錯誤三千一百一十四分之三千一百十三
- RapidLeech v2.2 Free Download rapidleech 2.2版本免費下載
- How to Customize, Modify or Change WordPress Database Connection Error Page如何自訂,修改或改變的WordPress數據庫連接錯誤頁



















December 3rd, 2007 16:21 2007年12月3日16時21分
[...] queréis más información sobre este tema, hay un artículo muy interesante sobre este error en My Digital Life. [ … … ] queréis更多資訊,關於埃斯特特馬,乾草聯合國artículo muy interesante關於埃斯特錯誤恩,我的數位生活。 Etiquetas: Desarrollo, hosting, open_basedir, [...] etiquetas :與發展,主機託管, open_basedir上, [ … … ]
December 21st, 2007 16:58 2007年12月21日16時58分
Great article.偉大的文章。
Thanks for the WHM tip.感謝為的WHM秘訣。
You saved my ass.你救了我驢。