PHP Scripts open_basedir Restriction in Effect Error PHP Script open_basedir Restriction quả trong Lỗi
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 bảo vệ tweak Chế độ an toàn là một biện pháp an ninh rằng ngăn cản người sử dụng từ các tập tin hoặc mở tập lệnh nằm ở bên ngoài nhà của họ với các thư mục PHP, trừ khi các thư mục đã bị loại trừ. 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 cài đặt, nếu được kích hoạt, sẽ đảm bảo rằng tất cả các tập tin hoạt động sẽ được giới hạn đối với một số tập tin theo thư mục, và do đó ngăn ngừa php script cho một người dùng truy cập các tập tin trong tài khoản của người sử dụng trái phép. When a script tries to open a file with, for example, fopen() or gzopen(), the location of the file is checked. Khi một tập lệnh cố gắng mở một tập tin với, ví dụ, fopen () hay gzopen (), vị trí của tập tin sẽ được kiểm tra. When the file is outside the specified or permissible directory-tree, PHP will refuse to open it and the following errors may occur: Khi các tập tin bên ngoài được chỉ định hoặc thư mục-permissible cây, PHP sẽ từ chối để mở nó và sau đây có thể có lỗi:
Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. Cảnh báo: file_exists () [function.file-exists]: open_basedir hạn chế có hiệu lực. 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 Tập tin (/ home/user_name/public_html/wp-content/uploads/2006/12/picture.jpg) không phải là trong phạm vi cho phép con đường (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
The above error message appears on a Apache httpd web server error log (error_log) hosting Wordpress blog. Trên thông báo lỗi sẽ xuất hiện trên một máy chủ web Apache httpd lỗi đăng nhập (error_log) lưu trữ Wordpress blog. However, the problem may happen to all system or websites that use PHP as scripting language. Tuy nhiên, vấn đề xảy ra tháng năm cho tất cả các hệ thống hoặc các trang web sử dụng ngôn ngữ PHP là scripting.
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. Các giải pháp hoặc workaround để open_basedir hạn chế vấn đề này là vô hiệu hoá PHP open_basedir altogether bảo vệ, hoặc để loại trừ việc bảo vệ đối với một số đặc quyền tài khoản người dùng, hoặc để cho phép truy cập vào các thư mục cho các PHP script.
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. Nếu bạn đang sử dụng cPanel WebHost Manager (WHM), bạn có thể dễ dàng vô hiệu hóa PHP open_basedir bảo vệ hoặc loại trừ một số người sử dụng từ việc bảo vệ với WHM. Simply go to “Tweak Security” under the “Security” section, then select “Configure” link for “Php open_basedir Tweak”. Đơn giản chỉ cần đến "Tweak Bảo mật" dưới sự "bảo vệ" phần, sau đó chọn "Cấu hình" liên kết cho "Php open_basedir Tweak". Inside it, you can enable or disable php open_basedir Protection, or exclude and include hosts from the protection. Bên trong nó, bạn có thể kích hoạt hoặc vô hiệu php open_basedir bảo vệ, hoặc loại bỏ và bao gồm từ việc bảo vệ máy.
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: Nếu bạn đang sử dụng Plesk lưu trữ bảng điều khiển, bạn có thể cần phải tự sửa đổi tập tin cấu hình của Apache vhost.conf và vhost_ssl.conf, và thêm vào hoặc chỉnh sửa sau php_admin_value open_basedir dòng để những điều sau đây:
<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 không có gì
</Directory> </ 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 / full / path / to / dir: / đầy đủ / path / to / thư mục / httpdocs: / tmp
</Directory> </ Directory>
Note: For SSL hosts in the vhost_ssl.conf file, the Directory path will end with “httpsdocs” instead of “httpdocs”. Lưu ý: Đối với SSL máy vhost_ssl.conf trong các tập tin, thư mục con đường sẽ kết thúc với "httpsdocs" thay vì "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 “:”. Các đường dẫn (chỉ có ở trên là ví dụ và sẽ được thay thế bằng con đường thực tế) mà đằng sau open_basedir là các thư mục, mà cụ thể được cho phép đối với PHP script trong vhost tên miền để truy cập vào tài khoản, do đó, bạn có thể thêm vào nhiều thư mục, trong đó có các tập tin được lưu trữ và cần thiết để được mở của PHP, mỗi ly thân của màu sắc ":". But be careful as it might expose your system to security fraud. Nhưng phải cẩn thận vì nó có thể phơi ra hệ thống của bạn để bảo vệ gian lận.
Once done, run the command below to make the changes effective, and then restart Apache httpd web server (apache2ctl restart or httpd restart): Sau khi thực hiện, hãy chạy lệnh dưới đây để thực hiện những thay đổi có hiệu quả, và sau đó khởi động lại Apache httpd web server (apache2ctl khởi động lại hoặc khởi động lại httpd):
$PRODUCT_ROOT_D/admin/sbin/websrvmng -v -a $ PRODUCT_ROOT_D / admin / sbin / websrvmng-v-a
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: Nếu bạn có, để tự chỉnh sửa các tập tin cấu hình của Apache để vô hiệu hoá PHP open_basedir bảo vệ, chỉ cần mở các tập tin httpd.conf, và tìm kiếm cho rằng những dòng bắt đầu bằng các ký tự sau:
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: Thay thế toàn bộ dòng theo ảo cho các máy chủ tên miền tài khoản người dùng mà bạn muốn vô hiệu hoá tính năng bảo vệ với các dòng sau để vô hiệu hóa nó:
php_admin_value open_basedir none php_admin_value open_basedir không có gì
You can also opt to allow your PHP scripts to access additional directory instead without disabling the protection. Bạn cũng có thể lựa chọn không cho phép PHP script của bạn để truy cập vào các thư mục để thay thế mà không vô hiệu hoá việc bảo vệ. Additional directory can be added to the line, separated with color “:”. Các thư mục có thể được thêm vào dòng, tách biệt với màu sắc ":". For example, to add /new_directory to the allow list: Ví dụ, để thêm / new_directory vào danh sách cho phép:
php_admin_value open_basedir “/home/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"
php_admin_value open_basedir “/home/user_account/:/usr/lib/php:/usr/local/lib/php:/tmp:/new_directory” php_admin_value open_basedir "/ home / user_account /: / usr / lib / php: / usr / local / lib / php: / tmp: / new_directory"
Restart the Apache after finished editing. Khởi động lại Apache sau khi hoàn tất chỉnh sửa. Note that the directory allowed list restriction above is actually a prefix, not a directory name. Lưu ý rằng các thư mục được cho phép trong danh sách hạn chế nêu trên thật là một tiền tố, không phải là một thư mục tên. This means that “open_basedir = /dir/incl” also allows access to “/dir/include” and “/dir/incls” if they exist. Điều này có nghĩa là "open_basedir = / dir / bao gồm" cũng cho phép truy cập vào "/ dir / bao gồm" và "/ dir / incls" nếu chúng tồn tại. When you want to restrict access to only the specified directory, end with a slash. Khi bạn muốn hạn chế quyền truy cập vào các thư mục được chỉ định, kết thúc bằng một slash. For example: “open_basedir = /dir/incl/”. Ví dụ: "open_basedir = / dir / bao gồm /".
IMPORTANT : The page is machine translated and provided "as is" without warranty. Lưu ý: Các trang web là máy tính dịch và cung cấp "như là" mà không có bảo hành. Machine translation may be difficult to understand. Máy dịch thuật có thể là khó hiểu. Please refer to Xin vui lòng tham khảo original English article Tiếng Anh bản gốc bài viết whenever possible. bất cứ khi nào có thể.
Related Articles Bài viết liên quan
- Group Policy Login or Logon Scripts Not Running, Not Working or Not Executing Nhóm Chính sách Đăng nhập hoặc Đăng Script Chạy Không, không làm việc hoặc không thực hiện
- cPanel WHM Failed to Receive Status Information From Apache Error cPanel WHM Không Nhận Tình trạng thông tin từ Apache Lỗi
- PHP Parse Error: syntax error, unexpected $end PHP Parse Error: lỗi cú pháp, bất ngờ kết thúc $
- winnt_accept: Asynchronous AcceptEx failed Error in Apache Log winnt_accept: Asynchronous AcceptEx không thành công Lỗi trong Apache Đăng nhập
- Request URL /server-status or 404 Page Not Found Apache Error Yêu cầu URL / hoặc tình trạng máy chủ-404 Không tìm thấy trang Apache Lỗi
- Apache Warn NameVirtualHost *:80 Has No VirtualHosts Error When Start Apache cảnh báo NameVirtualHost *: 80 Có Không có VirtualHosts Lỗi Khi Bắt đầu
- Bypass and Remove 3 Plays or 3 Days Restriction on Zune WiFi Sharing Hủy bỏ Bypass và 3 Plays hoặc 3 ngày Restriction trên Zune WiFi Chia sẻ
- gmmktime Error in WordPress and MagpieRSS gmmktime Lỗi trong WordPress và MagpieRSS
- Fix Internal Server Error When Accessing Easy Apache in cPanel WebHosting Manager Sửa nội Server Error Khi Truy cập dễ dàng Apache trong cPanel webhosting Trưởng
- PHP Allowed Memory Size Exchausted Fatal Error Kích thước bộ nhớ PHP phép Exchausted Fatal Lỗi










































December 21st, 2007 16:58 21 tháng mười hai, 2007 16:58
Great article. Great article.
Thanks for the WHM tip. Thanks for the tip WHM.
You saved my ass. Bạn lưu my ass.
December 3rd, 2007 16:21 3 tháng mười hai, 2007 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 thêm nữa thông tin vê este Tema, hay un artículo muy interesante sobre este lỗi vi kỹ thuật số Cuộc sống của tôi. Etiquetas: Desarrollo, hosting, open_basedir, [...] Etiquetas: Desarrollo, lưu trữ, open_basedir, [...]