<?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>Digital Base - Blog &#187; administration</title>
	<atom:link href="http://www.digitalbase.eu/blog/tag/administration/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.digitalbase.eu/blog</link>
	<description>A blog about webdesign, PHP, development and IT</description>
	<lastBuildDate>Mon, 10 May 2010 16:16:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>change Symfony Web directory path</title>
		<link>http://www.digitalbase.eu/blog/change-symfony-web-directory-path/</link>
		<comments>http://www.digitalbase.eu/blog/change-symfony-web-directory-path/#comments</comments>
		<pubDate>Tue, 12 Feb 2008 11:00:00 +0000</pubDate>
		<dc:creator>Gijs Nelissen</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[administration]]></category>
		<category><![CDATA[symfony]]></category>

		<guid isPermaLink="false">http://dibav3.gnelisse.desktop01/blog/?p=47</guid>
		<description><![CDATA[in directadmin you have the option to change/update the virtualhost of a certain domain. The downside of this solution is that whenever you change data related to this domain (safe mode, open basedir, add new domain), the virtualhost will get rewritten, causing your changed to be lost. There is a solution for this, although it requires a small symfony hack.]]></description>
			<content:encoded><![CDATA[<p>
Because we love the Symfony Open-source PHP Web Framework, we have developed multiple applications with it. For those wo are not familiar with Symfony, take a look at their <a href="http://www.symfony-project.org/" target="_blank" title="Symfony Project Website">website</a>  for more information.
</p>
<p>
The scripts of the web directory are the entry points to the application. To be able to access them from the Internet or any given webpage, the web server must be correctly configured. In your development server, as well as in a professional hosting solution, you probably have access to the Apache configuration and you can set up a virtual host :
</p>
<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="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>VirtualHost <span style="color: #339933;">*:</span><span style="color: #cc66cc;">80</span><span style="color: #339933;">&gt;</span>
 ServerName www<span style="color: #339933;">.</span>domain<span style="color: #339933;">.</span>com
 DocumentRoot <span style="color: #0000ff;">&quot;/home/diba/myproject/web&quot;</span>
 DirectoryIndex index<span style="color: #339933;">.</span>php
 Alias <span style="color: #339933;">/</span>sf <span style="color: #339933;">/</span><span style="color: #000088;">$sf_symfony_data_dir</span><span style="color: #339933;">/</span>web<span style="color: #339933;">/</span>sf
 <span style="color: #339933;">&lt;</span>Directory <span style="color: #0000ff;">&quot;/<span style="color: #006699; font-weight: bold;">$sf_symfony_data_dir</span>/web/sf&quot;</span><span style="color: #339933;">&gt;</span>
   AllowOverride All
   Allow from All
 <span style="color: #339933;">&lt;/</span>Directory<span style="color: #339933;">&gt;</span>
 <span style="color: #339933;">&lt;</span>Directory <span style="color: #0000ff;">&quot;/home/diba/myproject/web&quot;</span><span style="color: #339933;">&gt;</span>
   AllowOverride All
   Allow from All
 <span style="color: #339933;">&lt;/</span>Directory<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>VirtualHost<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

</p>
<p>
Setting up an web application on a shared host is a little bit trickier, since<br />
the host usually has a specific directory layout that you can&#39;t change, except when you have a webserver at your disposal of course. Let&#39;s imagine that your shared host requires that the web folder is named public_html instead of web, and that it doesn&#39;t give you access to the httpd.conf file, but only to an .htaccess file in the web folder.
</p>
<p>
In directadmin you have the option to change/update the virtualhost of a certain domain. The downside of this solution is that whenever you change data related to this domain (safe mode, open basedir, add new domain), the virtualhost will get rewritten, causing your changed to be lost. There is a solution for this, although it requires a small symfony hack.
</p>
<p>
In a symfony project, every path to a directory is configurable. You can<br />
still rename the web directory to <span style="font-family: Verdana,Arial,Helvetica,sans-serif">public_html</span> and<br />
have the application take it into account by changing the<br />
configuration. These lines are to be added to<br />
the end of the application config.php file:
</p>
<p>
<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$sf_root_dir</span> <span style="color: #339933;">=</span> sfConfig<span style="color: #339933;">::</span><span style="color: #004000;">get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'sf_root_dir'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
sfConfig<span style="color: #339933;">::</span><span style="color: #004000;">add</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
 <span style="color: #0000ff;">'sf_web_dir_name'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$sf_web_dir_name</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'public_html'</span><span style="color: #339933;">,</span>
 <span style="color: #0000ff;">'sf_web_dir'</span>      <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$sf_root_dir</span><span style="color: #339933;">.</span>DIRECTORY_SEPARATOR<span style="color: #339933;">.</span><span style="color: #000088;">$sf_web_dir_name</span><span style="color: #339933;">,</span>
 <span style="color: #0000ff;">'sf_upload_dir'</span>   <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$sf_root_dir</span><span style="color: #339933;">.</span>DIRECTORY_SEPARATOR<span style="color: #339933;">.</span><span style="color: #000088;">$sf_web_dir_name</span><span style="color: #339933;">.</span>DIRECTORY_SEPARATOR<span style="color: #339933;">.</span>sfConfig<span style="color: #339933;">::</span><span style="color: #004000;">get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'sf_upload_dir_name'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

</p>
<p>
And that&#39;s it! Your webapplication will now get it&#39;s public content from public_html, and the Symfony framework is smart enough to know that all the other files are one dir above this one. All hail to Sensiolabs!
</p>
<p>
P.S. <a href="/blog/directadmin-custom-webroot-for-symfony" title="Setup directadmin with symfony">If you are doing this because of the directadmin limitations, there is a post you should read. </a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.digitalbase.eu/blog/change-symfony-web-directory-path/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

