<?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>Josh Butts .com &#187; Server Admin</title>
	<atom:link href="http://www.joshbutts.com/topics/server-admin/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.joshbutts.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Sat, 15 Aug 2009 19:55:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Using PEAR to keep Zend Framework current in Zend Server CE</title>
		<link>http://www.joshbutts.com/posts/zend-server-pear-zf/</link>
		<comments>http://www.joshbutts.com/posts/zend-server-pear-zf/#comments</comments>
		<pubDate>Sat, 15 Aug 2009 19:55:12 +0000</pubDate>
		<dc:creator>josh</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Server Admin]]></category>

		<guid isPermaLink="false">http://www.joshbutts.com/?p=41</guid>
		<description><![CDATA[Let me preface this by saying that up until recently, I&#8217;ve been anti-Zend-Server for a somewhat silly reason.  I&#8217;m used to deploying PHP applications on custom compiled builds of PHP, MySQL and PHP, and the thought of not compiling my stack from source was just unbearable.  For some unknown reason, I decided to give [...]]]></description>
			<content:encoded><![CDATA[<p>Let me preface this by saying that up until recently, I&#8217;ve been anti-Zend-Server for a somewhat silly reason.  I&#8217;m used to deploying PHP applications on custom compiled builds of PHP, MySQL and PHP, and the thought of not compiling my stack from source was just unbearable.  For some unknown reason, I decided to give <a href="http://www.zend.com/en/products/server-ce/">Zend Server CE</a> another try.  I&#8217;ve been in the beta program for this product since the days when it was called Zend Zenith.  Back then, I couldn&#8217;t figure out why they weren&#8217;t doing a more XAMPP-style application, but I&#8217;ve since come to appreciate the the way Zend Server is set up.</p>
<p>Now, on to the more important bits, at least as far as I&#8217;m concerned.  I like Zend Framework.  I like it quite a bit.  What I don&#8217;t like is continually downloading numerous copies of it as the version numbers increase.  What I like even less is &#8220;pinning&#8221; applications to certain versions of ZF by using an SVN:External or similar technique.  What I do like is the Zend Framework PEAR channel that <a href="http://www.ralphschindler.com">Ralph Schindler</a> makes available on <a href="http://www.zfcampus.org">zfcampus.org</a>.  This allows me to have ZF downloaded, installed, and upgraded with one command, and because it&#8217;s installed as part of PEAR, the include paths just work without extra setup.</p>
<p>Zend Server comes with a &#8220;fixed&#8221; version of Zend Framework (the most current package comes with 1.9.0), and my goal was to take out the version it comes with and replace it with a PEAR-installed version.  I also wanted the Zend Server web application to still understand and report the correct version information for Zend Framework.  As Zend Server&#8217;s GUI is really just another ZF application, it was fairly straight forward to do a littler reverse-engineering, and the whole process took less than 10 minutes to complete.</p>
<p>The steps outlined below should work on Mac and Linux.  I doubt they would have any hope of working on Windows, as it required a symlink to trick Zend Server (in the future, I&#8217;m referring to this as ZS) into using a different copy of ZF.  You could do this on Windows fairly easily still, but you&#8217;d probably need to edit one of the controllers for the ZS management GUI.  Also, the some of the commands below assume you have <span class="pre">/usr/local/zend/bin</span> on your PATH, which I do.  If you don&#8217;t, you may be talking to the wrong PHP, especially on a Mac, so I&#8217;d recommend doing that first.</p>
<p>The first step was to find out where ZS keeps its copy of ZF.  Conveniently, the GUI reports this in the &#8220;Server Info&#8221; screen as <span class="pre">/usr/local/zend/share/ZendFramework</span>.</p>
<p><a href="http://www.joshbutts.com/wp-content/uploads/2009/08/picture-2.png"><img class="alignnone size-full wp-image-43" title="ZS Server Info Screen" src="http://www.joshbutts.com/wp-content/uploads/2009/08/picture-2.png" alt="ZS Server Info Screen" width="631" height="400" /></a></p>
<p>Next, we need to actually install the zfcampus.org PEAR channel and download ZF.  As of this writing, the channel is serving up ZF 1.9.1, and ZS comes with 1.9.0.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">deeporange:~ josh$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> pear channel-discover pear.zfcampus.org
Adding Channel <span style="color: #ff0000;">&quot;pear.zfcampus.org&quot;</span> succeeded
Discovery of channel <span style="color: #ff0000;">&quot;pear.zfcampus.org&quot;</span> succeeded
deeporange:~ josh$
&nbsp;
deeporange:~ josh$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> pear <span style="color: #c20cb9; font-weight: bold;">install</span> zfcampus<span style="color: #000000; font-weight: bold;">/</span>zf
downloading ZF-1.9.1.tgz ...
Starting to download ZF-1.9.1.tgz <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">3</span>,<span style="color: #000000;">272</span>,<span style="color: #000000;">570</span> bytes<span style="color: #7a0874; font-weight: bold;">&#41;</span>
.............................done: <span style="color: #000000;">3</span>,<span style="color: #000000;">272</span>,<span style="color: #000000;">570</span> bytes
<span style="color: #c20cb9; font-weight: bold;">install</span> ok: channel:<span style="color: #000000; font-weight: bold;">//</span>pear.zfcampus.org<span style="color: #000000; font-weight: bold;">/</span>ZF-1.9.1
deeporange:~ josh$</pre></td></tr></table></div>

<p>Through a little casual directory snooping, we can learn that ZS has PEAR configured with a base path of <span class="pre">/usr/local/zend/share/pear</span>.  This means that ZF was just installed to <span class="pre">/usr/local/zend/share/pear/Zend</span>.  What we need to do now is get <span class="pre">/usr/local/zend/share/ZendFramework/library/Zend</span> (this is the path where ZS expects ZF to be) to really point to <span class="pre">/usr/local/zend/share/pear/Zend</span>.  On a Mac or Linux system, it&#8217;s simple enough to completely remove the ZS default ZF and create a symlink to our new install.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">deeporange:~ josh$ <span style="color: #7a0874; font-weight: bold;">cd</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>zend<span style="color: #000000; font-weight: bold;">/</span>share
deeporange:share josh$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-fR</span> ZendFramework<span style="color: #000000; font-weight: bold;">/</span>
deeporange:share josh$ <span style="color: #c20cb9; font-weight: bold;">mkdir</span> ZendFramework
deeporange:share josh$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">mkdir</span> ZendFramework
deeporange:share josh$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">mkdir</span> ZendFramework<span style="color: #000000; font-weight: bold;">/</span>library
deeporange:share josh$ <span style="color: #7a0874; font-weight: bold;">cd</span> ZendFramework<span style="color: #000000; font-weight: bold;">/</span>library<span style="color: #000000; font-weight: bold;">/</span>
deeporange:library josh$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</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>zend<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>pear<span style="color: #000000; font-weight: bold;">/</span>Zend .
&nbsp;
deeporange:library josh$ <span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-la</span>
total <span style="color: #000000;">8</span>
drwxr-xr-x  <span style="color: #000000;">3</span> root  wheel  <span style="color: #000000;">102</span> Aug <span style="color: #000000;">15</span> <span style="color: #000000;">14</span>:<span style="color: #000000;">21</span> .
drwxr-xr-x  <span style="color: #000000;">3</span> root  wheel  <span style="color: #000000;">102</span> Aug <span style="color: #000000;">15</span> <span style="color: #000000;">14</span>:<span style="color: #000000;">21</span> ..
lrwxr-xr-x  <span style="color: #000000;">1</span> root  wheel   <span style="color: #000000;">31</span> Aug <span style="color: #000000;">15</span> <span style="color: #000000;">14</span>:<span style="color: #000000;">21</span> Zend -<span style="color: #000000; font-weight: bold;">&gt;</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>zend<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>pear<span style="color: #000000; font-weight: bold;">/</span>Zend
deeporange:library josh$</pre></td></tr></table></div>

<p>Now we can see by refreshing the Zend Server GUI screen that our Zend Framework version number is reported as 1.9.1.  An optional last step would be to modify the include path directive using the ZS admin screen to remove <span class="pre">/usr/local/zend/share/ZendFramework</span>, as this is merely a symlink to the PEAR base path at this point, which is already included in the include path.  Your new include path setting should look like the one below.</p>
<p><a href="http://www.joshbutts.com/wp-content/uploads/2009/08/picture-3.png"><img class="alignnone size-full wp-image-58" title="ZS Include Path" src="http://www.joshbutts.com/wp-content/uploads/2009/08/picture-3.png" alt="ZS Include Path" width="831" height="331" /></a></p>
<p>Now, the next time there is a new version of Zend Framework available on zfcampus.org, all you have to do to get everything upgraded is run the following command:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">deeporange:<span style="color: #000000; font-weight: bold;">!</span> josh$ pear upgrade zfcampus<span style="color: #000000; font-weight: bold;">/</span>zf</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.joshbutts.com/posts/zend-server-pear-zf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
