<?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>mummey.org &#187; osx</title>
	<atom:link href="http://www.mummey.org/category/osx/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mummey.org</link>
	<description>Personal Website of Adrian Mummey</description>
	<lastBuildDate>Tue, 27 Oct 2009 03:11:46 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Installing Symfony on MAMP</title>
		<link>http://www.mummey.org/2008/05/installing-symfony-on-mamp/</link>
		<comments>http://www.mummey.org/2008/05/installing-symfony-on-mamp/#comments</comments>
		<pubDate>Thu, 29 May 2008 12:33:01 +0000</pubDate>
		<dc:creator>Adrian Mummey</dc:creator>
				<category><![CDATA[featured articles]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[leopard]]></category>
		<category><![CDATA[MAMP]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[symfony]]></category>

		<guid isPermaLink="false">http://www.mummey.org/?p=1</guid>
		<description><![CDATA[For the past few days I have been setting up my mac environment and trying to get symfony up and running under the MAMP environment. I thought I would try my hand at a step by step tutorial. Many of the tutorials I found were geared toward people who were familiar with the Mac and/or [...]]]></description>
			<content:encoded><![CDATA[<p>For the past few days I have been setting up my mac environment and trying to get symfony up and running under the MAMP environment. I thought I would try my hand at a step by step tutorial. Many of the tutorials I found were geared toward people who were familiar with the Mac and/or MAMP. However I wasn&#8217;t one of these people.</p>
<p>In this post I will cover how to set up your MAMP and virtual hosts. I am using Mac OSX Leopard so some of this may be different for other versions. </p>
<p>First after installing MAMP, Open MAMP and click on Preferences and then click on the Ports tab. Here click the &#8220;Set to Default Apache and MySQL Ports&#8221; button. This will change the ports and may require a password to complete.</p>
<p>Next lets download and install symfony. From now on when I refer to the project I will use <em>myproject</em>.</p>
<p>Let&#8217;s create a project directory, open up your terminal window and type this (change <em>myproject</em> to your project name)</p>
<blockquote><p>$ mkdir /Applications/MAMP/htdocs/myproject</p></blockquote>
<p>/Applications/MAMP/htdocs/myproject will be your web root from now on. Let&#8217;s now enter the terminal and checkout Symfony from SVN.</p>
<blockquote><p>sudo /Applications/MAMP/bin/php5/bin/peardev channel-discover pear.symfony-project.com<br />
sudo /Applications/MAMP/bin/php5/bin/peardev install symfony/symfony</p></blockquote>
<p><span id="more-1"></span>Next in order to use Symfony on the command line let&#8217;s add a directory to the <strong>$PATH</strong> variable on the command line. First we need to check out path, so open up terminal and type this:</p>
<blockquote><p>$ echo $PATH<br />
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin</p></blockquote>
<p>So we need to take this path and append a &#8216;:/Applications/MAMP/bin/php5/bin&#8217; on to it so in terminal it will look something like this, but if your path has a different starting configuration it may vary.</p>
<blockquote><p>$ export PATH=&#8221;$PATH:/Applications/MAMP/bin/php5/bin&#8221;</p></blockquote>
<p>Now you should be able to enter symfony commands in the terminal without the full path, you may need to restart the terminal for this to work.</p>
<p>Another way to do this is to just create a symbolic link to the symfony program in your /usr/bin like this:</p>
<blockquote><p>cd /usr/local/bin<br />
$ sudo ln -s /Applications/MAMP/bin/php5/bin/symfony symfony</p></blockquote>
<p>So let&#8217;s initialize our symfony project</p>
<blockquote><p>cd /Applications/MAMP/htdocs/myproject<br />
symfony init-project myproject</p></blockquote>
<p>You will want to create at least one application. From the terminal:</p>
<blockquote><p>symfony init-app myproject</p></blockquote>
<p>Next we need to open up the <strong>config/config.php</strong> in your myproject directory. And change it to something like this:</p>
<blockquote><p><code>&lt;?php<br />
// symfony directories<br />
$sf_symfony_lib_dir  = '/Applications/MAMP/bin/php5/lib/php/symfony';<br />
$sf_symfony_data_dir = '/Applications/MAMP/bin/php5/lib/php/data/symfony';<br />
?&gt;</code></p></blockquote>
<p>Next let&#8217;s set up a virtual host with Apache. We need to open up MAMP&#8217;s <strong>httpd.conf</strong> file located at <strong>/Applications/MAMP/conf/apache/httpd.conf</strong><br />
We need to add our virtual host information at the very end of this file. Mine looks like this (remember to change <em>myproject</em> to your project name:</p>
<blockquote><p><code>NameVirtualHost *</code></p>
<p><code> </code><code>&lt;VirtualHost *&gt;<br />
  ServerName myproject<br />
  DocumentRoot "/Applications/MAMP/htdocs/myproject/web"<br />
  DirectoryIndex index.php<br />
  Alias /sf /Applications/MAMP/bin/php5/lib/php/data/symfony/web/sf<br />
  &lt;Directory "/Applications/MAMP/bin/php5/lib/php/data/symfony/web/sf"&gt;<br />
  AllowOverride All<br />
  Allow from All<br />
  &lt;/Directory&gt;<br />
  &lt;Directory "/Applications/MAMP/htdocs/myproject/web"&gt;<br />
  AllowOverride All<br />
  Allow from All<br />
  &lt;/Directory&gt;<br />
&lt;/VirtualHost&gt;</code></p></blockquote>
<p>Now that that is done, we need to edit the <strong>/etc/hosts</strong> file. So open up terminal again and type:</p>
<p>sudo nano /etc/hosts<br />
Then add<strong> 127.0.0.1  myproject</strong> to the end of the file. My hosts file looks like this:</p>
<blockquote><p><code>##<br />
# Host Database<br />
#<br />
# localhost is used to configure the loopback interface<br />
# when the system is booting.  Do not change this entry.<br />
##<br />
127.0.0.1       localhost<br />
255.255.255.255 broadcasthost<br />
::1             localhost<br />
fe80::1%lo0     localhost<br />
# VIRTUAL HOST START<br />
127.0.0.1       myproject<br />
# VIRTUAL HOST STOP</code></p></blockquote>
<p>Next you will want to restart your apache. At this point you should be able to type in your browser</p>
<p>http://myproject</p>
<p>And see the default symfony page.</p>
<p>I usually like to run MySQL from the command line. So next I created a symbolic link to the mysql program into my /usr/bin like this in the terminal:</p>
<blockquote><p>cd /usr/bin<br />
sudo ln -s /Applications/MAMP/Library/bin/mysql mysql</p></blockquote>
<p>Then I go into terminal to create my database for my symfony project (remember on MAMP default root password is root.</p>
<blockquote><p>mysql -u root -p root<br />
mysql &gt;<br />
create database myproject default character set utf8</p></blockquote>
<p>And then in my project folder /config/databases.yml looks like this:</p>
<blockquote><p>all:<br />
propel:<br />
class:          sfPropelDatabase<br />
param:<br />
username: root<br />
password: root<br />
dsn:          mysql://root@localhost/myproject</p></blockquote>
<p>And that is it. Hope this helped.</p>
<p>I used a few of these articles to figure this all out:</p>
<ul>
<li><a href="http://wp.omeeza.com/sunhwan/2007/07/12/installing-symfony-in-mac-with-xampp/">Installing Symfony in Mac with MAMP</a></li>
<li><a href="http://stereointeractive.com/blog/2008/01/24/installing-symfony-on-leopard/">INSTALLING SYMFONY ON LEOPARD</a></li>
<li><a href="http://kb.mediatemple.net/questions/237/How+can+I+Install+Symfony+PHP+framework+on+the+(gs)+Grid-Service%3F">Installing Symfony on Mediatemple</a></li>
</ul>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.mummey.org%2F2008%2F05%2Finstalling-symfony-on-mamp%2F&amp;linkname=Installing%20Symfony%20on%20MAMP"><img src="http://www.mummey.org/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.mummey.org/2008/05/installing-symfony-on-mamp/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>
