<?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>Wiffu &#187; osx</title>
	<atom:link href="http://wiffu.com/category/osx/feed/" rel="self" type="application/rss+xml" />
	<link>http://wiffu.com</link>
	<description>sam keen&#039;s corner of the web</description>
	<lastBuildDate>Sun, 02 May 2010 18:06:22 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>GD imagettftext broken on Leopard/mac ports</title>
		<link>http://wiffu.com/gd-imagettftext-broken-on-leopardmac-ports/</link>
		<comments>http://wiffu.com/gd-imagettftext-broken-on-leopardmac-ports/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 20:21:00 +0000</pubDate>
		<dc:creator>sam keen</dc:creator>
				<category><![CDATA[osx]]></category>

		<guid isPermaLink="false">http://dabbling.in/uncategorized/gd-imagettftext-broken-on-leopardmac-ports</guid>
		<description><![CDATA[Spent the better part of the morning battling PHP/GD.  I needed to overlay text on an image, something I can recall doing in the past without issue.  Not this morning though.  Everytime the code got to &#8216;imagettftext&#8217; it would result in a WSOD.  After much troubleshooting and Google&#8217;ng I found  [...]]]></description>
			<content:encoded><![CDATA[<p>Spent the better part of the morning battling PHP/GD.  I needed to overlay text on an image, something I can recall doing in the past without issue.  Not this morning though.  Everytime the code got to &#8216;imagettftext&#8217; it would result in a WSOD.  After much troubleshooting and Google&#8217;ng I found  <a href="http://bugs.php.net/bug.php?id=45437">this</a> mention in the PHP bug db which then pointed to the root of the cause: The macports &#8216;freetype&#8217; lib.  The solution for fixing that is <a href="http://lists.macosforge.org/pipermail/macports-users/2008-July/010921.html">here</a>.</p>
<p>hope this helps others</p>
]]></content:encoded>
			<wfw:commentRss>http://wiffu.com/gd-imagettftext-broken-on-leopardmac-ports/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running PHP5 fast cgi with lighttpd on OS X</title>
		<link>http://wiffu.com/running-php5-fast-cgi-with-lighttpd-on-os-x/</link>
		<comments>http://wiffu.com/running-php5-fast-cgi-with-lighttpd-on-os-x/#comments</comments>
		<pubDate>Sat, 17 Feb 2007 04:11:00 +0000</pubDate>
		<dc:creator>sam keen</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[osx]]></category>

		<guid isPermaLink="false">http://dabbling.in/uncategorized/running-php5-fast-cgi-with-lighttpd-on-os-x</guid>
		<description><![CDATA[Lighttpd is a lightweight (lighter than Apache) http server. It has been gaining more an more press lately (The Ruby crowd uses it often for Rails).You can run PHP on lighttpd as a CGI (Fast CGI prefferably). You can even keep your existing Apache/PHP install and run Lighttpd/PHP side by side (on another port)
Step 1: [...]]]></description>
			<content:encoded><![CDATA[<p>Lighttpd is a lightweight (lighter than Apache) http server. It has been gaining more an more press lately (The Ruby crowd uses it often for Rails).<br />You can run PHP on lighttpd as a CGI (Fast CGI prefferably). You can even keep your existing Apache/PHP install and run Lighttpd/PHP side by side (on another port)</p>
<p>Step 1: Install lighttpd.</p>
<p>By far the easiest way to do this on a OSX is with darwin ports (easy to install, easy to upgrade). In a terminal just issue:</p>
<p>$ sudo port install lighttpd</p>
<p>It will most likley install a few prerecusits and then lighttpd. If you are not a dp fan, compiling and installing lighttpd is not dificult either, see their docs for that.<br />Step 2: Install a Fast CGI enabled PHP5.</p>
<p>Download the latest PHP5 tarball (at the time of this writing that was 5.2.0)<br />cd to the unpacked php-5.2.0 directory and run your configure command. In my case I used…</p>
<p>./configure &#8211;prefix=/usr/local/php-fcgi<br />&#8211;enable-fastcgi<br />&#8211;with-mysqli=/usr/local/mysql/bin/mysql_config<br />&#8211;with-mysql=/usr/local/mysql<br />&#8211;with-curl=/usr/include<br />&#8211;with-xsl<br />&#8211;with-gd<br />&#8211;with-png-dir=/opt/local<br />&#8211;with-jpeg-dir=/opt/local<br />&#8211;enable-sockets<br />&#8211;with-gettext=/opt/local<br />&#8211;with-zlib-dir=/opt/local<br />&#8211;with-config-file-path=/etc<br />&#8211;with-xml-rpc<br />&#8211;enable-mbstring<br />&#8211;with-iconv<br />&#8211;enable-memory-limit</p>
<p>Two things are important here.</p>
<p>  1. –prefix=/usr/local/php-fcgi : This needs to be different than your existing php install. If not you will overwrite/corrupt that existing install.<br />  2. –enable-fastcgi : Self explanitory</p>
<p>As for the other config flag, just use what you need, this example is just what I use.<br />When configure completes run make then sudo make install<br />You will end up with a php install at what was used for ‘–prefix=…’ (/usr/local/php-fcgi in my case)<br />Take PHP’s example php.ini file ({php-source-dir}/php.ini-recommended) and move it to /etc/php-fast-cgi.ini (in my case since I used –with-config-file-path=/etc). Naming the file php-fast-cgi.ini rather than php.ini caused this cgi version of PHP to use that ini file rather than say another php.ini file there that Apache is using. This lets you run Apache mod PHP and cgi PHP on the same box and keep the ini files centaly located.<br />Step 3: Configure Lighttpd.</p>
<p>Lighttpd has aconfig file (similar to httpd.conf) and after a darwin ports install it can be found at /opt/local/etc/lighttpd/lighttpd.conf.default. First make a copy of that file</p>
<p>$ sudo cp /opt/local/etc/lighttpd/lighttpd.conf.default /opt/local/etc/lighttpd/lighttpd.conf</p>
<p>Now with you favorite editor, make these changes to lighttpd.conf.</p>
<p>within server.modules, uncomment (delete the ‘#’) for “mod_fastcgi”,</p>
<p>set the document-root to something appropriate, I used…</p>
<p>server.document-root        = &#8220;/Users/sam/Sites/lighttpd/root/&#8221;</p>
<p>set the erorlog to something appropriate, I used…</p>
<p>server.errorlog             = &#8220;/Users/sam/Sites/lighttpd/logs/lighttpd.error.log&#8221;</p>
<p>for OS X uncomment server.event-handler…</p>
<p>## set the event-handler (read the performance section in the manual)</p>
<p>server.event-handler = &#8220;freebsd-kqueue&#8221; # needed on OS X</p>
<p>Set the accesslog to something appropriate…</p>
<p>accesslog.filename          = &#8220;/Users/sam/Sites/lighttpd/logs/access.log&#8221;</p>
<p>Set the server.port (I used 8181, you can use any available port)…</p>
<p>server.port                = 8181</p>
<p>Set up the fast-cgi section. This is the minimum needed, see the lighttpd docs for more info.</p>
<p>fastcgi.server = ( &#8220;.php&#8221; => ((</p>
<p>                    &#8220;bin-path&#8221; => &#8220;/usr/local/php-fcgi/bin/php&#8221;,</p>
<p>                    &#8220;socket&#8221; => &#8220;/tmp/phpfcgi.socket&#8221;</p>
<p>                )))</p>
<p>Set up the user and group for lighttpd to run as. I chose www (should exist on OSX, you can use any ‘unprivileged’ user)</p>
<p>server.username            = &#8220;www&#8221;</p>
<p>server.groupname           = &#8220;www&#8221;</p>
<p>Okay, save that file and quickly create the directories we refered to in the config file (if they do not exist) and change there ownership to the server.username:server.groupname you chose above (www:www in my case)</p>
<p>$ mkdir -p /Users/sam/Sites/lighttpd/root /Users/sam/Sites/lighttpd/logs</p>
<p>$ sudo chgown -R www:www /Users/sam/Sites/lighttpd/logs</p>
<p>Now we are ready to test our config file with this command (-t signifies test and -f tells lighttpd which config file to use)</p>
<p>$ /opt/local/sbin/lighttpd -t -f /opt/local/etc/lighttpd/lighttpd.conf</p>
<p>If all is well, you should see “Syntax OK”. If not, google your error or look at the docs for lighttpd<br />Step 4: Start lighttpd.</p>
<p>From the terminal issue</p>
<p>$ sudo /opt/local/sbin/lighttpd -f /opt/local/etc/lighttpd/lighttpd.conf</p>
<p>Now place a test php file in your lighttpd web-root (/Users/sam/Sites/lighttpd/root/index.php in my case) and put these lines in it.</p>
<p>Save the file and then open abrowser and go to http://localhost:8181/index.php and you should see something like</p>
<p>php-fcgi.png</p>
<p>Ths important thing here is that you go to localhost:8181 (not localhost or localhost:80). The nice thing is, if you already had PHP/Apache installed, you can still use that on whatever local URL you had setup (i.e. http://localhost)</p>
<p>So welcome to lighttpd. There is a vast amount on lighttpd that was not covered here, so be sure to check out the lighttpd site for more details.</p>
]]></content:encoded>
			<wfw:commentRss>http://wiffu.com/running-php5-fast-cgi-with-lighttpd-on-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
