<?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>RedevelopmentZend Framework 2 Archive &#187; Redevelopment</title>
	<atom:link href="http://www.redevelopment.nl/blog/category/zf2/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.redevelopment.nl/blog</link>
	<description>Some thoughts and ideas related to web development</description>
	<lastBuildDate>Thu, 25 Apr 2013 00:09:56 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Dealing with alternative directory structures in ZF2</title>
		<link>http://www.redevelopment.nl/blog/2013/03/dealing-with-alternative-directory-structures-with-zf2/</link>
		<comments>http://www.redevelopment.nl/blog/2013/03/dealing-with-alternative-directory-structures-with-zf2/#comments</comments>
		<pubDate>Wed, 20 Mar 2013 22:17:08 +0000</pubDate>
		<dc:creator>ruben</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend Framework 2]]></category>

		<guid isPermaLink="false">http://www.redevelopment.nl/blog/?p=67</guid>
		<description><![CDATA[I just started diving into Zend Framework 2 after using Zend Framework 1 and even its early predecessors for years. And boy, things have changed! But after some initial reading I think I already see some major advantages, not in the last place the ModuleManager which really allows developers to create independent modules and share [...]]]></description>
				<content:encoded><![CDATA[<p>I just started diving into Zend Framework 2 after using Zend Framework 1 and even its early predecessors for years.<br />
And boy, things have changed! But after some initial reading I think I already see some major advantages, not in the last place the ModuleManager which really allows developers to create independent modules and share them with the community.</p>
<p>Anyway on to the actual subject of this post: directory structure. A standard ZF2 application has the following directory structure:</p>
<pre class="brush:shell">config
data
module
public
vendor
init_autoloader.php</pre>
<p>public contains index.php and your .htaccess, plus your public web resources such as images javascript and css files.</p>
<p>In a shared hosting environment running Plesk the directory structure is like this:</p>
<pre class="brush:shell">httpdocs (this is the webroot)
private
statistics
subdomains
etc.</pre>
<p>We don&#8217;t want to put everything in the httpdocs directory, because that&#8217;s the public directory and is accessible from the outside world. In a Plesk environment the private directory is used for application level files that aren&#8217;t supposed to be accessible from outside. So the solution is pretty simple:</p>
<ul>
<li>Upload the contents from the public directory into httpdocs</li>
<li>Upload the other directories (config, data, module, vendor and init_autoloader.php) into private</li>
</ul>
<p>After that you have to change the index.php file (in public) to make sure it searches for the init_autoloader.php script in the right location. By default this is sitting at the same level as the public directory, outside the public directory and hence this statement at the top of index.php:</p>
<pre class="brush:php">chdir(dirname(__DIR__));</pre>
<p>This line should be changed into:</p>
<pre class="brush:php">chdir(dirname(__DIR__) . '/private');</pre>
<p>And that&#8217;s it, now your ZF2 app should run within this Plesk style directory structure. Pretty easy, but I hope it&#8217;s helpful to someone.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.redevelopment.nl/blog/2013/03/dealing-with-alternative-directory-structures-with-zf2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
