<?xml version="1.0" encoding="utf-8"?>
			
			<rss version="2.0">
			<channel>
			<title>Andrew Schwabe&apos;s Blog - PHP</title>
			<link>http://blog.schwabe.net/index.cfm</link>
			<description>Flex and CF and all things Wack.</description>
			<language>en-us</language>
			<pubDate>Wed, 08 Sep 2010 09:44:24 -0400</pubDate>
			<lastBuildDate>Mon, 24 Aug 2009 22:40:00 -0400</lastBuildDate>
			<generator>BlogCFC</generator>
			<docs>http://blogs.law.harvard.edu/tech/rss</docs>
			<managingEditor>aschwabe@schwabe.net</managingEditor>
			<webMaster>aschwabe@schwabe.net</webMaster>
			
			
			
			
			
			<item>
				<title>Upgrading CentOS 4 or RHEL 4 to use PHP5</title>
				<link>http://blog.schwabe.net/index.cfm/2009/8/24/Upgrading-CentOS-4-or-RHEL-4-to-use-PHP5</link>
				<description>
				
				This seemingly simple task was more work than I expected.  Here are some of my notes in the hopes that this helps somebody.  If it does, and you want to donate to my cause, or just encourage me to keep blogging about stuff like this, email me :)

Ok, there are a bunch of sites out there, that helped me get 75% of the way.  Download the RPMs, try to install, and error, dependancies i&apos;ve never seen before.

This tutorial got me 75% of the way:

http://www.lampdeveloper.co.uk/linux/installing-php-525-suhosin-php-eaccelerator-on-centos-4-with-yum.html

(By the way centos 4 and RHEL4 are pretty much the same, but this is focusing on the specifics for RHEL4)

All said and done, here are the RPMs I ended up needing (to get to 90% success)

&lt;ul&gt;
&lt;li&gt;php-5.1.6-3.el4s1.10.i386.rpm&lt;/li&gt;
&lt;li&gt;php-cli-5.1.6-3.el4s1.10.i386.rpm
&lt;li&gt;php-common-5.1.6-3.el4s1.10.i386.rpm
&lt;li&gt;php-gd-5.1.6-3.el4s1.10.i386.rpm
&lt;li&gt;php-ldap-5.1.6-3.el4s1.10.i386.rpm
&lt;li&gt;php-mysql-5.1.6-3.el4s1.10.i386.rpm
&lt;li&gt;php-pdo-5.1.6-3.el4s1.10.i386.rpm
&lt;li&gt;php-pear-1.4.11-1.el4s1.1.noarch.rpm
&lt;/ul&gt;

FYI Don&apos;t be daft and ask me for download links, if you need to know where to download these, google for it, took me all of 3 minutes.  Some of them came from all over.

Now when you try to install these, you get the dreaded dependancy error:

Needs libmysqlclient.so.15

So i went searching, and ended up finding this gem:

MySQL-shared-compat-6.0.10-0.rhel4.i386.rpm

which installs multiple mysql version libraries.  That did the trick, and a simple &quot;rpm -U *.rpm&quot; &gt;&gt; success

cheers
				
				</description>
						
				
				<category>PHP</category>				
				
				<category>Open Source</category>				
				
				<category>Rants</category>				
				
				<category>Linux</category>				
				
				<pubDate>Mon, 24 Aug 2009 22:40:00 -0400</pubDate>
				<guid>http://blog.schwabe.net/index.cfm/2009/8/24/Upgrading-CentOS-4-or-RHEL-4-to-use-PHP5</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Aptana Studio Released!</title>
				<link>http://blog.schwabe.net/index.cfm/2007/11/5/Aptana-Studio-Released</link>
				<description>
				
				&lt;p&gt;I am truly impressed with what this group has brought to the development community.&amp;nbsp; Long ago I loved a code editor called &amp;quot;HomeSite+&amp;quot; which existed in several interesting flavors, ColdFusion Studio (i think?), and JRun Studio were two other flavors I remember.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;Then came the Dreamweaver shift...&amp;nbsp; I never really got on that bandwagon.&amp;nbsp; I resisted for a LONG time, then I tried it out, and just never really was thrilled with it.&amp;nbsp; I am a coder at heart.&lt;/p&gt;
