<?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>Jason Lotito &#187; zend framework</title>
	<atom:link href="http://www.jasonlotito.com/tag/zend-framework/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jasonlotito.com</link>
	<description>Programming, technology, and bits about my life</description>
	<lastBuildDate>Tue, 10 Jan 2012 04:14:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Installing and setting up Zend Framework on a Virtual Host</title>
		<link>http://www.jasonlotito.com/programming/zend-framework-programming/installing-and-setting-up-zend-framework-on-a-virtual-host/</link>
		<comments>http://www.jasonlotito.com/programming/zend-framework-programming/installing-and-setting-up-zend-framework-on-a-virtual-host/#comments</comments>
		<pubDate>Fri, 17 Sep 2010 14:29:38 +0000</pubDate>
		<dc:creator>Jason Lotito</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[installing]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[zend framework]]></category>

		<guid isPermaLink="false">http://blog.jasonlotito.com/?p=49</guid>
		<description><![CDATA[0. Full documentation here: http://framework.zend.com/manual/en/learning.quickstart.create-project.html 1. Log onto your account. You&#8217;ll most like be in your home directory. You should know which directory is your public directory (Web Root). Usually this is something like &#8216;www&#8216;, &#8216;public_html&#8216;, or &#8216;html&#8216;, or maybe even &#8216;your-domain.com&#8216;. Regardless, you don&#8217;t need to be there yet. In the follow examples, anytime [...]]]></description>
			<content:encoded><![CDATA[<p>0. Full documentation here:</p>
<p><a href="http://framework.zend.com/manual/en/learning.quickstart.create-project.html">http://framework.zend.com/manual/en/learning.quickstart.create-project.html</a></p>
<p>1. Log onto your account. You&#8217;ll most like be in your home directory.  You should know which directory is your public directory (Web Root).  Usually this is something like &#8216;<em>www</em>&#8216;, &#8216;<em>public_html</em>&#8216;, or &#8216;<em>html</em>&#8216;, or maybe even &#8216;<em>your-domain.com</em>&#8216;.  Regardless, you don&#8217;t need to be there yet.  In the follow examples, anytime you see the directory &#8216;<em>www</em>&#8216;, assume it&#8217;s the Web Root and replace it with whatever your Web Root is.</p>
<p>Also, in the below examples, I&#8217;ll use &#8216;<em>/path/to&#8217;</em>.  For me, this is &#8216;<em>/home/jason</em>&#8216;  For you, it might be &#8216;<em>/home/username</em>&#8216;, or &#8216;<em>/home/website.com</em>&#8216;.  Whatever it is, it&#8217;s whatever comes before the rest of the paths.  I&#8217;ll use &#8216;<em>/path/to</em>&#8216; below, just keep in mind, this is different for each person.</p>
<p>If your not sure what this is, when you first log in via SSH, run this command</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>server<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ <span style="color: #7a0874; font-weight: bold;">pwd</span></pre></div></div>

<p>It will print out the directory your currently in.  This is most likely the directory path you&#8217;ll want to use for &#8216;<em>/path/to</em>&#8216;.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>server<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ <span style="color: #c20cb9; font-weight: bold;">mkdir</span> src
<span style="color: #7a0874; font-weight: bold;">&#91;</span>server<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ <span style="color: #c20cb9; font-weight: bold;">mkdir</span> lib
<span style="color: #7a0874; font-weight: bold;">&#91;</span>server<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ <span style="color: #7a0874; font-weight: bold;">cd</span> src</pre></div></div>

<p>2. Download and &#8216;install&#8217; the source</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>server<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ <span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>framework.zend.com<span style="color: #000000; font-weight: bold;">/</span>releases<span style="color: #000000; font-weight: bold;">/</span>ZendFramework-1.10.8<span style="color: #000000; font-weight: bold;">/</span>ZendFramework-1.10.8.tar.gz
<span style="color: #7a0874; font-weight: bold;">&#91;</span>server<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ <span style="color: #c20cb9; font-weight: bold;">tar</span> xfz ZendFramework-1.10.8.tar.gz
<span style="color: #7a0874; font-weight: bold;">&#91;</span>server<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ <span style="color: #c20cb9; font-weight: bold;">mv</span> ZendFramework-1.10.8 ..<span style="color: #000000; font-weight: bold;">/</span>lib
<span style="color: #7a0874; font-weight: bold;">&#91;</span>server<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ <span style="color: #7a0874; font-weight: bold;">cd</span> ..<span style="color: #000000; font-weight: bold;">/</span>lib
<span style="color: #7a0874; font-weight: bold;">&#91;</span>server<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ <span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> ZendFramework-1.10.8<span style="color: #000000; font-weight: bold;">/</span> Zend
<span style="color: #7a0874; font-weight: bold;">&#91;</span>server<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ <span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">zf</span>=<span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>Zend<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>zf.sh</pre></div></div>

<p>You can also place the zf alias in your .bash_profile in your home directory by doing the following</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>server<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ <span style="color: #7a0874; font-weight: bold;">cd</span> ~
<span style="color: #7a0874; font-weight: bold;">&#91;</span>server<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ <span style="color: #c20cb9; font-weight: bold;">vi</span> .bash_profile</pre></div></div>

<p>You can also use nano, or any other editor you are familiar with, and add this line</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">zf</span>=<span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>Zend<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>zf.sh</pre></div></div>

<p>After all this is done, you&#8217;ve essentially installed Zend Framework on your virtual host.  However, now you need to set it up for your site.</p>
<p>3. Creating your project</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>server<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ <span style="color: #7a0874; font-weight: bold;">cd</span> ~
<span style="color: #7a0874; font-weight: bold;">&#91;</span>server<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ zf create project PROJECTNAME</pre></div></div>

<p>If you have an existing Web Root, you&#8217;ll want to move this or remove it, or change it.  Basically, at this point, we want the web root pointing to the correct directory in the Zend Project we just created.</p>
<p>If my Web Root was a directory named &#8216;www&#8217;, I&#8217;d do this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>server<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ <span style="color: #c20cb9; font-weight: bold;">mv</span> www www_old</pre></div></div>

<p>Keep in mind by doing this, I can no longer access my website hosted in that directory.  We&#8217;ll set this up now.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>server<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ <span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> PROJECTNAME<span style="color: #000000; font-weight: bold;">/</span>public<span style="color: #000000; font-weight: bold;">/</span> www</pre></div></div>

<p>In this case, &#8216;www&#8217; should be the name of your Web Root.</p>
<p>Now we need to need to make sure the site can find the Zend Framework.  Remember, it&#8217;s in the lib directory.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>server<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ <span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>Zend<span style="color: #000000; font-weight: bold;">/</span>library<span style="color: #000000; font-weight: bold;">/</span>Zend .</pre></div></div>

<p>At this point, you should be able to go to your website and check out the default web page.  Congrats!</p>
<p>Also, log out, and then log back in.  If you entered the alias for your .bash_profile, you should be able to run this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>server<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ zf show version
Zend Framework Version: 1.10.8</pre></div></div>

<p>Now you can use the zf script helper functions, and proceed with a working Zend Framework setup.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>server<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ zf <span style="color: #7a0874; font-weight: bold;">help</span></pre></div></div>

<p>This will also work.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jasonlotito.com/programming/zend-framework-programming/installing-and-setting-up-zend-framework-on-a-virtual-host/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>.htaccess SetEnv Conditionals: mod_setenvif</title>
		<link>http://www.jasonlotito.com/apache/htaccess-setenv-conditionals-mod_setenvif/</link>
		<comments>http://www.jasonlotito.com/apache/htaccess-setenv-conditionals-mod_setenvif/#comments</comments>
		<pubDate>Sat, 13 Feb 2010 23:55:54 +0000</pubDate>
		<dc:creator>Jason Lotito</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[zend framework]]></category>

		<guid isPermaLink="false">http://www.jasonlotito.com/?p=11</guid>
		<description><![CDATA[The mod_setenvif module allows you to set environment variables according to whether different aspects of the request match regular expressions you specify. via mod_setenvif &#8211; Apache HTTP Server. I&#8217;ve never claimed to be a server guru, and I&#8217;ve never had much interest in delving into Apache configuration files, but web programming almost request that I [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>The mod_setenvif module allows you to set environment variables according to whether different aspects of the request match regular expressions you specify.</p>
<p>via <a href="http://httpd.apache.org/docs/2.2/mod/mod_setenvif.html">mod_setenvif &#8211; Apache HTTP Server</a>.</p></blockquote>
<p>I&#8217;ve never claimed to be a server guru, and I&#8217;ve never had much interest in delving into Apache configuration files, but web programming almost request that I dig down and learn about what I&#8217;m using in order to make the best use of the technologies I&#8217;m using.  Besides, I&#8217;m well past the point where I can keep making excuses for not learning Apache.</p>
<p>Zend Framework 1.10 uses the .htaccess file to set the enviromental variable APPLICATION_ENV.  It does this using SetEnv.</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">SetEnv</span> APPLICATION_ENV production</pre></div></div>

<p>This let&#8217;s us set the environment to production or development, obviously.  The idea is that you can set the variable depending on where the files are: a production server or a development server.</p>
<p>However, I wanted something a bit simpler at the moment.  I wanted to the variable based on the URL used.  beta.example.com would get the development site, and www.example.com would load up the production site.  Both sites share the same directory as their web directory, but I want the live site to display a &#8216;Coming soon&#8230;&#8221; message, while the beta site would let me work. I&#8217;m not concerned with people getting access to beta, and the only difference will be the display of the default page, but it&#8217;s a simple thing.  Now, I could have done this in PHP, but I didn&#8217;t want to do this.  At the same time, I had in mind the ability to use this setting of environmental variables something I could use for other things, like debugging, web services, and what not.  Being able to let Apache handle this, and then letting Zend build the configuration based on this setting, would let me not worry about programing any of this logic into my system.  I just program away, and I can make the assumption that whatever happens based on the URL will happen appropriately.</p>
<p>Anyways, a quick check of the docs for SetEnv lead me to discover SetEnvIf.  I&#8217;ve seen this before, but I never paid much attention to this setting. It&#8217;s rather simple, and could be very powerful.</p>
<p>As a simple example, I want to set the APPLICATION_ENV variable to production if the website is www.example.com, and development if the site is beta.example.com.  This worked:</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">SetEnvIf</span> Host <span style="color: #7f007f;">&quot;www.example.com&quot;</span> APPLICATION_ENV=production
<span style="color: #00007f;">SetEnvIf</span> Host <span style="color: #7f007f;">&quot;beta.example.com&quot;</span> APPLICATION_ENV=development</pre></div></div>

<p>That was the initial code.  Of course, after reading through the manual, I read about SetEnvIfNoCase, which is the same as SetEnvIf, except the &#8220;matching is performed in a case-insensitive manner.&#8221;</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">SetEnvIfNoCase</span> Host <span style="color: #7f007f;">&quot;www.example.com&quot;</span> APPLICATION_ENV=production
<span style="color: #00007f;">SetEnvIfNoCase</span> Host <span style="color: #7f007f;">&quot;beta.example.com&quot;</span> APPLICATION_ENV=development</pre></div></div>

<p>Pretty simple.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jasonlotito.com/apache/htaccess-setenv-conditionals-mod_setenvif/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

