<?xml version="1.0" encoding="UTF-8"?>

<rss version="2.0"
 xmlns:blogChannel="http://backend.userland.com/blogChannelModule"
>

<channel>
<title>Parallels knowledgebase (KB)</title>
<link>http://kb.parallels.com/</link>
<description>Parallels knowledgebase (KB)</description>
<language>en</language>
<copyright>Copyright 2008 Parallels</copyright>
<pubDate>Wed, 10 Sep 2008 00:00:00 +0600</pubDate>
<lastBuildDate>Wed, 10 Sep 2008 00:00:00 +0600</lastBuildDate>
<webMaster>rt-team@parallels.com</webMaster>

<item>
<title><![CDATA[[How to] I get an "open_basedir" error in PHP script. How can I fix it?]]></title>
<link>http://kb.parallels.com/en/432</link>
<description><![CDATA[<div id="article">
	




	<div id="kb" class="kb">
		<div class="article-container">
			<h2 class="title">[How to] I get an "open_basedir" error in PHP script. How can I fix it?</h2>
			<div class="ab-frame"><div class="bl"><div class="br"><div class="tl"><div class="tr"><!-- frame -->
				<div class="articleProperty">
					<div>Article ID: 432&nbsp;</div>
					<div>Last Review: Oct,15 2009</div>
					<tr>
						<td>Author: </td>
						<td>Bezborodova Anastasiya</td>
					</tr>
					<br/>
					<tr>
						<td>Last updated by: </td>
						<td>Bezborodova Anastasiya</td>
					</tr>
					<strong>APPLIES TO:</strong>
					<div class="articleApplies">
						<ul>
							<li>Parallels Plesk Panel for Linux/Unix</li>
						</ul>
					</div>
				</div><!-- articleProperty -->
			</div></div></div></div></div><!-- frame -->

			<div class="article-internal-flag"></div>

			<div id="article-content">
				<div class="article-part">
					<h2>Cause</h2>
					<meta http-equiv="CONTENT-TYPE" content="text/html; charset=utf-8"> 	<title></title> 	<meta name="GENERATOR" content="OpenOffice.org 2.4  (Linux)"> 	<style type="text/css">
	<!--
		@page { size: 21cm 29.7cm; margin: 2cm }
		P { margin-bottom: 0.21cm }
	-->
	</style>  <p style="margin-bottom: 0cm;"><span lang="en-US">This error means that PHP script tries to access a folder </span>access to which  is not allowed.<span lang="en-US"> For security reasons, PHP options for domains hosted in Parallels Plesk Panel allow access to </span><strong>/tmp</strong> and <strong>http(s)docs </strong><span lang="en-US">folders only by default. Restrictions are limited by <strong>open_basedir</strong> PHP variable for each virtual host separately.</span></p> <style type="text/css"><!--
		@page { size: 21cm 29.7cm; margin: 2cm }
		P { margin-bottom: 0.21cm }
	--</style></meta></meta>
				</div>
				<div class="article-part">
					<h2>Resolution</h2>
					<meta http-equiv="CONTENT-TYPE" content="text/html; charset=utf-8"> 	<title></title> 	<meta name="GENERATOR" content="OpenOffice.org 2.4  (Linux)"> 	<style type="text/css">
	<!--
		@page { size: 21cm 29.7cm; margin: 2cm }
		P { margin-bottom: 0.21cm }
	-->
	</style>  <p style="margin-bottom: 0cm;"><span lang="en-US">In case you need to allow access with PHP scripts of a certain virtual host to additional folder(s), you should set up option 'open_basedir' for the virtual host with the new path value, splitting the folder names with colons. This action can only be made by a user with root privileges on domains&rsquo; <strong>vhost.conf</strong> or <strong>vhost_ssl.conf </strong>files (for SSL virtual host). For more information, read the article <a href="http://kb.parallels.comhttp://download1.swsoft.com/Plesk/Plesk8.1/Doc/plesk-8.1-unix-administrators-guide/17359.htm">'Including Directives into Configuration File of Web Serve'</a></span><span lang="en-US"> in the Parallels Plesk Panel documentation.</span></p> <p style="margin-bottom: 0cm;"><span lang="en-US">Once applied these changes, you should recreate Apache&rsquo;s configuration files and restart  Apache service using the following command in the</span><span lang="en-US"> shell. If the vhost(_ssl).conf file is found, then it will be automatically added to the httpd.include file of the domain:</span></p> <p><span style="font-family: Courier New;">~# /usr/local/psa/admin/sbin/websrvmng -a -v </span><br /><br /><strong>NOTE: </strong>If do not run the command above <span lang="en-US"><strong>vhost.conf</strong> or <strong>vhost_ssl.conf </strong></span>would not be included to Apache configuration and the changes not take affect.</p> <p style="margin-bottom: 0cm;"><font face="Courier New, monospace"><font size="2"><font face="Calibri, sans-serif"><font size="2" style="font-size: 11pt;"><span lang="en-US">Examples:</span></font></font></font></font></p> <p style="margin-bottom: 0cm;"><span lang="en-US">NOTE: </span><strong><span lang="en-US">HTTPD_VHOSTS_D</span></strong><span lang="en-US"> needs to be replaced by a real path to the domain location, which may vary according to the OS and Parallels Plesk Panel version. You can look up the current value in the /etc/psa/psa.conf file. </span><strong><span lang="en-US">ADD_PATH</span></strong><span lang="en-US"> needs to be replaced by a real path to the folder we are granting access to.</span></p> <p lang="en-US" style="margin-bottom: 0cm;">Create HTTPD_VHOSTS_D/domain.com/conf/vhost.conf:&nbsp;</p>  <p lang="en-US" style="margin-bottom: 0cm;"><span style="font-family: Courier New;">---8&lt;---<br />&lt;Directory HTTPD_VHOSTS_D/domain.com/httpdocs&gt;</span></p><p lang="en-US" style="margin-bottom: 0cm;"><span style="font-family: Courier New;">php_admin_value open_basedir <strong>HTTPD_VHOSTS_D/domain.com/httpdocs:/tmp:/ADD_PATH</strong></span></p><p lang="en-US" style="margin-bottom: 0cm;"><span style="font-family: Courier New;">&lt;/Directory&gt;<br />---&gt;8---</span></p> <p lang="en-US" style="margin-bottom: 0cm;">&nbsp;Create HTTPD_VHOSTS_D/domain.com/conf/vhost_ssl.conf:</p>  <p lang="en-US" style="margin-bottom: 0cm;"><span style="font-family: Courier New;">---8&lt;---<br />&lt;Directory HTTPD_VHOSTS_D/domain.com/httpsdocs&gt;</span></p><p lang="en-US" style="margin-bottom: 0cm;"><span style="font-family: Courier New;">php_admin_value open_basedir <strong>HTTPD_VHOSTS_D/domain.com/httpsdocs:/tmp:/ADD_PATH</strong></span></p><p lang="en-US" style="margin-bottom: 0cm;"><span style="font-family: Courier New;">&lt;/Directory&gt;<br />---&gt;8---</span></p> <p lang="en-US" style="margin-bottom: 0cm;">&nbsp;For subdomains, create the corresponding<strong> HTTPD_VHOSTS_D/domain.tld/subdomains/subdomain/conf/vhost.conf</strong> file:</p>  <p lang="en-US" style="margin-bottom: 0cm;"><span style="font-family: Courier New;">---8&lt;---<br />&lt;Directory HTTPD_VHOSTS_D/domain.com/subdomains/subdomain/httpdocs&gt;</span></p><p lang="en-US" style="margin-bottom: 0cm;"><span style="font-family: Courier New;">php_admin_value open_basedir &quot;HTTPD_VHOSTS_D/domain.com/subdomains/subdomain/httpdocs:/tmp:/ADD_PATH&quot;</span></p><p lang="en-US" style="margin-bottom: 0cm;"><span style="font-family: Courier New;">&lt;/Directory&gt;<br />---&gt;8---</span></p> <p lang="en-US" style="margin-bottom: 0cm;">&nbsp;Also, you can set up global 'open_basedir' for a certain location required in /etc/php.ini, for example:</p>  <p lang="en-US" style="margin-bottom: 0cm;"><span style="font-family: Courier New;">---8&lt;---<br />open_basedir = &quot;/tmp&quot;<br />---&gt;8---</span></p>  <p lang="en-US" style="margin-bottom: 0cm;">&nbsp;<span lang="en-US">Once php.ini changed, restart Apache.</span></p> </meta></meta>
				</div>
			</div>
		</div><!-- article-container -->


			<br/><br/>

			<div id="SubscriptionLink24Article" class="subscriptionLink2">
<a href="http://kb.parallels.com/subscriptions/index.html?Type=Article&ArticleID=432&ArticleLanguage=en&Product=&Category="><img src="http://kb.parallels.com/images/mail.png" width="15" height="15" alt="Subscription for changes to this article"></a>
<a href="http://kb.parallels.com/subscriptions/index.html?Type=Article&ArticleID=432&ArticleLanguage=en&Product=&Category=">Subscription for changes to this article</a>

<script type="text/javascript">

$(document).ready(function() {
	$('#SubscriptionLink24Article a').each(function(){
		$(this).click(function(event) {
			event.preventDefault();
			MainPageContentHide();
			$('#subscription').html('');
			$.get('/Stuff/Subscription', {
													'Type' : 'Article',
													'ArticleID' : '432',
													'ArticleLanguage' : 'en',
													'Product' : '',
													'Category' : ''
												}, function(data) {
																	$('#subscription').html(data);
																	$('#subscription').show();
																	SUBbuildsubmenus_product();
																});
		});
	});
});

</script>

</div>





	</div><!-- kb -->

</div><!-- article -->


]]></description>
<author>Bezborodova Anastasiya</author>
<guid isPermaLink="false">5655 LastUpdated: 2009-10-15 06:59:03</guid>
<pubDate>2009-01-25 18:45:07</pubDate>
</item>
</channel>
</rss>