&lt;p&gt;Then came Eclipse.&amp;nbsp; Great concept, just not for the masses.&amp;nbsp; Then came Eclipse 3, and then CFEclipse... then came Flex Builder and the RDS plugins, all good still, but not thrilling.&lt;/p&gt;
&lt;p&gt;HomeSite was great at letting you develop remotely.&amp;nbsp; Thats a big no-no in the software world now, but for web developers it is a big deal.&amp;nbsp; You don&apos;t always have _everything_ you need running on your laptop!&lt;/p&gt;
&lt;p&gt;Anyway, I got off track.&amp;nbsp; After all these tools, finally comes an attempt to bring it all together: Aptana Studio.&amp;nbsp; In its development stage as Aptana IDE, I fell in love with it (well, with MOST of it anyway...).&amp;nbsp; It all runs on Eclipse, and gives the basic developer everything he or she needs to code html, php, javascript, xml, css, etc.&amp;nbsp; All the things that were either missing, or painfully buggy or incomplete in Eclipse.&amp;nbsp; Not to mention an FTP (and secure FTP) system that actually works!&amp;nbsp; And you can create new empty files on remote ftp servers too (a lot of us have been waiting for this feature for a while).&lt;/p&gt;
&lt;p&gt;I can now safely say that I have found my HomeSite+ replacement :)&lt;/p&gt;
&lt;p&gt;Download it,&amp;nbsp;you know you want to: &lt;font face=&quot;Arial&quot;&gt;&lt;a href=&quot;http://www.aptana.com&quot;&gt;http://www.aptana.com/&lt;/a&gt;&lt;/font&gt; (its free)&lt;/p&gt;
&lt;p&gt;FYI, Aptana&amp;nbsp; was founded by Paul Colton, formerly of Allair.&amp;nbsp; If you can remember back that far, Allair was the company that originally built ColdFusion, before it was bought by Macromedia (and subsequently by Adobe).&lt;/p&gt;
				
				</description>
						
				
				<category>Adobe Flex</category>				
				
				<category>PHP</category>				
				
				<category>Open Source</category>				
				
				<category>Eclipse</category>				
				
				<category>ColdFusion</category>				
				
				<pubDate>Mon, 05 Nov 2007 18:01:00 -0400</pubDate>
				<guid>http://blog.schwabe.net/index.cfm/2007/11/5/Aptana-Studio-Released</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Image gallery in 5 minutes using ColdFusion and PHP</title>
				<link>http://blog.schwabe.net/index.cfm/2005/8/7/Image-gallery-in-5-minutes-using-ColdFusion-and-PHP</link>
				<description>
				
				&lt;p&gt;Ok, here&apos;s the scoop:&amp;nbsp; I needed a way to show thumbnails for some photos and I didn&apos;t want to spend any more than 15 minutes to do it.&amp;nbsp; Talk about deadline, huh?&amp;nbsp; Anyway, here is what I came up with, and yep, I managed to throw it together in [about] 15 minutes.&amp;nbsp; You get to copy my code and implement it in &lt;strong&gt;5 minutes&lt;/strong&gt;, hence the subject.&lt;/p&gt;
