<?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>david winter &#187; imagick</title>
	<atom:link href="http://davidwinter.me.uk/articles/tag/imagick/feed/" rel="self" type="application/rss+xml" />
	<link>http://davidwinter.me.uk</link>
	<description>you were expecting someone else?</description>
	<lastBuildDate>Mon, 28 Jun 2010 20:37:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Quick lighttpd, PHP, iMagick setup on Ubuntu 8.10 Intrepid</title>
		<link>http://davidwinter.me.uk/articles/2009/01/17/quick-lighttpd-php-imagick-setup-on-ubuntu-810-intrepid/</link>
		<comments>http://davidwinter.me.uk/articles/2009/01/17/quick-lighttpd-php-imagick-setup-on-ubuntu-810-intrepid/#comments</comments>
		<pubDate>Sat, 17 Jan 2009 17:17:14 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[imagick]]></category>
		<category><![CDATA[lighttpd]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://davidwinter.me.uk/articles/2009/01/17/quick-lighttpd-php-imagick-setup-on-ubuntu-810-intrepid/</guid>
		<description><![CDATA[Install lighttpd: sudo aptitude install lighttpd Install PHP and ImageMagick: sudo aptitude install php5-common php5-dev php5-mysql php5-sqlite php5-cgi php5-curl php5-gd php-pear libmagick9-dev Install iMagick: sudo pecl install imagick Press enter on prompt. Add the following to the bottom of /etc/php5/cgi/php.ini: extension=imagick.so Then: sudo lighttpd-enable-mod fastcgi sudo /etc/init.d/lighttpd reload]]></description>
			<content:encoded><![CDATA[<p>Install <code>lighttpd</code>:</p>

<pre><code>sudo aptitude install lighttpd
</code></pre>

<p>Install <code>PHP</code> and <code>ImageMagick</code>:</p>

<pre><code>sudo aptitude install php5-common php5-dev php5-mysql php5-sqlite php5-cgi php5-curl php5-gd php-pear libmagick9-dev
</code></pre>

<p>Install <code>iMagick</code>:</p>

<pre><code>sudo pecl install imagick
</code></pre>

<p>Press enter on prompt.</p>

<p>Add the following to the bottom of <code>/etc/php5/cgi/php.ini</code>:</p>

<pre><code>extension=imagick.so
</code></pre>

<p>Then:</p>

<pre><code>sudo lighttpd-enable-mod fastcgi
sudo /etc/init.d/lighttpd reload
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://davidwinter.me.uk/articles/2009/01/17/quick-lighttpd-php-imagick-setup-on-ubuntu-810-intrepid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install PHP5, lighttpd and Imagick on Mac OS X Leopard</title>
		<link>http://davidwinter.me.uk/articles/2008/11/22/php5-lighttpd-and-imagick-on-mac-os-x-leopard/</link>
		<comments>http://davidwinter.me.uk/articles/2008/11/22/php5-lighttpd-and-imagick-on-mac-os-x-leopard/#comments</comments>
		<pubDate>Sat, 22 Nov 2008 19:51:23 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[imagick]]></category>
		<category><![CDATA[lighttpd]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://davidwinter.me.uk/?p=101</guid>
		<description><![CDATA[It&#8217;s a little tricky getting a nice clean install of PHP5 for OS X 10.5. The packages that I always used to depend on over at Entropy don&#8217;t seem to work anymore. At least not for Leopard. A great shame. I&#8217;m now switching to lighttpd for my development server, so have come up with the [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s a little tricky getting a nice clean install of <a href="http://www.php.net">PHP5</a> for OS X 10.5. The packages that I always used to depend on over at <a href="http://www.entropy.ch/software/macosx/php/">Entropy</a> don&#8217;t seem to work anymore. At least not for Leopard. A great shame.</p>

<p>I&#8217;m now switching to <a href="http://www.lighttpd.net">lighttpd</a> for my development server, so have come up with the following recipe to install PHP5 and the great <a href="http://www.php.net/imagick">Imagick</a> extension for image manipulation.</p>

<p><span id="more-101"></span></p>

<p>Follow these instructions at your own risk! They worked fine on my setup but I can&#8217;t guarantee they will for you.</p>

<ol>
<li>Install <a href="http://developer.apple.com/technology/xcode.html">Xcode</a>.</li>
<li>Install <a href="http://www.macports.org/">MacPorts</a>.</li>
<li><p>Now update MacPorts:</p>

<pre><code>sudo port selfupdate
</code></pre></li>
<li><p>Install lighttpd:</p>

<pre><code>sudo port install lighttpd
</code></pre>

<p>Install the startup item and copy the default configuration file:</p>

<pre><code>sudo launchctl load -w /Library/LaunchDaemons/org.macports.lighttpd.plist
sudo cp /opt/local/etc/lighttpd/lighttpd.conf.default /opt/local/etc/lighttpd/lighttpd.conf
</code></pre></li>
<li><p>Now we install PHP with the FastCGI, MySQL and Pear variants.</p>

<pre><code>sudo port install php5 +fastcgi +mysql5 +pear
</code></pre>

<p>In order for this to work, I had to disable the port <code>perl5.8</code> by using the following command:</p>

<pre><code>sudo port deactivate perl5.8
sudo port activate perl5
</code></pre>

<p>Then run the command again and it should succeed:</p>

<pre><code>sudo port install php5 +fastcgi +mysql5 +pear
</code></pre></li>
<li><p>Copy over the default PHP configuration:</p>

<pre><code>sudo cp /opt/local/etc/php.ini-dist /opt/local/etc/php.ini
</code></pre></li>
<li><p>Now open up the PHP configuration file:</p>

<pre><code>sudo mate /opt/local/etc/php.ini
</code></pre>

<p>Add the following line to the file:</p>

<pre><code>cgi.fix_pathinfo=1
</code></pre>

<p>Find <code>extension_dir = "./"</code> and replace it with:</p>

<pre><code>extension_dir = "/opt/local/lib/php/extensions"
extension=imagick.so
</code></pre></li>
<li><p>Edit the lighttpd configuration file:</p>

<pre><code>sudo mate /opt/local/etc/lighttpd/lighttpd.conf
</code></pre>

<p>Ensure that the following is uncommented:</p>

<pre><code>fastcgi.server = ( ".php" =&gt;
    ( "localhost" =&gt;
        (
            "socket" =&gt; "/var/run/lighttpd/php-fastcgi.socket",
            "bin-path" =&gt; "/opt/local/bin/php-cgi"
        )
    )
)
</code></pre>

<p>And also make lighttpd run as the user <code>www</code>:</p>

<pre><code>server.username = "www"
server.groupname = "www"
</code></pre>

<p>Add the following if you want to be able to use your <code>Sites</code> directory in your home directory. I also changed the default document root to the OS X default:</p>

<pre><code>server.modules += ("mod_userdir")
userdir.path = "Sites"
userdir.basepath = "/Users/"
server.document-root = "/Library/WebServer/Documents"
</code></pre>

<p>Ensure that <code>"mod_fastcgi",</code> is uncommented.</p></li>
<li><p>Now we need to setup a few directories, and make the user <code>www</code> the owner for them:</p>

<pre><code>sudo mkdir /var/run/lighttpd
sudo mkdir /var/log/lighttpd
sudo chown www:www /var/run/lighttpd
sudo chown www:www /var/log/lighttpd
</code></pre></li>
<li><p>Now install ImageMagick:</p>

<pre><code>sudo port install imagemagick
</code></pre></li>
<li><p>Now we need to download the Imagick PHP module. I was hoping this would be as easy as <code>sudo pecl install imagick</code>, however I got an error for that, and so a manual build and install of the module is necessary:</p>

<pre><code>curl -O http://pecl.php.net/get/imagick-2.2.1.tgz
tar xvfz imagick-2.2.1.tgz
cd imagick-2.2.1/
phpize
./configure --with-imagick=/opt/local
make
sudo make install
sudo cp /opt/local/lib/php/extensions/no-debug-non-zts-20060613/imagick.so /opt/local/lib/php/extensions
</code></pre></li>
</ol>

<p>And finally, you can then run LightTPD with the following. The <code>-D</code> flag tells lighttpd not to run in the background&#8211;you don&#8217;t need to use it:</p>

<pre><code>lighttpd -f /opt/local/etc/lighttpd/lighttpd.conf -D
</code></pre>

<p>You should then be able to visit a PHP file in your browser to test that it works. A simple test file would be:</p>

<pre><code>&lt;?php
$img = new Imagick('pic.jpg');
$img-&gt;rotateImage('#fff', 45);
header('Content-type: image/jpeg');
echo $img;
?&gt;
</code></pre>

<p>This is just a simple Imagick rotate on an image.</p>
]]></content:encoded>
			<wfw:commentRss>http://davidwinter.me.uk/articles/2008/11/22/php5-lighttpd-and-imagick-on-mac-os-x-leopard/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>
