<?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>metagraphical &#187; Apache</title>
	<atom:link href="http://meta-graphical.com/tag/apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://meta-graphical.com</link>
	<description>I do front end development and stuff…</description>
	<lastBuildDate>Sun, 08 Apr 2012 10:16:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
		<item>
		<title>Apache, MySQL, PHP development environment setup on Mac OSX 10.6 Snow Leopard</title>
		<link>http://meta-graphical.com/mac/apache-mysql-php-development-environment-setup-on-mac-osx-10-6-snow-leopard/</link>
		<comments>http://meta-graphical.com/mac/apache-mysql-php-development-environment-setup-on-mac-osx-10-6-snow-leopard/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 17:34:16 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Snow Leopard]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://meta-graphical.com/?p=148</guid>
		<description><![CDATA[As some of you may have heard, Snow Leopard was released a week and a half ago. I pre-ordered my copy from Apple, but didn&#8217;t get round to upgrading until the following Monday. First impressions were great: faster boot up, sleep and shutdown times, Time Machine backed up quicker, and the extra 7GB back on [...]]]></description>
			<content:encoded><![CDATA[<p>As some of you may have heard, <a href="http://www.apple.com/uk/macosx/">Snow Leopard</a> was released a week and a half ago. I pre-ordered my copy from Apple, but didn&#8217;t get round to upgrading until the following Monday. First impressions were great: faster boot up, sleep and shutdown times, Time Machine backed up quicker, and the extra 7GB back on my HDD was also welcome.</p>
<p>Then I checked my local development environment. Screwed!</p>
<p><span id="more-148"></span></p>
<p>As it turns out, the upgrade had reset all my Apache and PHP config files as well as any Virtual Hosts I had set up. These would need to be reapplied. It wasn&#8217;t that simple, however, as I did encounter one or two other problems as well.</p>
<p>As <abbr title="Snow Leopard">SL</abbr> ships with Apache and PHP already installed the majority of the work will be fairly simple config changes along with a few other small bits-and-bobs.</p>
<p>I use <a href="http://macromates.com/" title="TextMate">TextMate</a>, so I&#8217;ll be using the <code>mate</code> command to open files when in the Terminal. Of course, you can use whatever you like.</p>
<h2>vhosts.conf setup</h2>
<p>I started by opening up the vhosts.conf file. In the Terminal I entered:</p>
<pre>mate /private/etc/apache2/extra/httpd-vhosts.conf</pre>
<p>I create separate VirtualHost entries for each site I have in my development environment. To do this I commented out the example and added the following lines:</p>
<p><!--wp-compress-html--><!--wp-compress-html no compression--></p>
<pre>
&lt;VirtualHost *:80&gt;
    ServerName metagraphical.dev
    DocumentRoot "/Users/Matt/Sites/dev/"
&lt;/VirtualHost&gt;
</pre>
<p><!--wp-compress-html--></p>
<p>Remember, of course, to substitute &#8220;metagraphical&#8221; and &#8220;Matt&#8221; for your own details.</p>
<p>The next chunk of code is also required to prevent the &#8220;403 Forbidden&#8221; appearing when trying to navigate to your <code>vhosts</code> entries:</p>
<p><!--wp-compress-html--><!--wp-compress-html no compression--></p>
<pre>
&lt;Directory /Users/*/Sites/&gt;
    Options Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
&lt;/Directory&gt;
</pre>
<p><!--wp-compress-html--></p>
<p>I then saved the file and entered the required password.</p>
<p>Next I edited my <code>hosts</code> file with the new reference to the local site. In the Terminal:</p>
<pre>mate /private/etc/hosts</pre>
<p>Once the file had opened I added the following line:</p>
<pre>127.0.0.1 metagraphical.dev</pre>
<p>That was all, so I could save the file and close it.</p>
<h2>Apache</h2>
<p>With that done, I could move on to the Apache configuration.</p>
<p>Snow Leopard comes with Apache 2 already installed, so no faffing about downloading and installing it. Back in the Terminal I opened up the Apache <code>httpd.conf</code> file:</p>
<pre>mate /private/etc/apache2/httpd.conf</pre>
<p>I uncommented this line to apply all the VirtualHosts settings I&#8217;d just made:</p>
<pre># Include /private/etc/apache2/extra/httpd-vhosts.conf</pre>
<p>And also this line to get PHP up and running:</p>
<pre># LoadModule php5_module libexec/apache2/libphp5.so</pre>
<p>Bam! Done!</p>
<p>To test this I created a new <code>index.php</code> at the location I specified in my <code>vhosts.conf</code> and inside it added the <code>&lt;?php phpinfo(); ?&gt;</code> function and then saved the file. Before I could check it though, Apache needed to be turned on: System Preferences > Sharing, click the Web Sharing checkbox to fire it up. Now when I went to <code>http://metagraphical.dev/</code> I could see the details of my current PHP setup.</p>
<h2>PHP</h2>
<p>If you scroll down when viewing your PHP setup page you&#8217;ll notice a huge warning chatting on about date and timezone issues. I only found out about this after I installed WordPress unfortunately, and ended up doing a good bit of Googling to find the answer. The fix is pretty simple though.</p>
<p>I created the <code>php.ini</code> in order to begin making changes to the PHP configuration. In the Terminal:</p>
<p><!--wp-compress-html--><!--wp-compress-html no compression--></p>
<pre>
cd /private/etc
cp php.ini.default php.ini
sudo chmod 777 php.ini
mate php.ini
</pre>
<p><!--wp-compress-html--></p>
<p>Once open, I went and found the line <code>;date.timezone =</code>, uncommented it and added <code>"Europe/London"</code>. A <a href="http://us3.php.net/manual/en/timezones.php" title="Supported PHP Timezones">full list of supported timezones</a> can be found on <a href="http://php.net">php.net</a>.</p>
<p>The next problem I also found when I came to setup WordPress. The problem was that PHP couldn&#8217;t successfully connect to my MySQL database, and it only occurred when I created the new <code>php.ini</code>. Back to Google, once again, where I found that the problem was down to the default port for MySQL not being set. I did a search for the line <code>mysql.default_port =</code> and set the port number to <code>3306</code>.</p>
<p>That done, I saved the file and went back to the Terminal where I changed it&#8217;s permissions back:</p>
<pre>sudo chmod 444 php.ini</pre>
<h2>MySQL</h2>
<p>It is recommended that you upgrade to the 64 bit version of MySQL. You can download it from the <a href="http://dev.mysql.com/downloads/mysql/5.1.html#macosx-dmg" title="Download MySQL 5.1">MySQL downloads page</a>. You might want to make sure you backup any databases and database settings you have created before doing this.</p>
<p>I also installed the MySQL Pref Pane and the Startup Item that are bundled in with the disc image. The Pref Pane is still the 32 bit version, however, so when you click it you will be told that System Preferences must quit and reopen. It will then reopen in 32 bit mode. Guess we&#8217;ll just have to wait for an update.</p>
<p>Finally, I downloaded and installed <a href="http://dev.mysql.com/downloads/gui-tools/5.0.html#OSX">GUI Tools</a> for managing my databases, which I prefer over <a href="http://www.phpmyadmin.net/home_page/index.php">phpMyAdmin</a>.</p>
<p>That was it. All that was left to do now was to install <a href="http://wordpress.org/" title="Get WordPress">WordPress</a>, which is always a piece of cake.</p>
<p>Hope this helped.</p>
]]></content:encoded>
			<wfw:commentRss>http://meta-graphical.com/mac/apache-mysql-php-development-environment-setup-on-mac-osx-10-6-snow-leopard/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

