<?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>Phil Brown&#039;s Web Development Blog &#187; phpSuExec</title>
	<atom:link href="http://blog.philipbrown.id.au/tag/phpsuexec/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.philipbrown.id.au</link>
	<description></description>
	<lastBuildDate>Mon, 05 Dec 2011 22:22:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Roundcube 0.3-stable on PHPsuExec hosts</title>
		<link>http://blog.philipbrown.id.au/2009/10/roundcube-0-3-stable-on-phpsuexec-hosts/</link>
		<comments>http://blog.philipbrown.id.au/2009/10/roundcube-0-3-stable-on-phpsuexec-hosts/#comments</comments>
		<pubDate>Thu, 01 Oct 2009 05:59:56 +0000</pubDate>
		<dc:creator>Phil</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[php.ini]]></category>
		<category><![CDATA[PHPRC]]></category>
		<category><![CDATA[phpSuExec]]></category>
		<category><![CDATA[Roundcube]]></category>
		<category><![CDATA[suExec]]></category>
		<category><![CDATA[suhosin]]></category>

		<guid isPermaLink="false">http://morecowbell.net.au/?p=123</guid>
		<description><![CDATA[I&#8217;ve been using Roundcube as my webmail client since the early alpha days and was happy to see the recent release of 0.3-stable. I did have to tweak some PHP configuration items so, for the benefit of other Roundcube users, here&#8217;s how to get it up and running on a PHPsuExec enabled host. As outlined [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using Roundcube as my webmail client since the early alpha days and was happy to see the recent release of 0.3-stable. I did have to tweak some PHP configuration items so, for the benefit of other Roundcube users, here&#8217;s how to get it up and running on a PHPsuExec enabled host.</p>
<p>As outlined in a <a href="http://morecowbell.net.au/2009/08/php-suexec-and-custom-php-ini-files/">previous post</a>, I created my custom configuration file under <code>/home/user/etc/php.d/roundcube/custom.ini</code> using the <code>php_flag</code> and <code>php_value</code> properties from the Roundcube <code>.htaccess</code> file.</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;"><span style="color: #000099;">display_errors</span>              <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> Off</span>
<span style="color: #000099;">log_errors</span>                  <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> On</span>
<span style="color: #000099;">upload_max_filesize</span>         <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 5M</span>
<span style="color: #000099;">post_max_size</span>               <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 6M</span>
<span style="color: #000099;">memory_limit</span>                <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 64M</span>
&nbsp;
zlib.output_compression     <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> Off</span>
<span style="color: #000099;">magic_quotes_gpc</span>            <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 0</span>
zend.ze1_compatibility_mode <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 0</span>
suhosin.session.encrypt     <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> Off</span>
&nbsp;
session.auto_start          <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 0</span>
session.gc_maxlifetime      <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 21600</span>
session.gc_divisor          <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 500</span>
session.gc_probability      <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 1</span>
&nbsp;
mbstring.func_overload      <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 0</span></pre></div></div>

<p>This file is then merged into the server configuration file as <code>/home/user/etc/php.d/roundcube/php.ini</code>.</p>
<p>Then you just need to edit the Roundcube <code>.htaccess</code> file and add</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;">SetEnv PHPRC /home/user/etc/php.d/roundcube</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.philipbrown.id.au/2009/10/roundcube-0-3-stable-on-phpsuexec-hosts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP suExec and custom php.ini files</title>
		<link>http://blog.philipbrown.id.au/2009/08/php-suexec-and-custom-php-ini-files/</link>
		<comments>http://blog.philipbrown.id.au/2009/08/php-suexec-and-custom-php-ini-files/#comments</comments>
		<pubDate>Mon, 17 Aug 2009 00:13:59 +0000</pubDate>
		<dc:creator>Phil</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[php.ini]]></category>
		<category><![CDATA[PHPRC]]></category>
		<category><![CDATA[phpSuExec]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[suExec]]></category>

		<guid isPermaLink="false">http://morecowbell.net.au/?p=107</guid>
		<description><![CDATA[Lately, I&#8217;ve noticed more and more shared web hosts making the switch to running PHP under suExec. The benefits of this are: PHP scripts run as the owning user No more file system permission juggling Scripts are generally sandboxed to the owner&#8217;s home directory Unfortunately, this poses a problem for any custom PHP configuration changes [...]]]></description>
			<content:encoded><![CDATA[<p>Lately, I&#8217;ve noticed more and more shared web hosts making the switch to running PHP under suExec. The benefits of this are:</p>
<ul>
<li>PHP scripts run as the owning user</li>
<li>No more file system permission juggling</li>
<li>Scripts are generally sandboxed to the owner&#8217;s home directory</li>
</ul>
<p>Unfortunately, this poses a problem for any custom PHP configuration changes as the usual <code>.htaccess</code> <code>php_flag</code> and <code>php_value</code> properties are no longer supported. The recommended method of setting a custom configuration is to place a <code>php.ini</code> file under each directory where required.</p>
<p>This method works fine for any properties set in the custom <code>php.ini</code> file however there appears to be one devastating omission. <em>Server configuration properties do <strong>not</strong> cascade into the custom file.</em> What this means is that for any property <em>not</em> set in your custom file, PHP will revert to the PHP default.</p>
<p>For example, say your host has enabled PDO (as any decent host should). The instant you introduce a custom <code>php.ini</code> file, PDO will be lost. Sure, you could just include the relevant <code>extension_dir</code> and <code>extension</code> properties but consider this example (from my host)</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;"><span style="color: #000099;">extension_dir</span> <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;/usr/local/lib/php/extensions/no-debug-non-zts-20060613&quot;</span></pre></div></div>

<p>That property is awfully specific and your custom entry wouldn&#8217;t fare too well in the event of an upgrade.</p>
<p>In a perfect world, the host would have compiled PHP with the <code>--with-config-file-scan-dir=/some/dir</code> option that allows an environmentally settable directory to be scanned for additional config files. Unfortunately, this is rarely the case.</p>
<p>My solution is a little hacky and hardly perfect but it certainly gets the job done for me.</p>
<p>1. Create your custom.ini file with the options you want. Mine is <code>/home/user/etc/php.d/custom.ini</code> and looks like this</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;"><span style="color: #000099;">register_globals</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> Off</span>
<span style="color: #000099;">magic_quotes_gpc</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> Off</span></pre></div></div>

<p>Do <strong>not</strong> name this file php.ini.</p>
<p>2. Locate your host&#8217;s <code>php.ini</code> file. This information is available from <code>phpinfo()</code>. In the below examples it is <code>/usr/local/lib/php.ini</code></p>
<p>3. Add a cron job to create a full <code>php.ini</code> file in a location of your choosing (<code>/home/user/etc/php.d</code>) that is the concatenation of the server <code>php.ini</code> file and your <code>custom.ini</code> file. The below example is set to run hourly with any errors displayed on stdout which should be mailed to the crontab owner.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000;">0</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">test</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>php.ini <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>php.ini <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>user<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>php.d<span style="color: #000000; font-weight: bold;">/</span>custom.ini <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>user<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>php.d<span style="color: #000000; font-weight: bold;">/</span>php.ini <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'/usr/local/lib/php.ini NOT FOUND'</span></pre></div></div>

<p>The reason for the cron job is to keep your full, custom <code>php.ini</code> file in sync with any server changes. The job will also inform you in the unlikely event that the host <code>php.ini</code> file is moved. </p>
<p>If you&#8217;ve got shell access, you can create this file immediately by running</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>php.ini <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>user<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>php.d<span style="color: #000000; font-weight: bold;">/</span>custom.ini <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>user<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>php.d<span style="color: #000000; font-weight: bold;">/</span>php.ini</pre></div></div>

<p>otherwise, wait for the hour to come around in which case your cron job should have done the work for you.</p>
<p>4. Add the following to your web application&#8217;s <code>.htaccess</code> file</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">SetEnv</span> PHPRC /home/<span style="color: #00007f;">user</span>/etc/php.d</pre></div></div>

<p>The <code>PHPRC</code> environment variable informs any PHP scripts of the location of the preferred <code>php.ini</code> file.</p>
<p>Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.philipbrown.id.au/2009/08/php-suexec-and-custom-php-ini-files/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