&lt;p&gt;Overview:&amp;nbsp; This is running on a LINUX server running&amp;nbsp;apache, with a modern PHP and ColdFusion 6.1.&amp;nbsp; Your server may not have the same specs, so this code won&apos;t work.&amp;nbsp; If so, sorry it didn&apos;t work out.&lt;/p&gt;
&lt;p&gt;This solution is to create a directory with images in it (jpegs for example).&amp;nbsp; To make it a gallery, we throw in an &lt;strong&gt;index.cfm&lt;/strong&gt; page that uses &amp;lt;cfdirectory&amp;gt; to get a list of images to display.&amp;nbsp; We then loop through the listing, and for each image, generate a link and thumbnail using a nifty php script.&amp;nbsp; The php script creates a thumbnail on the fly and stores it in a subdir, and then displays it.&amp;nbsp; Cool, huh?&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;WARNING:&lt;/strong&gt; This solution is not pretty-looking.&amp;nbsp; Thats something you can do with your precious &amp;quot;more than 15 minutes&amp;quot; allocated time slot.&lt;/p&gt;
&lt;p&gt;Alright, here&apos;s the code:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;index.cfm:&lt;/strong&gt;&lt;br /&gt;
&lt;/p&gt;
&lt;blockquote dir=&quot;ltr&quot; style=&quot;MARGIN-RIGHT: 0px&quot;&gt;
&lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;lt;!DOCTYPE HTML PUBLIC &amp;quot;-//W3C//DTD HTML 4.01 Transitional//EN&amp;quot;&amp;gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;title&amp;gt;Image Index&amp;lt;/title&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;lt;body style=&amp;quot;font-family:sans-serif; font-size:9pt;&amp;quot;&amp;gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;lt;cfdirectory name=&amp;quot;proof_files&amp;quot; action=&amp;quot;LIST&amp;quot; directory=&amp;quot;#ExpandPath(&amp;quot;.&amp;quot;)#&amp;quot;&amp;gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;lt;cfset cols=&amp;quot;3&amp;quot;&amp;gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;lt;strong&amp;gt;Files by name:&amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;cfset idx = -1&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;cfloop query=&amp;quot;proof_files&amp;quot;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;cfif (Name contains &amp;quot;.jpg&amp;quot;)&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;cfset idx = idx + 1&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;cfif (idx mod cols) IS 0&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;/cfif&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;cfoutput&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;td&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;a href=&amp;quot;#proof_files.name#&amp;quot;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;img src=&amp;quot;resize.php?main_file=#proof_files.name#&amp;quot;&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #proof_files.name#&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/cfoutput&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/cfif&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/cfloop&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;/font&gt;&lt;br /&gt;
&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p dir=&quot;ltr&quot;&gt;&lt;strong&gt;resize.php:&lt;/strong&gt;&lt;br /&gt;
&lt;/p&gt;
&lt;blockquote dir=&quot;ltr&quot; style=&quot;MARGIN-RIGHT: 0px&quot;&gt;
&lt;p dir=&quot;ltr&quot;&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;lt;?php&lt;/font&gt;&lt;/p&gt;
&lt;p dir=&quot;ltr&quot;&gt;&lt;font face=&quot;Courier New&quot;&gt;$image = &amp;quot;./&amp;quot; . $_GET[&apos;main_file&apos;];&lt;br /&gt;
$savelocation = &amp;quot;./thumbs/&amp;quot;;&lt;/font&gt;&lt;/p&gt;
&lt;p dir=&quot;ltr&quot;&gt;&lt;font face=&quot;Courier New&quot;&gt;if(!file_exists(&amp;quot;$savelocation&amp;quot;))&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; $oldumask = umask(0);&lt;br /&gt;
&amp;nbsp; mkdir(&amp;quot;$savelocation&amp;quot;, 0777);&lt;br /&gt;
&amp;nbsp; umask($oldumask);&lt;br /&gt;
}&lt;/font&gt;&lt;/p&gt;
&lt;p dir=&quot;ltr&quot;&gt;&lt;font face=&quot;Courier New&quot;&gt;if (file_exists($savelocation . &amp;quot;thumb_&amp;quot; . $_GET[&apos;main_file&apos;]))&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; header(&apos;Location: thumbs/thumb_&apos; . $_GET[&apos;main_file&apos;] );&lt;br /&gt;
&amp;nbsp; exit();&lt;br /&gt;
}&lt;/font&gt;&lt;/p&gt;
&lt;p dir=&quot;ltr&quot;&gt;&lt;font face=&quot;Courier New&quot;&gt;if (!$max_width)&lt;br /&gt;
&amp;nbsp; $max_width = 125;&lt;br /&gt;
if (!$max_height)&lt;br /&gt;
&amp;nbsp; $max_height = 125;&lt;br /&gt;
$size = GetImageSize($image);&lt;br /&gt;
$width = $size[0];&lt;br /&gt;
$height = $size[1];&lt;br /&gt;
$x_ratio = $max_width / $width;&lt;br /&gt;
$y_ratio = $max_height / $height;&lt;br /&gt;
if ( ($width &amp;lt;= $max_width) &amp;amp;&amp;amp; ($height &amp;lt;= $max_height) ) {&lt;br /&gt;
&amp;nbsp; $tn_width = $width;&lt;br /&gt;
&amp;nbsp; $tn_height = $height;&lt;br /&gt;
}&lt;br /&gt;
else if (($x_ratio * $height) &amp;lt; $max_height) {&lt;br /&gt;
&amp;nbsp; $tn_height = ceil($x_ratio * $height);&lt;br /&gt;
&amp;nbsp; $tn_width = $max_width;&lt;br /&gt;
}&lt;br /&gt;
else {&lt;br /&gt;
&amp;nbsp; $tn_width = ceil($y_ratio * $width);&lt;br /&gt;
&amp;nbsp; $tn_height = $max_height;&lt;br /&gt;
}&lt;br /&gt;
$src = ImageCreateFromJpeg($image);&lt;br /&gt;
$dst = ImageCreate($tn_width,$tn_height);&lt;br /&gt;
ImageCopyResized($dst, $src, 0, 0, 0, 0,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; $tn_width,$tn_height,$width,$height);&lt;br /&gt;
ImageJpeg($dst,&amp;quot;$savelocation&amp;quot;.&amp;quot;thumb_&amp;quot; . $_GET[&apos;main_file&apos;] );&lt;br /&gt;
ImageDestroy($src);&lt;br /&gt;
ImageDestroy($dst);&lt;/font&gt;&lt;/p&gt;
&lt;p dir=&quot;ltr&quot;&gt;&lt;font face=&quot;Courier New&quot;&gt;header(&apos;Location: thumbs/thumb_&apos; . $_GET[&apos;main_file&apos;] );&lt;br /&gt;
?&amp;gt;&lt;/font&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p dir=&quot;ltr&quot;&gt;&lt;strong&gt;Directions:&lt;/strong&gt;&lt;/p&gt;
&lt;ol dir=&quot;ltr&quot; style=&quot;MARGIN-RIGHT: 0px&quot;&gt;
    &lt;ol dir=&quot;ltr&quot;&gt;
        &lt;li&gt;
        &lt;div&gt;Make a directory on your web server&lt;/div&gt;
        &lt;/li&gt;
        &lt;li&gt;
        &lt;div&gt;Upload some jpg&apos;s in the new folder&lt;/div&gt;
        &lt;/li&gt;
        &lt;li&gt;
        &lt;div&gt;Copy index.cfm and resize.php into the same directory&lt;/div&gt;
        &lt;/li&gt;
        &lt;li&gt;
        &lt;div&gt;Open a web browser and check it out&lt;/div&gt;
        &lt;/li&gt;
    &lt;/ol&gt;
