<?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>Uncarved &#187; MacPorts</title>
	<atom:link href="http://uncarved.prometheas.com/tag/macports/feed" rel="self" type="application/rss+xml" />
	<link>http://uncarved.prometheas.com</link>
	<description>An ongoing tension of potential, or how i learned to stop worrying and embrace the iterations.</description>
	<lastBuildDate>Mon, 08 Aug 2011 05:14:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>A Single Pear</title>
		<link>http://uncarved.prometheas.com/2009/07/a-single-pear.html</link>
		<comments>http://uncarved.prometheas.com/2009/07/a-single-pear.html#comments</comments>
		<pubDate>Fri, 24 Jul 2009 16:17:06 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Tabula Quasi-Rasa]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[MacPorts]]></category>
		<category><![CDATA[Pear]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[system administration]]></category>

		<guid isPermaLink="false">http://uncarved.prometheas.com/?p=431</guid>
		<description><![CDATA[I&#8217;ve just invested several hours trying to get my system to use the Pear libraries from MacPorts rather than the Pear libraries I had installed years ago using the command line installer, as described here. This is largely because I&#8217;m happy to let the MacPorts package manager take care of upgrading my software, and making [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just invested several hours trying to get my system to use the Pear libraries from <a href="http://macports.org">MacPorts</a> rather than the Pear libraries I had installed years ago using <a href="http://pear.php.net/go-pear">the command line installer</a>, as described <a href="http://clickontyler.com/blog/2008/01/how-to-install-pear-in-mac-os-x-leopard/">here</a>. This is largely because I&#8217;m happy to let the MacPorts package manager take care of upgrading my software, and making sure all inter-dependencies are looked after.</p>

<p>The command line installer adds files to the traditional <code>/usr/local</code> directory, while the MacPorts package manager adds the files to <code>/opt/local</code>.</p>

<p>And from there, troubles arose. <span id="more-431"></span></p>

<p>The truth is, I&#8217;d forgotten about the <code>/usr/local</code> pear install, until I&#8217;d noticed something peculiar trying to setup a <a href="http://symfony-project.org">Symfony</a> project I&#8217;m working on. Attempting to run one of its command line tasks, I got a fatal error from PHP, reading:</p>

<pre><code>  [#!shell]
  $ ./symfony cc

  Warning: require_once(/opt/local/lib/php/symfony/autoload/sfCoreAutoload.class.php): failed to open stream: No such file or directory in /Users/yanni/Sites/Hosts/breadbreaker.dev/config/ProjectConfiguration.class.php on line 3

  Fatal error: require_once(): Failed opening required '/opt/local/lib/php/symfony/autoload/sfCoreAutoload.class.php' (include_path='.:/opt/local/lib/php') in /Users/yanni/Sites/Hosts/breadbreaker.dev/config/ProjectConfiguration.class.php on line 3
</code></pre>

<p>The file paths for the <code>require</code> statement in the <code>ProjectConfiguration.class.php</code> file were generated on my home computer, which was configured to use the MacPorts pear, which installs Symfony at <code>/opt/local/lib/php</code>.</p>

<p>So I thought to check which pear installation I was using:</p>

<pre><code>  [#!shell]
  $ which pear
  /opt/local/bin/pear
</code></pre>

<p>Huh. That&#8217;s&#8230; actually (correctly) the MacPorts one. Next, I thought to check where my Symfony package was installed:</p>

<pre><code>  [#!shell]
  $ which symfony
  /usr/local/bin/symfony
</code></pre>

<p>&#8220;Ah!&#8221; I thought with relief at the promise of closure, &#8220;It&#8217;s using a version of Symfony I&#8217;d installed before I&#8217;d installed MacPorts&#8217; pear.&#8221; Then I thought I&#8217;d confirm that I still had the old version of pear laying around:</p>

<pre><code>  [#!shell]
  $ find /usr/local -name pear
  /usr/local/bin/pear
  /usr/local/share/pear
  /usr/local/share/pear/pear.old/symfony/plugins/sfPropelPlugin/lib/vendor/propel-generator/pear
  /usr/local/share/pear/symfony/plugins/sfPropelPlugin/lib/vendor/propel-generator/pear
</code></pre>

<p>I&#8217;d found it. I only wanted to keep a single version of pear libraries on my system (under MacPorts), so I proceeded to uninstall the Symfony package from <code>/usr/local</code> and install it explicitly into MacPorts&#8217; own <code>/opt/local</code>.</p>

<pre><code>  [#!shell]
  $ sudo /usr/local/bin/pear uninstall symfony/symfony
  uninstall ok: channel://pear.symfony-project.com/symfony-1.1.3

  $ sudo /opt/local/bin/pear install symfony/symfony
  downloading symfony-1.2.8.tgz ...
  Starting to download symfony-1.2.8.tgz (2,695,461 bytes)
  ..........................done: 2,695,461 bytes
  install ok: channel://pear.symfony-project.com/symfony-1.2.8
</code></pre>

<p>I then proceeded to confirm that Symfony was now installed somewhere within the <code>/opt/local</code> directory branch:</p>

<pre><code>  [#!shell]
  $ which symfony
  /usr/local/bin/symfony
</code></pre>

<p>It wasn&#8217;t. I then tried to rename the pear files in <code>/usr/local</code> so that they wouldn&#8217;t be found, but that didn&#8217;t work either. I Googled far and wide, and found my lead in the Pear Documentation website&#8217;s <a href="http://pear.php.net/manual/en/installation.shared.php">article about shared hosting</a>.</p>

<p>I had configured my <code>.pearrc</code> file to explicitly look for installed pear libraries in <code>/usr/local</code>. This setting was even being honored by the pear in <code>/opt/local</code>.</p>

<p>I renamed my <code>~/.pearrc</code> file to <code>~/.pearrc.old</code> and attempted to install the Symfony package again. Pear complained about an unknown installation source, which meant I had to &#8220;discover&#8221; Symfony&#8217;s <a href="http://pear.php.net/manual/en/guide.users.commandline.channels.php">pear channel</a>. Once I&#8217;d done this, Symfony installed to the correct location!</p>

<p>Finally, I just dumped the old pear installation under <code>/usr/local</code> and the file now named <code>~/.pearrc.old</code>, and was fully transitioned to the MacPorts pear.</p>

<p>How do you like <em>them</em> apples?</p>

<h3>Lessons</h3>

<ul>
<li>Ensure that you&#8217;re executing the correct pear script (on Unix, use <code>which</code> to determine absolute path of the script being used)</li>
<li>Verify that your <code>php.ini</code> file has got the correct pear installation path in its include path.</li>
<li>If you encounter some wonkiness with the inclusion of pear libraries, make sure there isn&#8217;t some <code>.pearrc</code> file with vestigial configuration settings messing with you.</li>
</ul>
<!-- PHP 5.x -->]]></content:encoded>
			<wfw:commentRss>http://uncarved.prometheas.com/2009/07/a-single-pear.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

