<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>爱周末 &#187; open_basedir</title>
	<atom:link href="http://zhoumo123.cn/tag/open_basedir/feed" rel="self" type="application/rss+xml" />
	<link>http://zhoumo123.cn</link>
	<description>知识分享，共同进步。zhoumo123.cn</description>
	<lastBuildDate>Thu, 07 Nov 2019 05:53:49 +0000</lastBuildDate>
	<language>zh-CN</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.0.1</generator>
	<item>
		<title>PHP 配置文件中open_basedir选项作用</title>
		<link>http://zhoumo123.cn/php/297.html</link>
		<comments>http://zhoumo123.cn/php/297.html#comments</comments>
		<pubDate>Mon, 01 Sep 2014 08:31:38 +0000</pubDate>
		<dc:creator><![CDATA[zhangc]]></dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[open_basedir]]></category>

		<guid isPermaLink="false">http://zhoumo123.cn/?p=297</guid>
		<description><![CDATA[open_basedir: 将用户可操作的文件限制在某目录下 如下是php.ini中的原文说明以及默认配置: ; open_basedir, if set, limits all file operations to the defined directory ; and below. This directive makes most sense if used in a per-directory or ; per-virtualhost web server configuration file. This directive is ; *NOT* affected by whether ...  <a href="http://zhoumo123.cn/php/297.html">  阅读全文 </a>]]></description>
				<content:encoded><![CDATA[<p><strong>open_basedir:</strong> 将用户可操作的文件限制在某目录下</p>
<p>如下是php.ini中的原文说明以及默认配置:<br />
; open_basedir, if set, limits all file operations to the defined directory<br />
; and below. This directive makes most sense if used in a per-directory or<br />
; per-virtualhost web server configuration file. This directive is<br />
; *NOT* affected by whether Safe Mode is turned On or Off.<br />
open_basedir = .<br />
open_basedir可将用户访问文件的活动范围限制在指定的区域，通常是其家目录的路径，也<br />
可用符号&#8221;.&#8221;来代表当前目录。注意用open_basedir指定的限制实际上是前缀,而不是目录名。<br />
举例来说: 若&#8221;open_basedir = /dir/user&#8221;, 那么目录 &#8220;/dir/user&#8221; 和 &#8220;/dir/user1&#8243;都是<br />
可以访问的。所以如果要将访问限制在仅为指定的目录，请用斜线结束路径名。例如设置成:<br />
&#8220;open_basedir = /dir/user/&#8221;</p>
<p>open_basedir也可以同时设置多个目录, 在Windows中用分号分隔目录,在任何其它系统中用<br />
冒号分隔目录。当其作用于Apache模块时，父目录中的open_basedir路径自动被继承。</p>
<p>有三种方法可以在Apache中为指定的用户做独立的设置:</p>
<p>(a) 在Apache的httpd.conf中Directory的相应设置方法:</p>
<p>php_admin_value open_basedir /usr/local/apache/htdocs/<br />
#设置多个目录可以参考如下:<br />
php_admin_value open_basedir /usr/local/apache/htdocs/:/tmp/<br />
(b) 在Apache的httpd.conf中VirtualHost的相应设置方法:<br />
php_admin_value open_basedir /usr/local/apache/htdocs/<br />
#设置多个目录可以参考如下:<br />
php_admin_value open_basedir /var/www/html/:/var/tmp/</p>
<p>(c) 因为VirtualHost中设置了open_basedir之后, 这个虚拟用户就不会再自动继承php.ini<br />
中的open_basedir设置值了,这就难以达到灵活的配置措施, 所以建议您不要在VirtualHost<br />
中设置此项限制. 例如,可以在php.ini中设置open_basedir = .:/tmp/, 这个设置表示允许<br />
访问当前目录(即PHP脚本文件所在之目录)和/tmp/目录.</p>
<p>请注意: 若在php.ini所设置的上传文件临时目录为/tmp/, 那么设置open_basedir时就必须<br />
包含/tmp/,否则会导致上传失败. 新版php则会提示&#8221;open_basedir restriction in effect&#8221;<br />
警告信息, 但move_uploaded_file()函数仍然可以成功取出/tmp/目录下的上传文件,不知道<br />
这是漏洞还是新功能.</p>
<p>针对ShopEx472版本的配置：</p>
<p>open_basedir = &#8220;D:/Server;../catalog;../include;../../home;../syssite;../templates;../language;../../language;../../../language;../../../../language&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://zhoumo123.cn/php/297.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
