<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>open_basedir and directory structure</title>
		<link>http://www.allegro.cc/forums/view/591545</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Thu, 24 May 2007 15:56:42 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I want to be able to use files in my base directory from a higher directory and I don&#39;t know how.</p><p>Maybe I just don&#39;t know how to use directories correctly, but the process I want to take is like this:  I have at my base directory &quot;head.php&quot; and &quot;foot.php&quot;.  I want to have an article kept in a directory &quot;articles/spam_safe&quot; that also uses the head and foot.</p><p>I read somewhere that all you need to do is put a &quot;/&quot; at the beginning:
</p><pre>include(&#39;/head.php&#39;);</pre><p>

but that doesn&#39;t work.  so I tried:</p><pre>include(&#39;../../head.php&#39;);</pre><p>

not very elegant, it kind of worked, except it couldn&#39;t read the other files like the the css and other php files that included from within head.php.</p><div class="source-code snippet"><div class="inner"><pre>Warning: main<span class="k2">(</span><span class="k2">)</span> <span class="k2">[</span>function.main<span class="k2">]</span><span class="k2">:</span> open_basedir restriction in effect. File<span class="k2">(</span><span class="k3">/</span>right_menu.php<span class="k2">)</span> is <span class="k1">not</span> within the allowed path<span class="k2">(</span>s<span class="k2">)</span><span class="k2">:</span> <span class="k2">(</span><span class="k3">/</span>var<span class="k3">/</span>www<span class="k3">/</span>vhosts<span class="k3">/</span>zeoxdesign.com<span class="k3">/</span>httpdocs:<span class="k3">/</span>tmp<span class="k2">)</span> in <span class="k3">/</span>var<span class="k3">/</span>www<span class="k3">/</span>vhosts<span class="k3">/</span>zeoxdesign.com<span class="k3">/</span>httpdocs<span class="k3">/</span>foot.php on <a href="http://www.allegro.cc/manual/line" target="_blank"><span class="a">line</span></a> <span class="n">7</span>
</pre></div></div><p>

what should I do?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Mark Oates)</author>
		<pubDate>Thu, 24 May 2007 01:02:30 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>echo ini_get(&#39;open_basedir&#39;) will tell you which folder is your basedir. You should probably add that to your include path in the .htaccess file.
</p><pre>
.htaccess:
php_value include_path &quot;.:/my/base/dir&quot;
</pre><p>
Once you&#39;ve added your site&#39;s base dir to the path, you can include files relative to that.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Leverton)</author>
		<pubDate>Thu, 24 May 2007 01:32:00 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>ok, now it&#39;s including the php files but it still doesn&#39;t load the css file or images.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Mark Oates)</author>
		<pubDate>Thu, 24 May 2007 01:43:30 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Define &quot;doesn&#39;t load the css file or images.&quot; Are you open them from within PHP source code? Or do you just mean they won&#39;t show up in the browser?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Leverton)</author>
		<pubDate>Thu, 24 May 2007 01:46:01 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>just won&#39;t show up in the browser.  When the address is</p><p>www.zeoxdesign.com/articles/story1.php</p><p>and the background, title, etc images are located in</p><p>www.zeoxdesign.com/images</p><p>they won&#39;t display and it looks like this:</p><p><span class="remote-thumbnail"><span class="json">{"name":"592195","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/9\/3\/93994408fe87f61e54a17b6fd69031d4.jpg","w":449,"h":456,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/9\/3\/93994408fe87f61e54a17b6fd69031d4"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/9/3/93994408fe87f61e54a17b6fd69031d4-240.jpg" alt="592195" width="240" height="243" /></span></p><p>normally</p><p><span class="remote-thumbnail"><span class="json">{"name":"592196","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/d\/3\/d37d3006e61b1bc4b3060f136fa69af0.jpg","w":499,"h":475,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/d\/3\/d37d3006e61b1bc4b3060f136fa69af0"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/d/3/d37d3006e61b1bc4b3060f136fa69af0-240.jpg" alt="592196" width="240" height="228" /></span>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Mark Oates)</author>
		<pubDate>Thu, 24 May 2007 01:50:51 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>For the images and css and web files, you should just make them all relative to the root. </p><p><tt>&lt;img src=&quot;/images/foo.png&quot; /&gt;</tt>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Leverton)</author>
		<pubDate>Thu, 24 May 2007 01:56:30 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>just with the backslash at the beginning?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Mark Oates)</author>
		<pubDate>Thu, 24 May 2007 01:59:47 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Yes. Keep in mind that there are two file systems involved. The first is the physical one. The second is the web one. The web files are relative to your DocumentRoot, which can exist anywhere in the physical file system.</p><p>The leading slash in HTML code will cause it to always find the images folder, assuming it exists at $DocumentRoot/images. </p><p>However, a leading slash in PHP code will cause it to go to the base system / folder, which is surely not what you are looking for.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Leverton)</author>
		<pubDate>Thu, 24 May 2007 02:02:54 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>yay!<br />http://www.allegro.cc/files/attachment/592197</p><p>I understand now.  Thanks a lot!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Mark Oates)</author>
		<pubDate>Thu, 24 May 2007 02:08:16 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Not technically related, but FYI: / is a slash, \ is a backslash. At least on my keyboard, backslash is below the backspace. Also, one is used for escaping strings in C/php/whatever.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (CGamesPlay)</author>
		<pubDate>Thu, 24 May 2007 15:56:42 +0000</pubDate>
	</item>
</rss>
