我遇到过这个问题,我有一个运行apache和php的服务器.我们有许多虚拟主机,但我们注意到潜在的恶意用户可以使用他的网络空间浏览其他用户的文件(通过简单的PHP脚本)甚至系统文件,这可能是由于php权限.一种避免它的方法是在php.ini中设置open_basedir var,这在单个主机系统中非常简单,但是在虚拟主机的情况下,每个主机都会有一个basebir.
我可以为每个用户/主机设置dis basedir吗?有没有办法让apache hereditate已经请求的php文件的php权限
EG /home/X_USER/index.php拥有所有者X_USER,当apache读取文件index.php时它会检查其路径和所有者,只是我正在寻找一个系统设置php basedir变量到该路径.
提前感谢Lopoc
使用PHPass(http://www.openwall.com/phpass/)时收到以下警告:
open_basedir restriction in effect. File(/dev/urandom) is not within the allowed path(s)
Run Code Online (Sandbox Code Playgroud)
虽然这不是一个大问题(它会落后于其他东西),但我不想发出这个警告.PHP应用程序应该在不同的服务器上运行,一些用户可以将该路径添加到其允许的open_basedir路径,但其他用户将无法访问该配置.
我的第一个猜测是检查可读性is_readable(),但是,我仍然收到警告.
问题:如何检查某个路径或文件是否已添加到open_basedir路径?
我想在php脚本中返回open_basedir的值..我该怎么办?如果值为空,则应该回显为空白.
谢谢!
我is_dir在页面上打了一些电话.他们一直没有遇到任何问题.
几天前,托管公司将PHP从5.2升级到5.3.从那时起,我所有的调用is_dir都导致了以下错误(消息):
Warning: is_dir(): open_basedir restriction in effect.
File(/home/virtual/domain.com/public_html/galleries/img/002.JPG/)
is not within the allowed path(s):
(/home/virtual/domain.com:/home/virtual/_tmp)
in /home/virtual/domain.com/public_html/index.php on line 201
Run Code Online (Sandbox Code Playgroud)
这让我很困惑.
显然,根据错误消息(以及php_info同样),/home/virtual/domain.com包含/启用了目录(没有尾部斜杠,因此包括子目录)open_basedir,并且is_dir尝试迭代的文件都位于该文件夹下的子文件夹中.那么为什么它们不在允许的路径内呢?显然他们是!
奇怪的是,此错误似乎仅在is_dir返回false 时显示,即,当文件不是文件夹而是常规文件时.它似乎可以直接遍历目录而不会抛出错误.
此前发布的类似问题:Open_basedir限制奇数(未找到解决方案).
有人有主意吗?
(注意:更改PHP设置不是一个选项,因为这是一个共享主机,我没有任何管理员权限)
我在代码中收到以下警告:
Warning: is_readable() [function.is-readable]: open_basedir restriction in effect. File(/usr/share/php/./views/helpers/Doctype.php) is not within the allowed path(s): (/var/www/virtual/example.com/:/usr/share/pear/) in /var/www/virtual/example.com/htdocs/rockhopper-v2/library/Zend/Loader.php on line 198
or
Warning: is_readable() [function.is-readable]: open_basedir restriction in effect. File(/usr/share/php//var/www/virtual/example.com/htdocs/rockhopper-v2/application/modules/default/views/helpers/Layout.php) is not within the allowed path(s): (/var/www/virtual/example.com/:/usr/share/pear/) in /var/www/virtual/example.com/htdocs/rockhopper-v2/library/Zend/Loader.php on line 198
Run Code Online (Sandbox Code Playgroud)
问题是什么,它会在我的应用程序的部署和生产阶段引起问题吗?
谢谢
我正在使用这个joomla网站,我无法上传任何扩展程序.如果我使用正常的上传方法我得到JFolder::create: Could not create directory
Unable to create destination
如果我使用从目录上传我得到Copy failed
JInstaller: :Install: Failed to copy file
我尝试了很多解决方案在joomla支持论坛发现但没有一个对我有用.绝望中我甚至将tmp ermissions更改为777,现在目录权限(我知道它的错误)列表显示tmp是可写的但The PHP temporary directory is not writeable by the Joomla! instance, which may cause issues when attempting to upload extensions to Joomla!. If you are having issues uploading extensions, check the '/tmp' and set it to be writeable and see if this fixes the issue.在扩展管理器中显示警告- >警告
我想知道是否open_basedir有缺陷.在我的PHP信息文件中,我有
/srv/www/vhosts/domain/httpdocs/:/tmp/- no value.我怎么知道open_basedir有缺陷?我该如何解决这个扩展问题呢?
我有一些 PHP 代码可以在设置目录中创建一个新文件:
$target_path = "reports/" . basename($Report_Filename) . ".php";
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { /* code here */ }
Run Code Online (Sandbox Code Playgroud)
它运行良好,并且已经完成了几年,不幸的是我们刚刚转移到新服务器,我现在收到此错误:
[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
Run Code Online (Sandbox Code Playgroud)
请提供有关解决此问题的方法的任何建议?我已经检查了文件夹(我要上传到的文件夹和 Windows TEMP 文件夹)的权限,但并不高兴。我还尝试了对 php.ini 文件的一些调整,特别是“open_basedir”行,但也没有运气。
谢谢
假设我有 domain.com 和其他五个子域。
子域存储在与 domain.com 不同的文件夹中
在 domain.com 中,我将有 3 个文件夹,当我在其他子域中时,我需要访问这些文件夹,我将访问 php、css、图像和任何内容。
每个子域都需要有自己的 htaccess。
做到这一点的最佳方法是什么?我已经阅读了一些关于 open basedir 的内容,但我不确定这是否是最好的方法。也不知道它是如何工作的。
提前致谢
严重性:警告
消息:mkdir():open_basedir限制生效.File()不在允许的路径中:(/ home/thelazyppl /:/ home/thelazyppl:/ tmp:/ usr/local/lib/php /)
文件名:drivers/Session_files_drivers.php
该站点的根文件夹是一个wordpress网站,所以我在根文件夹中为Codeigniter站点创建了一个名为"Bazaar"的子域.我已经在config.php和wordpress htaccess中设置了base_url以允许文件夹"Bazaar",但仍然没有任何工作.
我的主机不允许修改php.ini文件来禁用open_basedir,是否有另一种方式允许它或者我在这个过程中做错了什么?
我有一个PHP库,我想分享给我服务器上的几个虚拟主机,但是open_basedir指令导致了麻烦.
我使用ISPConfig 3来管理网站.
PHP警告:include():open_basedir限制生效.文件(/ var/toaster/latest/__ server/core/cms.php)不在允许的路径中:(第5行的[cut]中的[cut:几个路径])
加载配置文件:/etc/php5/cgi/php.ini
open_basedir:[cut:几个路径](本地和主值)
; open_basedir =
<tmpl_if name ='security_level'op ='=='value = '20'>
php_admin_value open_basedir <tmpl_var name ='php_open_basedir'>
</ tmpl_if>
绝对没有关于open_basedir
所有这些意味着我不知道的东西设置了我的open_basedir指令.什么哪里?
从PPA在我的Ubuntu服务器上安装phpMyAdmin之后
https://launchpad.net/~nijel/+archive/ubuntu/phpmyadmin
我收到一系列警告.提前致谢!
./libraries/Util.class.php#521 file_exists()中的警告:open_basedir限制生效.文件(doc/html/index.html)不在允许的路径中:(/ tmp /:/ usr/share/phpmyadmin /:/ etc/phpmyadmin /:/ var/lib/phpmyadmin /:/ usr /共享/ PHP/PHP-的gettext /:在/ usr /共享/ JavaScript的/:在/ usr /共享/ PHP/TCPDF /)
回溯
./libraries/Util.class.php#521:file_exists(字符串'doc/html/index.html')./ libs/sanitizing.lib.php#92:PMA_Util :: getDocuLink(string'faq',string'faq3 -11',)PMA_replaceDocLink(array)./libraries/sanitizing.lib.php#152:preg_replace_callback(string'/\[doc @([a-zA-Z0-9 _-] +)\] /',string' PMA_replaceDocLink',字符串'Podríaperaproximado.Pulse enelnúmeroparaobtener la cantidad exacta.Ver [doc @ faq3-11] FAQ 3.11.',)./ template/database/structure/table_header.phtml#43:PMA_sanitize(string 'Podríaperaproximado.Pulse enelnúmeroparaobtener la cantidad exacta.Ver [doc @ faq3-11] FAQ 3.11 [/ doc].')./ library /Template.class.php #80:include(./ templates/database/structure/table_header.phtml)./ library/controllers/DatabaseStructureController.class.php#224:PMA\Template-> render(array)./ db_structure.php#54:PMA\Controllers\DatabaseStructureController-> indexAction()
编辑:这不是open_basedir 限制的副本。文件(/) 不在允许的路径内:。这个问题与 PHP 设置无关,因为我有几个网站在相同的地图结构和相同的 PHP 设置下工作。在将其标记为重复之前,请阅读整个问题,因为我已经在这个问题的最后 4 段中解释了这一点。此外,另一个问题的答案是针对 Apache 的,而我使用的是 Nginx,它不使用 CPanel 或 httpd.conf。
我已手动将我的 Wordpress 站点移至新服务器。对于最后一个,我收到此错误:
Warning: is_dir(): open_basedir restriction in effect. File(/) is not
within the allowed path(s):
(/var/hpwsites/u_bcsautoborg:/usr/share/pear/) in
/var/hpwsites/u_bcsautoborg/website/html/webroot/wp-includes/functions.php on
line 1585
Run Code Online (Sandbox Code Playgroud)
我之前在该站点上遇到过类似的错误,但这是由于upload文件夹未从 Wordpress 设置正确链接到。因此,错误显示了不同的行号。
第 1585 行是:
while ( '.' != $target_parent && ! is_dir( $target_parent ) ) {
Run Code Online (Sandbox Code Playgroud)
并且是更大块的一部分:
/*
* Safe mode fails with a trailing slash under certain PHP versions.
* Use rtrim() …Run Code Online (Sandbox Code Playgroud) 首先,对不起长标题,我从未预料到这个错误,所以我不知道如何形容它.
我收到这个错误:
Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/usr/local/apache/bin/apachectl) is not within the allowed path(s): (/home/:/backup/:/tmp/) in /home/xxxxx/public_html/plugins/system/jch_optimize/jchoptimize/helper.php on line 176
Run Code Online (Sandbox Code Playgroud)
是否意味着tmp目录中的某些内容已被使用或缺少某些内容?
我迷失在这里,我可以从哪里开始?
这是helper.php:
<?php
use JchOptimize\JSMinRegex;
/**
* JCH Optimize - Joomla! plugin to aggregate and minify external resources for
* optmized downloads
* @author Samuel Marshall <sdmarshall73@gmail.com>
* @copyright Copyright (c) 2010 Samuel Marshall
* @license GNU/GPLv3, See LICENSE file
* This program is free software: you can redistribute it and/or modify
* it under the terms …Run Code Online (Sandbox Code Playgroud) open-basedir ×13
php ×12
apache ×2
codeigniter ×1
file ×1
joomla ×1
joomla2.5 ×1
linux ×1
mysql ×1
nginx ×1
phpass ×1
phpmyadmin ×1
return ×1
ubuntu ×1
upload ×1
virtualhost ×1
wordpress ×1