<?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>Aldoblog &#187; php</title>
	<atom:link href="http://aldoblog.com/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://aldoblog.com</link>
	<description>Michael Alderete’s Weblog</description>
	<lastBuildDate>Fri, 30 Apr 2010 21:00:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Done digging for a while</title>
		<link>http://aldoblog.com/2005/01/done-digging-for-a-while/</link>
		<comments>http://aldoblog.com/2005/01/done-digging-for-a-while/#comments</comments>
		<pubDate>Sun, 09 Jan 2005 03:19:40 +0000</pubDate>
		<dc:creator>Alderete</dc:creator>
				<category><![CDATA[About This Site]]></category>
		<category><![CDATA[Anti-Spam]]></category>
		<category><![CDATA[anti-spam]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[kubrick]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[spam]]></category>
		<category><![CDATA[staticize]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://aldoblog.com/blog/420</guid>
		<description><![CDATA[I spent a couple of hours yesterday working on a few last lingering details for this site. The main changes I wanted to make were to upgrade to the latest version of WordPress (a minor security update), make sure I was using the latest version of the Kubrick template (I was), and most importantly, fix the problems I was having with the Kubrick comments form.]]></description>
			<content:encoded><![CDATA[	<p>I spent a couple of hours yesterday working on a few last lingering details for this site. The main changes I wanted to make were to upgrade to the latest version of WordPress (a <a href="http://wordpress.org/development/2004/12/one-point-two-two/">minor security update</a>), make sure I was using the latest version of the <a href="http://binarybonsai.com/kubrick/">Kubrick template</a> (I was), and most importantly, fix the problems I was having with the Kubrick comments form, which is a lot cleaner and nicer than the standard WordPress version.</p>

	<p><span id="more-420"></span></p>

	<p>It turned out the issue was a couple of the <span class="caps">PHP</span> &#8220;open&#8221; tags &#8212; the text tokens that are used to signal that what follows is <span class="caps">PHP</span> code, not <span class="caps">HTML</span> code. The Kubrick template (at least as of version 1.2.6) uses the standard &#8220;full&#8221; tags almost everywhere, but there were a few instances where the developer used the short versions. Since I have short tags disabled on my server, it was causing a parse error, the end result of which was that the comments form could not be displayed. Fixed.</p>

	<p>Now that I&#8217;ve got comments working, I switched to allowing comments on postings by default, and letting them post without moderation first. We&#8217;ll see how that goes.</p>

	<p>Because, the weblog world is dealing with a plague of comment spam these days, from &#8220;search engine optimization&#8221; scumbags who are trying to promote their (or their clients&#8217;) websites. So I&#8217;ve also installed and enabled a number of comment spam plug-ins. We&#8217;ll see how that goes, too, though I&#8217;m somewhat pessimistic, for <a href="http://diveintomark.org/archives/2003/11/15/more-spam">a slew of reasons</a>. Probably I&#8217;ll have to turn moderation back on at some point&#8230;</p>

	<p>And I installed a new <a href="http://photomatt.net/2004/07/26/staticize-25/">caching plug-in</a>, which should theoretically improve the performance of this site. Not really a problem with the volume of visitors I&#8217;m getting today, but you never know, and having the plug-in active will hopefully prevent unpleasant surprises.<hr />Copyright &copy; 2010 by <strong><a href="http://aldoblog.com">Aldoblog</a></strong>. All rights reserved. This feed is provided for personal non-commercial use only. If you are not reading this material in your news aggregator, the site you are looking at is guilty of copyright infringement. Please contact legal-2010@aldoblog.com so we can take action immediately.</p>]]></content:encoded>
			<wfw:commentRss>http://aldoblog.com/2005/01/done-digging-for-a-while/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Back again</title>
		<link>http://aldoblog.com/2004/09/back-again/</link>
		<comments>http://aldoblog.com/2004/09/back-again/#comments</comments>
		<pubDate>Tue, 21 Sep 2004 06:04:16 +0000</pubDate>
		<dc:creator>Alderete</dc:creator>
				<category><![CDATA[About This Site]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[include_path]]></category>
		<category><![CDATA[monauraljerk]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[unix-permissions]]></category>
		<category><![CDATA[weblog]]></category>

		<guid isPermaLink="false">http://aldoblog.com/blog/395</guid>
		<description><![CDATA[Problem: For some reason, even though your PHP include_path does contain the location of your include file, PHP cannot seem to actually include() the file. The paths match exactly, and yet you still get errors.]]></description>
			<content:encoded><![CDATA[	<p>Back on the air. I&#8217;ve been in the process of switching from my old QuickSilver G4 desktop to the new PowerBook, and when I took the old computer offline, I locked myself out of this blog. I actually run the editing client on my personal computer, but have a read-only version on the FreeBSD server that actually makes it public. So, when I took down the old computer, the site was still online, but not editable.</p>

	<p>Getting the editing client running again was a fair amount of trouble. First there were all the code files to move over and into the right place. Then there was configuring Apache and <span class="caps">PHP</span> correctly. Then I needed to allow access to the database server from the new machine.</p>

	<p>And then I got stuck. On the same problem that stuck me three years ago when I moved <em>onto</em> the QuickSilver: I could not include() in the code files for the blog. Or <em>any</em> files, for that matter.</p>

	<p>Finally tracked down the problem, a teensy little thing, that I&#8217;m sure I&#8217;ll forget <em>again</em> by the time another three years goes by, and it&#8217;s time for the next new computer.</p>

	<p>So, in the hopes that Google will find the answer when I try looking for it again:</p>

	<p>Problem: For some reason, even though your <span class="caps">PHP</span> include_path does contain the location of your include file, <span class="caps">PHP</span> cannot seem to actually include() the file. The paths match exactly, and yet you still get errors.</p>

	<p>Symptom: Trying to include() <span class="caps">PHP</span> code files into a main file results in errors like this:</p>

	<blockquote>
		<p><strong>Warning:</strong>  main(include-file.inc): failed to open stream: No such file or directory in <strong>/path/to/main/file</strong> on line <strong>18</strong> <br />
<strong>Warning:</strong>  main(): Failed opening &#8216;include-file.inc&#8217; for inclusion (include_path=&#8217;.:/Users/username/Library/WebServer/&#8230;:/Library/WebServer/&#8230;&#8217;) in <strong>/Users/username/Sites/blog</strong> on line <strong>18</strong></p>
	</blockquote>

	<p>Answer: You are keeping the include files in a location inside your own home directory (~/Library/&#8230; here). The permissons on ~/Library are no access for group and world. So the web server process cannot access them &#8212; even though the actual include directory has correct permissions.</p>

	<p>Resolution: <code>chmod go+rx ~/Library</code><hr />Copyright &copy; 2010 by <strong><a href="http://aldoblog.com">Aldoblog</a></strong>. All rights reserved. This feed is provided for personal non-commercial use only. If you are not reading this material in your news aggregator, the site you are looking at is guilty of copyright infringement. Please contact legal-2010@aldoblog.com so we can take action immediately.</p>]]></content:encoded>
			<wfw:commentRss>http://aldoblog.com/2004/09/back-again/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mac OS X ~/Library permissions</title>
		<link>http://aldoblog.com/2003/04/mac-os-x-library-permissions/</link>
		<comments>http://aldoblog.com/2003/04/mac-os-x-library-permissions/#comments</comments>
		<pubDate>Tue, 22 Apr 2003 05:08:27 +0000</pubDate>
		<dc:creator>Alderete</dc:creator>
				<category><![CDATA[About This Site]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[include_path]]></category>
		<category><![CDATA[os-x]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://aldoblog.com/blog/290</guid>
		<description><![CDATA[Note to future self: the next time you re-install Mac OS X from scratch, remember that the reason why PHP cannot access include files in your ~/Library/WebServer folder is because the permissions on the ~/Library directory forbid read access to all but owner.]]></description>
			<content:encoded><![CDATA[	<p>Before I explain the problem and solution that had me tearing my hair out Friday through Sunday, let me explain how I organize my system for doing <span class="caps">PHP</span> development and serving. Mac OS X Jaguar includes robust web serving capabilities, in the form of Apache and <span class="caps">PHP</span>. Apache&#8217;s default services, the documents and <span class="caps">CGI</span>s which are installed with Jaguar, are located in subdirectories under <code>/Library/WebServer</code>. This would be a natural place to put configuration and include files for <span class="caps">PHP</span>, and indeed it is where I keep the server-wide php.ini configuration file for <span class="caps">PHP</span>:</p>

	<p><code>/Library/WebServer/PHP/php.ini</code></p>

<blockquote>(I also create a symlink for that file at <code>/usr/local/lib/php.ini</code>, because that&#8217;s where Marc Liyanage&#8217;s <a href="http://www.entropy.ch/software/MacOSx/php/" title="Full-featured PHP Module + Install Instructions">full-featured <span class="caps">PHP</span> module</a>, which I install over Apple&#8217;s &#8220;lite&#8221; version, expects to find its configuration file.)</blockquote>

	<p>However, Mac OS X separates out very cleanly the functionality installed at the system level, for all users, and functionality installed for a specific user. System level items go into <code>/Library</code>, while user-specific items go into <code>~/Library</code> (that is, the Library folder in your home folder). The two directories mirror each other in structure, but have a different &#8220;scope&#8221; &#8212; system-wide versus user-specific. Since I was adding <a href="http://monauraljerk.org/" title="Monauraljerk Weblogging System">my blogging system</a>&#8216;s <span class="caps">PHP</span> libraries for my own use only, I created the <code>~/Library/WebServer</code> directory, and a <code>PHP/Includes</code> subdirectory under it, to hold them:</p>

	<p><code>/Users/username/Library/WebServer/PHP/Includes/monauraljerk</code></p>

	<p>I add the following line to my <code>/private/etc/httpd/users/username.conf</code> to make <span class="caps">PHP</span> look for include files in the above Includes folder:</p>

	<p><code>path &quot;/Users/username/Library/WebServer/PHP/Includes:/Library/WebServer/PHP/Includes&quot;</code></p>

	<p>This needs to go inside a VirtualHost or Directory statement; if you don&#8217;t know what those are, you might not want to be fiddling with this stuff.</p>

	<p>The problem was, whenever I would load a <span class="caps">PHP</span> page that tried to <code>include()</code> one of the <span class="caps">PHP</span> libraries, or any file stored in my private Includes folder, it would fail with a &#8220;file not found&#8221; error. I spent more than 6 hours trying to track this problem down, finally resorting to brute force <span class="caps">PHP</span> scripts to test <code>file_exists()</code> on a bunch of different files, until I located the issue (and was able to blog once more!).</p>

	<p>So, finally, here&#8217;s my point. Note to future self: the next time you re-install Mac OS X from scratch, remember that the reason why <span class="caps">PHP</span> cannot access include files in your <code>~/Library/WebServer</code> folder is because the permissions on the <code>~/Library</code> directory forbid read access to all but owner. You need to increase the permissions like this:</p>

	<p><code>% chmod go+r ~/Library</code></p>

	<p>Remember it!<hr />Copyright &copy; 2010 by <strong><a href="http://aldoblog.com">Aldoblog</a></strong>. All rights reserved. This feed is provided for personal non-commercial use only. If you are not reading this material in your news aggregator, the site you are looking at is guilty of copyright infringement. Please contact legal-2010@aldoblog.com so we can take action immediately.</p>]]></content:encoded>
			<wfw:commentRss>http://aldoblog.com/2003/04/mac-os-x-library-permissions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