&lt;/ol&gt;
&lt;p dir=&quot;ltr&quot;&gt;&lt;strong&gt;Gotchas:&lt;/strong&gt;&lt;/p&gt;
&lt;blockquote dir=&quot;ltr&quot; style=&quot;MARGIN-RIGHT: 0px&quot;&gt;
&lt;p dir=&quot;ltr&quot;&gt;The first time I ran the php script, it choked on memory because PHP has a maximum amount of memory that a script request can use.&amp;nbsp; I had to increase this limit for it to load larger images.&amp;nbsp; The setting was in /etc/php.ini and looked like so:&lt;/p&gt;
&lt;p dir=&quot;ltr&quot;&gt;memory_limit = 32M&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Maximum amount of memory a script may consume (default = 8MB)&lt;/p&gt;
&lt;p dir=&quot;ltr&quot;&gt;Also, the color palletes of the thumbnails leave a little to be desired.&amp;nbsp; Oh well, at least it worked and we didnt waste too much time.&lt;/p&gt;
&lt;p dir=&quot;ltr&quot;&gt;This script can bog down the server if you are generating a lot of thumbnails at once, &amp;nbsp;however the &lt;strong&gt;resize.php&lt;/strong&gt; script does check to see if a thumbnail has been generated before, and if so, does not generate another one, so the overhead you experience should only be the first time a thumbnail is generated for a new image.&lt;/p&gt;
&lt;/blockquote&gt;
				
				</description>
						
				
				<category>PHP</category>				
				
				<category>ColdFusion</category>				
				
				<pubDate>Sun, 07 Aug 2005 02:00:00 -0400</pubDate>
				<guid>http://blog.schwabe.net/index.cfm/2005/8/7/Image-gallery-in-5-minutes-using-ColdFusion-and-PHP</guid>
				
			</item>
			
		 	
			</channel></rss>