<?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>Chris JeanChris Jean</title>
	<atom:link href="http://chrisjean.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://chrisjean.com</link>
	<description>Linux, WordPress, programming, anime, and other stuff</description>
	<lastBuildDate>Tue, 08 May 2012 20:36:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Some Great AMVs from 2011</title>
		<link>http://chrisjean.com/2012/01/10/some-great-amvs-from-2011/</link>
		<comments>http://chrisjean.com/2012/01/10/some-great-amvs-from-2011/#comments</comments>
		<pubDate>Tue, 10 Jan 2012 23:45:21 +0000</pubDate>
		<dc:creator>Chris Jean</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://chrisjean.com/?p=1996</guid>
		<description><![CDATA[In celebration of my newly-operational Minitube, I thought I would share some great AMVs from 2011 that I found thanks to Minitube. Unfortunately, one of my favorite AMVs in a long time is no longer on Youtube. You can find it here on AnimeMusicVideos.org. It&#8217;s responsible for getting me into Puella Magi Madoka Magica. You [...]]]></description>
			<content:encoded><![CDATA[<!-- filtered -->
<p>In celebration of my <a title="Fix: Minitube Doesn’t Play Videos in Ubuntu" href="http://chrisjean.com/2012/01/10/fix-minitube-doesnt-play-videos-in-ubuntu/">newly-operational Minitube</a>, I thought I would share some great AMVs from 2011 that I found thanks to <a href="http://flavio.tordini.org/minitube">Minitube</a>.</p>
<p>Unfortunately, one of my favorite AMVs in a long time is no longer on Youtube. You can find it <a href="http://www.animemusicvideos.org/members/members_videoinfo.php?v=184094">here</a> on <a href="http://www.animemusicvideos.org/">AnimeMusicVideos.org</a>. It&#8217;s responsible for getting me into <a href="http://en.wikipedia.org/wiki/Puella_Magi_Madoka_Magica">Puella Magi Madoka Magica</a>. You should definitely check it out.</p>
<p>This next one probably can only be viewed on Youtube proper. It uses video from <a href="http://www.animenewsnetwork.com/encyclopedia/anime.php?id=8192">ef &#8211; A Tale of Memories, a show that I&#8217;ve been meaning to watch. This video has definitely pushed it higher on my list.</a></p>
<p><iframe src="http://www.youtube.com/embed/wtcjhgaZ-hE?hd=1" frameborder="0" width="957" height="564"></iframe></p>
<p><span id="more-1996"></span></p>
<p><iframe src="http://www.youtube.com/embed/Hz7PbMA4nQs?hd=1" frameborder="0" width="957" height="564"></iframe></p>
<p><iframe src="http://www.youtube.com/embed/DibWkZCn8Ek?hd=1" frameborder="0" width="957" height="564"></iframe></p>
<p><iframe src="http://www.youtube.com/embed/7Bv6nC9Yk6s?hd=1" frameborder="0" width="957" height="742"></iframe></p>
<p><iframe src="http://www.youtube.com/embed/aFoHsFw1P8k?hd=1" frameborder="0" width="957" height="564"></iframe></p>
<p><iframe src="http://www.youtube.com/embed/ORjKVwVtvP0?hd=1" frameborder="0" width="957" height="564"></iframe></p>
<p><iframe src="http://www.youtube.com/embed/pvY9t9BL7Cg?hd=1" frameborder="0" width="957" height="564"></iframe></p>
<p><iframe src="http://www.youtube.com/embed/Z0-GR9Y2zKQ?hd=1" frameborder="0" width="957" height="564"></iframe></p>
<p><iframe src="http://www.youtube.com/embed/Oc2Y1BU2N4A?hd=1" frameborder="0" width="957" height="564"></iframe></p>
<p><iframe src="http://www.youtube.com/embed/X4y6kAF0uVU?hd=1" frameborder="0" width="957" height="564"></iframe></p>
<p><iframe src="http://www.youtube.com/embed/T7V2yU3Pk_o?hd=1" frameborder="0" width="957" height="564"></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://chrisjean.com/2012/01/10/some-great-amvs-from-2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fix: Minitube Doesn&#8217;t Play Videos in Ubuntu</title>
		<link>http://chrisjean.com/2012/01/10/fix-minitube-doesnt-play-videos-in-ubuntu/</link>
		<comments>http://chrisjean.com/2012/01/10/fix-minitube-doesnt-play-videos-in-ubuntu/#comments</comments>
		<pubDate>Tue, 10 Jan 2012 23:27:24 +0000</pubDate>
		<dc:creator>Chris Jean</dc:creator>
				<category><![CDATA[Tips 'n Tricks]]></category>

		<guid isPermaLink="false">http://chrisjean.com/?p=1991</guid>
		<description><![CDATA[I&#8217;ve been a huge fan of Minitube. I use it nearly every work day to run interesting videos to give me a nice sound backdrop to work by. Mostly, I find myself playing AMVs, but I also enjoy just typing in random stuff to see what it starts playing. However, a few weeks ago, it [...]]]></description>
			<content:encoded><![CDATA[<!-- filtered -->
<p>I&#8217;ve been a huge fan of <a href="http://flavio.tordini.org/minitube">Minitube</a>. I use it nearly every work day to run interesting videos to give me a nice sound backdrop to work by. Mostly, I find myself playing <a href="http://en.wikipedia.org/wiki/Anime_music_video">AMVs</a>, but I also enjoy just typing in random stuff to see what it starts playing.</p>
<p>However, a few weeks ago, it just suddenly stopped working. I was sad, but there was a lot of stuff going on, so I just left it broken. Today, I found the fix.</p>
<p>On <a href="http://flavio.tordini.org/minitube/minitube-linux-setup">Minitube&#8217;s install page</a>, Flavio mentions removing the <code>phonon-backend-xine</code> package as a possible solution. I tried it, and it worked. <strike>Given that I don&#8217;t know what other software may rely on this, I tried reinstalling the package, and Minitube still worked.</strike> After rebooting, I found that it no longer worked again, so it seems that the package does need to stay removed. I&#8217;ve updated the following to only show removing the package.</p>
<p>Here&#8217;s how you can do what I did.</p>
<pre class="terminal"><span style="color:#8FED99;">[<span style="color:#BBFF33;">gaarai@tenshi</span> <span style="color:#729FCF;">~/src</span>]$</span> <span style="color:#FFF;">sudo apt-get purge phonon-backend-xine</span>
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  phonon-backend-xine*
0 upgraded, 0 newly installed, 1 to remove and 1 not upgraded.
After this operation, 651kB disk space will be freed.
Do you want to continue [Y/n]?
(Reading database ... 285104 files and directories currently installed.)
Removing phonon-backend-xine ...
<span style="color:#8FED99;">[<span style="color:#BBFF33;">gaarai@tenshi</span> <span style="color:#729FCF;">~/src</span>]$</span> <span style="color:#FFF;"></span></pre>
<p>Hopefully, you&#8217;ll be fast on your way to enjoying a fully-functional Minitube once again. If this doesn&#8217;t fix your issue, Minitube now has a <a href="http://flavio.tordini.org/forums/forum/minitube-forums">forum</a> that could help you out.</p>
<p>Good luck and happy Minitubing.</p>
]]></content:encoded>
			<wfw:commentRss>http://chrisjean.com/2012/01/10/fix-minitube-doesnt-play-videos-in-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MikuMikuDance + Moymoy Palaboy = Awesome Video</title>
		<link>http://chrisjean.com/2011/09/14/mikumikudance-moymoy-palaboy-awesome-video/</link>
		<comments>http://chrisjean.com/2011/09/14/mikumikudance-moymoy-palaboy-awesome-video/#comments</comments>
		<pubDate>Wed, 14 Sep 2011 20:32:20 +0000</pubDate>
		<dc:creator>Chris Jean</dc:creator>
				<category><![CDATA[Videos]]></category>
		<category><![CDATA[MikuMikuDance]]></category>
		<category><![CDATA[Moymoy Palaboy]]></category>

		<guid isPermaLink="false">http://chrisjean.com/?p=1982</guid>
		<description><![CDATA[I haven&#8217;t posted a cool video in a while, and I really need to start again as I keep losing track of awesome videos. Someone took the Moymoy Palaboy (a Filipino duo that do awesome lipsync videos) guys singing the Backstreet Boys song Everybody and used MikuMikuDance to recreate the guys doing the lipsync as [...]]]></description>
			<content:encoded><![CDATA[<!-- filtered -->
<p>I haven&#8217;t posted a cool video in a while, and I really need to start again as I keep losing track of awesome videos.</p>
<p><object width="957" height="538"><param name="movie" value="http://www.youtube.com/v/Wexpfb9O0lg?version=3"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/Wexpfb9O0lg?version=3" type="application/x-shockwave-flash" width="957" height="538" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p><a title="【MMD】 「顔芸担当」 × 「エアボ兄弟」 でEVERYBODY 【オリジナル】" href="http://www.nicovideo.jp/watch/sm15360019">Someone</a> took the <a href="http://www.moymoypalaboy.com.ph/">Moymoy Palaboy</a> (a Filipino duo that do awesome lipsync videos) guys singing the Backstreet Boys song <a href="http://en.wikipedia.org/wiki/Everybody_%28Backstreet%27s_Back%29">Everybody</a> and used <a href="http://en.wikipedia.org/wiki/MikuMikuDance">MikuMikuDance</a> to recreate the guys doing the lipsync as cute anime-style girls. So many awesome things in a mere minute and a half.</p>
<p>It&#8217;s definitely my new favorite video.</p>
]]></content:encoded>
			<wfw:commentRss>http://chrisjean.com/2011/09/14/mikumikudance-moymoy-palaboy-awesome-video/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating a PHP ICO Creator for Favicons</title>
		<link>http://chrisjean.com/2011/07/21/creating-a-php-ico-creator-for-favicons/</link>
		<comments>http://chrisjean.com/2011/07/21/creating-a-php-ico-creator-for-favicons/#comments</comments>
		<pubDate>Thu, 21 Jul 2011 15:15:58 +0000</pubDate>
		<dc:creator>Chris Jean</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[favicon]]></category>
		<category><![CDATA[ICO]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://chrisjean.com/?p=1965</guid>
		<description><![CDATA[For the past couple of weeks, I have worked on creating a PHP library to create ICO files. This has been difficult as all the documentation for the ICO format is either sparse or not completely documented. I&#8217;m doing this since I have yet to find a way of creating a valid favicon file using [...]]]></description>
			<content:encoded><![CDATA[<!-- filtered -->
<p>For the past couple of weeks, I have worked on creating a PHP library to create ICO files. This has been difficult as all the documentation for the ICO format is either sparse or not completely documented.</p>
<p>I&#8217;m doing this since I have yet to find a way of creating a valid favicon file using just PHP and PHP&#8217;s GD library. Sure, I can create a PNG file and change the extension to &#8220;.ico&#8221;, but that doesn&#8217;t work in all browsers, on all operating systems (such as Windows XP), and is more of a hack than a valid method for creating favicon files.</p>
<p>So, it is time to make one. I have a placeholder github repository named <a title="GitHub Repository - PHP ICO" href="https://github.com/chrisbliss18/php-ico">php-ico</a>.</p>
<p>The primary goal is to make a robust, reliable library that creates valid ICO files that can be properly rendered on Windows XP+ and all the major browsers. Thus, my initial goal is not to support every format that exists nor is it to support parsing the ICO files. If the project gets enough attention, I&#8217;ll look at expanding the scope.</p>
<p>Here are the resources that I&#8217;ve found helpful as I&#8217;ve worked on this project:</p>
<ul>
<li><a title="Wikipedia - ICO (File Format)" href="http://en.wikipedia.org/wiki/ICO_%28file_format%29">ICO (file format)</a> &#8211; Wikipedia article about the ICO file format. This has a very comprehensive description of the ICO header. It is sparse on details about the format of the image data.</li>
<li><a title="Wikipedia - BMP file format" href="http://en.wikipedia.org/wiki/BMP_file_format">BMP file format</a> &#8211; Wikipedia article about the BMP file format. This helped me understand the headers and pixel data format for the BMP image data.</li>
<li><a title="Wikipedia - Portable Network Graphics" href="http://en.wikipedia.org/wiki/Portable_Network_Graphics">Portable Network Graphics</a> &#8211; Wikipedia article about the PNG file format. This gave me what I needed to know to identify PNG image data.</li>
<li><a title="Article - Windows Bitmap File Format" href="http://www.mediatel.lu/workshop/graphic/2D_fileformat/h_bmp.html">Windows Bitmap File Format</a> &#8211; Very good article that delves into more details about the BMP file format. The extra details about the different types of headers, compression methods, compression encoding, and examples were very helpful.</li>
<li><a title="Microsoft Developer Network Article - Icons" href="http://msdn.microsoft.com/en-us/library/ms997538.aspx">Icons</a> &#8211; A Microsoft Developer Network article from 1995 that provides the original ICO file format spec. While this is the most authoritative, I really didn&#8217;t find this to be as much help as other sources.</li>
<li><a title="The Code Project Article - Replacing ICON resources in EXE and DLL files" href="http://www.codeproject.com/KB/DLL/ICON_Resources.aspx?display=Mobile">Replacing ICON resources in EXE and DLL files</a> &#8211; Article from The Code Project that has a breakdown of the format similar to what is found in the MSDN article. Example C code is provided.</li>
<li><a title="Bugzilla@Mozilla - Bug 600556 - Support Vista-style ICO files" href="https://bugzilla.mozilla.org/show_bug.cgi?id=600556">Support Vista-style ICO files</a> &#8211; Mozilla Bugzilla filed bug. The discussion has some great information about methods used to reliably parse varying ICO formats and structures. It also has some good test ICO files to try.</li>
<li><a title="Chironex Software Post - Convert HBITMAP to .ICO file" href="http://chironexsoftware.com/blog/?p=13">Convert HBITMAP to .ICO file</a> &#8211; This Chironex Software blog post provided the last piece I needed: how to structure the opacity mask data. Where he found this information (since I didn&#8217;t find it in any of the above articles) I haven&#8217;t a clue.</li>
</ul>
<p>If this post gets some traction and interest, I&#8217;ll consider putting together a post detailing all the different pieces I&#8217;ve found here. I&#8217;m not a spec writer, but I&#8217;d try my best. Let me know if you&#8217;d like to have me work on this.</p>
]]></content:encoded>
			<wfw:commentRss>http://chrisjean.com/2011/07/21/creating-a-php-ico-creator-for-favicons/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrade PHP 5.1/5.2 to 5.3 on CentOS</title>
		<link>http://chrisjean.com/2011/06/24/upgrade-php-5-1-or-5-2-to-5-3-on-centos/</link>
		<comments>http://chrisjean.com/2011/06/24/upgrade-php-5-1-or-5-2-to-5-3-on-centos/#comments</comments>
		<pubDate>Sat, 25 Jun 2011 00:25:49 +0000</pubDate>
		<dc:creator>Chris Jean</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips 'n Tricks]]></category>

		<guid isPermaLink="false">http://chrisjean.com/?p=1942</guid>
		<description><![CDATA[I&#8217;m finding that more and more software developers are being quite inconsiderate and are making code that requires PHP 5.3. Since many server-based and long-term support distros are still on PHP 5.2, this can make things difficult quickly. I&#8217;ll share how I upgraded one of my servers, but I do need to let you know [...]]]></description>
			<content:encoded><![CDATA[<!-- filtered -->
<p>I&#8217;m finding that more and more software developers are being quite inconsiderate and are making code that requires PHP 5.3. Since many server-based and long-term support distros are still on PHP 5.2, this can make things difficult quickly.</p>
<p>I&#8217;ll share how I upgraded one of my servers, but I do need to let you know about some specifics about my setup as your setup may be different and require different steps to upgrade.</p>
<p>When I started, my system ran CentOS 5.5 and PHP 5.2.16. Now it is running CentOS 5.6 and PHP 5.3.3.</p>
<p>You won&#8217;t be able to follow these steps without root access, so that is definitely a requirement. I&#8217;m also running Apache. You may be using a different web server, but if you don&#8217;t know what I&#8217;m talking about, you are running Apache. I assume that if you run a different server, you will know what to change in my steps.</p>
<p><span id="more-1942"></span></p>
<h3 id="upgrade-centos">Upgrade CentOS 5.5 to CentOS 5.6</h3>
<p>I found that CentOS 5.6, released earlier this year, had package support for PHP 5.3. That made me very excited. I thought that all I needed to do was to upgrade my distro, and I would be done (I would later find that I was naïve).</p>
<p>Fortunately, upgrading CentOS is very easy. I simply ran the following command to spawn a huge amount of work for the server:</p>
<pre class="terminal"><span style="color:#8FED99;">[<span style="color:#BBFF33;">user@server</span> <span style="color:#729FCF;">~</span>]$</span> <span style="color:#FFF;">sudo yum update</span>
[sudo] password for user:
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
 * addons: mirrors.tummy.com
 * base: centos.mirror.lstn.net
 * epel: fedora-epel.mirror.lstn.net
 * extras: mirror.ubiquityservers.com
 * updates: mirror.steadfast.net
Setting up Update Process
Resolving Dependencies
--&gt; Running transaction check
---&gt; Package amtu.x86_64 0:1.0.6-2.el5 set to be updated
---&gt; Package asciidoc.noarch 0:8.6.5-1.el5.rf set to be updated
---&gt; Package audit.x86_64 0:1.7.18-2.el5 set to be updated

...

Install       5 Package(s)
Upgrade     208 Package(s)
Remove        2 Package(s)
Reinstall     0 Package(s)
Downgrade     0 Package(s)

Total download size: 309 M
Is this ok [y/N]: <span style="color: #fff;">y</span>
Downloading Packages:
(1/213): avahi-glib-0.6.16-10.el5_6.x86_64.rpm                                                                                                                                                                        |  15 kB     00:00
(2/213): avahi-glib-0.6.16-10.el5_6.i386.rpm                                                                                                                                                                          |  15 kB     00:00
(3/213): rng-utils-2.0-4.el5.x86_64.rpm                                                                                                                                                                               |  17 kB     00:00     

...

Complete!
<span style="color:#8FED99;">[<span style="color:#BBFF33;">user@server</span> <span style="color:#729FCF;">~</span>]$</span> <span style="color:#FFF;"></span></pre>
<p>Notice the white &#8220;y&#8221; toward the bottom. Before it does anything, you must answer its question with a &#8220;y&#8221;. Just hitting enter will cancel the upgrade.</p>
<p>This will take between 5-30 minutes on average depending on the number of packages to be upgraded, the speed of your system, and your servers connection speed. So pop open a root beer and wait for everything to finish up.</p>
<h3 id="reboot">Reboot the server</h3>
<p>Since this should have installed a new <a href="http://en.wikipedia.org/wiki/Kernel_%28computing%29">kernel</a> for your system, you will want to reboot so that this new kernel can be loaded.</p>
<p>Rebooting a server can be a scary thing. Make sure that you know how to contact your hosting company&#8217;s tech support in case there are any problems with connecting to the server after the reboot. Also make sure that you notify any people that may be upset about the reboot before you do it.</p>
<h3 id="upgrade-php">Upgrade PHP 5.2 to PHP 5.3</h3>
<p>I booted up my system and found that my PHP version was not upgraded:</p>
<pre class="terminal"><span style="color:#8FED99;">[<span style="color:#BBFF33;">user@server</span> <span style="color:#729FCF;">~</span>]$</span> <span style="color:#FFF;">php -v</span>
PHP 5.2.11 (cli) (built: Jan 17 2011 01:47:19)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies</pre>
<p>This version of CentOS took the odd step of having both PHP 5.2 and PHP 5.3 packages. The main packages are 5.2 while another set with modified names are 5.3. For instance, the PHP 5.2 main package is <code>php</code> while the PHP 5.3 one is <code>php53</code>.</p>
<p>I still have no idea why they decided to do things this way, but I guess it has to do with some software not supporting 5.3 properly yet.</p>
<p>Since I couldn&#8217;t just install the <code>php53</code> packages as they would conflict with the <code>php</code> packages, I had to remove all the existing PHP packages and install the new ones. This meant that I had to take stock of exactly what packages I had to remove and replace.</p>
<p>I used the <code>yum</code> commands <code>list</code> command to quickly get this information:</p>
<pre class="terminal"><span style="color:#8FED99;">[<span style="color:#BBFF33;">user@server</span> <span style="color:#729FCF;">~</span>]$</span> <span style="color:#FFF;">yum list installed | grep php | cut -d' ' -f1</span>
php.x86_64
php-cli.x86_64
php-common.x86_64
php-devel.x86_64
php-gd.x86_64
php-mbstring.x86_64
php-mysql.x86_64
php-mcrypt.x86_64
php-pdo.x86_64
php-pear.noarch
php-pgsql.x86_64
php-xml.x86_64
php-xmlrpc.x86_64
<span style="color:#8FED99;">[<span style="color:#BBFF33;">user@server</span> <span style="color:#729FCF;">~</span>]$</span> <span style="color:#FFF;"></span></pre>
<p>The <code>| cut -d' ' -f1</code> part at the end is just some fanciness to show only the package name and not the extra cruft.</p>
<p>Next I checked to make sure that those packages were available for <code>php53</code>:</p>
<pre class="terminal"><span style="color:#8FED99;">[<span style="color:#BBFF33;">user@server</span> <span style="color:#729FCF;">~</span>]$</span> <span style="color:#FFF;">yum search php53 | cut -d' ' -f1 | grep php</span>
php53.x86_64
php53-bcmath.x86_64
php53-cli.x86_64
php53-common.x86_64
php53-dba.x86_64
php53-devel.x86_64
php53-gd.x86_64
php53-imap.x86_64
php53-intl.x86_64
php53-ldap.x86_64
php53-mbstring.x86_64
php53-mysql.x86_64
php53-odbc.x86_64
php53-pdo.x86_64
php53-pgsql.x86_64
php53-process.x86_64
php53-pspell.x86_64
php53-snmp.x86_64
php53-soap.x86_64
php53-xml.x86_64
php53-xmlrpc.x86_64
<span style="color:#8FED99;">[<span style="color:#BBFF33;">use@server</span> <span style="color:#729FCF;">~</span>]$</span> <span style="color:#FFF;"></span></pre>
<p>I quickly noticed that neither <code>php53-mcrypt.x86_64</code> nor <code>php53-pear.noarch</code> were available. I would have to install these manually.</p>
<p>First, I shut down the Apache server as I didn&#8217;t want people going to broken pages as I did these updates:</p>
<pre class="terminal"><span style="color:#8FED99;">[<span style="color:#BBFF33;">user@server</span> <span style="color:#729FCF;">~</span>]$</span> <span style="color:#FFF;">sudo service httpd stop</span>
Stopping httpd:                                            [  OK  ]
<span style="color:#8FED99;">[<span style="color:#BBFF33;">user@server</span> <span style="color:#729FCF;">~</span>]$</span> <span style="color:#FFF;"></span></pre>
<p>Next, I remove the old PHP packages:</p>
<pre class="terminal"><span style="color:#8FED99;">[<span style="color:#BBFF33;">user@server</span> <span style="color:#729FCF;">~</span>]$</span> <span style="color:#FFF;">sudo yum remove php php-cli php-common php-devel php-gd php-mbstring \</span>
<span style="color:#FFF;"> php-mysql php-mcrypt php-pdo php-pear php-pgsql php-xml php-xmlrpc</span>
Loaded plugins: fastestmirror, priorities
Setting up Remove Process
Resolving Dependencies
--&gt; Running transaction check
---&gt; Package php.x86_64 0:5.2.16-jason.1 set to be erased

...

Remove        13 Package(s)
Reinstall     0 Package(s)
Downgrade     0 Package(s)

Is this ok [y/N]: <span style="color: #fff;">y</span>
Downloading Packages:
Running rpm_check_debug
Running Transaction Test

...

Complete!
<span style="color:#8FED99;">[<span style="color:#BBFF33;">user@server</span> <span style="color:#729FCF;">~</span>]$</span> <span style="color:#FFF;"></span></pre>
<p>Finally, I installed the available replacement packages:</p>
<pre class="terminal"><span style="color:#8FED99;">[<span style="color:#BBFF33;">user@server</span> <span style="color:#729FCF;">~</span>]$</span> <span style="color:#FFF;">sudo yum install php53 php53-cli php53-common php53-devel php53-gd \</span>
<span style="color:#FFF;"> php53-mbstring php53-mysql php53-pdo php53-pgsql php53-xml php53-xmlrpc</span>
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
 * base: centos.mirror.lstn.net
 * epel: fedora-epel.mirror.lstn.net
 * extras: mirror.ubiquityservers.com
 * updates: mirror.steadfast.net
Setting up Install Process

...

Install       2 Package(s)
Upgrade       0 Package(s)

Total download size: 18.5 M
Is this ok [y/N]: <span style="color: #fff;">y</span>
Downloading Packages:

...

Complete!
<span style="color:#8FED99;">[<span style="color:#BBFF33;">user@server</span> <span style="color:#729FCF;">~</span>]$</span> <span style="color:#FFF;"></span></pre>
<p>Now it&#8217;s time to get the other PHP elements that were not available as packages.</p>
<h3 id="install-php-mcrypt">Install PHP mcrypt</h3>
<p>The <code>php53-mcrypt</code> package wasn&#8217;t available, so we have to install it manually. The following steps will accomplish this.</p>
<p>We first need to install the development package for mcrypt:</p>
<pre class="terminal"><span style="color:#8FED99;">[<span style="color:#BBFF33;">user@server</span> <span style="color:#729FCF;">~</span>]$</span> <span style="color:#FFF;">sudo yum install php53-devel libmcrypt-devel</span>
...</pre>
<p>PHP&#8217;s mcrypt extension can be compiled and installed from the source code, so we need to download and unpackage the PHP 5.3.3 source. You can find a download link on the PHP <a href="http://us2.php.net/releases/#5.3.3">releases page</a>. I used <code>wget</code> to make the process a bit quicker:</p>
<pre class="terminal"><span style="color:#8FED99;">[<span style="color:#BBFF33;">user@server</span> <span style="color:#729FCF;">~</span>]$</span> <span style="color:#FFF;">wget http://museum.php.net/php5/php-5.3.3.tar.gz</span>
--2011-12-07 14:32:00--  http://museum.php.net/php5/php-5.3.3.tar.gz
Resolving museum.php.net... 67.23.255.166
Connecting to museum.php.net|67.23.255.166|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 13921529 (13M) [application/x-gzip]
Saving to: 'php-5.3.3.tar.gz'

100%[=============================================================&gt;] 13,921,529  2.04M/s   in 6.6s    

2011-06-24 19:10:40 (2.00 MB/s) - `php-5.3.3.tar.gz' saved [13921529/13921529]

<span style="color:#8FED99;">[<span style="color:#BBFF33;">user@server</span> <span style="color:#729FCF;">~</span>]$</span> <span style="color:#FFF;">tar xf php-5.3.3.tar.gz</span>
<span style="color:#8FED99;">[<span style="color:#BBFF33;">user@server</span> <span style="color:#729FCF;">~</span>]$</span> <span style="color:#FFF;"></span></pre>
<p>Now we need to compile and install the mcrypt extension:</p>
<pre class="terminal"><span style="color:#8FED99;">[<span style="color:#BBFF33;">user@server</span> <span style="color:#729FCF;">~</span>]$</span> <span style="color:#FFF;">cd php-5.3.3/ext/mcrypt/</span>
<span style="color:#8FED99;">[<span style="color:#BBFF33;">user@server</span> <span style="color:#729FCF;">mcrypt</span>]$</span> <span style="color:#FFF;">phpize</span>
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
<span style="color:#8FED99;">[<span style="color:#BBFF33;">user@server</span> <span style="color:#729FCF;">mcrypt</span>]$</span> <span style="color:#FFF;">aclocal</span>
<span style="color:#8FED99;">[<span style="color:#BBFF33;">user@server</span> <span style="color:#729FCF;">mcrypt</span>]$</span> <span style="color:#FFF;">./configure</span>
checking for egrep... grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc

...

checking how to hardcode library paths into programs... immediate
configure: creating ./config.status
config.status: creating config.h
<span style="color:#8FED99;">[<span style="color:#BBFF33;">user@server</span> <span style="color:#729FCF;">mcrypt</span>]$</span> <span style="color:#FFF;">make</span>
....

Build complete.
Don't forget to run 'make test'.

<span style="color:#8FED99;">[<span style="color:#BBFF33;">user@server</span> <span style="color:#729FCF;">mcrypt</span>]$</span> <span style="color:#FFF;">make test</span>

Build complete.
Don't forget to run 'make test'.

=====================================================================
PHP         : /usr/bin/php
PHP_SAPI    : cli
PHP_VERSION : 5.3.3
ZEND_VERSION: 2.3.0

...

Do you want to send this report now? [Yns]: <span style="color: #fff;">y</span>

Please enter your email address.
(Your address will be mangled so that it will not go out on any
mailinglist in plain text): <span style="color: #fff;">user@example.com</span>

Posting to qa.php.net /buildtest-process.php

Thank you for helping to make PHP better.
<span style="color:#8FED99;">[<span style="color:#BBFF33;">user@server</span> <span style="color:#729FCF;">mcrypt</span>]$</span> <span style="color:#FFF;">sudo make install</span>
Installing shared extensions:     /usr/lib64/php/modules/
<span style="color:#8FED99;">[<span style="color:#BBFF33;">user@server</span> <span style="color:#729FCF;">mcrypt</span>]$</span> <span style="color:#FFF;"></span></pre>
<p>Now all we have to do is set up the <code>mcrypt.ini</code> file so that the mcrypt extension loads with PHP. This file needs to reside at <code>/etc/php.d/mcrypt.ini</code>.</p>
<pre class="terminal"><span style="color:#8FED99;">[<span style="color:#BBFF33;">user@server</span> <span style="color:#729FCF;">mcrypt</span>]$</span> <span style="color:#FFF;">echo -e "; Enable mcrypt extension module\nextension=mcrypt.so" | \</span>
<span style="color:#FFF;"> sudo tee /etc/php.d/mcrypt.ini</span>
; Enable mcrypt extension module
extension=mcrypt.so
<span style="color:#8FED99;">[<span style="color:#BBFF33;">user@server</span> <span style="color:#729FCF;">mcrypt</span>]$</span> <span style="color:#FFF;"></span></pre>
<h3 id="install-php-pear">Install PHP Pear</h3>
<p>Finally, I need to install <a href="http://pear.php.net/">PHP Pear</a>. If you haven&#8217;t used it, it is essentially a code repository tool for easily installing, upgrading, and managing hosted code. It is basically PHP&#8217;s version of Perl&#8217;s <a href="http://www.cpan.org/">CPAN</a>.</p>
<p>Installing this is fairly straightforward.</p>
<pre class="terminal"><span style="color:#8FED99;">[<span style="color:#BBFF33;">user@server</span> <span style="color:#729FCF;">~</span>]$</span> <span style="color:#FFF;">wget http://pear.php.net/go-pear.phar</span>
--2011-06-24 15:18:22--  http://pear.php.net/go-pear.phar
Resolving pear.php.net... 78.129.214.25
Connecting to pear.php.net|78.129.214.25|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3680148 (3.5M) [application/octet-stream]
Saving to: `go-pear.phar'

100%[===============================================================&gt;] 3,680,148    523K/s   in 7.3s    

2011-06-24 15:18:29 (491 KB/s) - `go-pear.phar' saved [3680148/3680148]

FINISHED --2011-06-24 15:18:29--
Downloaded: 1 files, 3.5M in 7.3s (491 KB/s)
<span style="color:#8FED99;">[<span style="color:#BBFF33;">user@server</span> <span style="color:#729FCF;">~</span>]$</span> <span style="color:#FFF;">sudo php go-pear.phar </span>

Below is a suggested file layout for your new PEAR installation.  To
change individual locations, type the number in front of the
directory.  Type 'all' to change all of them or simply press Enter to
accept these locations.

...

Beginning install...
PHP Warning:  date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in phar:///usr/src/go-pear.phar/PEAR/Registry.php on line 1012
PHP Warning:  date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in phar:///usr/src/go-pear.phar/PEAR/Registry.php on line 1012
PHP Warning:  date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in phar:///usr/src/go-pear.phar/PEAR/Registry.php on line 1012
PHP Warning:  date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in phar:///usr/src/go-pear.phar/PEAR/Registry.php on line 1012
Configuration written to /etc/pear.conf...
Initialized registry...

...

PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer)
PEAR: To install optional features use "pear install pear/PEAR#featurename"

The 'pear' command is now at your service at /usr/bin/pear
<span style="color:#8FED99;">[<span style="color:#BBFF33;">user@server</span> <span style="color:#729FCF;">~</span>]$</span> <span style="color:#FFF;"></span></pre>
<p>Notice that ugly mess about the <code>date()</code> function. It&#8217;s PHP 5.3-specific. I posted how to fix it <a href="http://chrisjean.com/2011/06/24/php-5-3-and-system-timezone-settings/">here</a>.</p>
<h3 id="final-thoughts">Final Thoughts</h3>
<p>All in all, this was much more complex than I had anticipated. I can understand why the CentOS devs had decided to make a separate set of packages for PHP 5.3, but it really has made things difficult. I do have to warn you that many other packages will start to take issue with this setup as they will have dependency requirements for the <code>php</code> package which naturally conflicts with the <code>php53</code>. This leads me to think that they have done this in a way that the repo was not supposed to support as the dependencies should not break in this fashion.</p>
<p>Oh well. Nothing is perfect.</p>
]]></content:encoded>
			<wfw:commentRss>http://chrisjean.com/2011/06/24/upgrade-php-5-1-or-5-2-to-5-3-on-centos/feed/</wfw:commentRss>
		<slash:comments>58</slash:comments>
		</item>
		<item>
		<title>PHP 5.3 and &#8220;It is not safe to rely on the system&#8217;s timezone settings&#8221;</title>
		<link>http://chrisjean.com/2011/06/24/php-5-3-and-system-timezone-settings/</link>
		<comments>http://chrisjean.com/2011/06/24/php-5-3-and-system-timezone-settings/#comments</comments>
		<pubDate>Fri, 24 Jun 2011 22:11:06 +0000</pubDate>
		<dc:creator>Chris Jean</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips 'n Tricks]]></category>

		<guid isPermaLink="false">http://chrisjean.com/?p=1936</guid>
		<description><![CDATA[I just updated one of my CentOS systems to PHP 5.3 (a chore best reserved for another blog post), and started to see the following warning popping up: PHP Notice: in file index.php on line 15: date(): It is not safe to rely on the system&#8217;s timezone settings. You are *required* to use the date.timezone [...]]]></description>
			<content:encoded><![CDATA[<!-- filtered -->
<p>I just updated one of my CentOS systems to PHP 5.3 (a chore best reserved for another blog post), and started to see the following warning popping up:</p>
<blockquote><p>PHP Notice: in file index.php on line 15: date(): It is not safe to rely on the system&#8217;s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected &#8216;America/Chicago&#8217; for &#8216;CDT/-5.0/DST&#8217; instead</p></blockquote>
<p>Annoying to say the least. The fix is much easier than the message makes it seem.</p>
<p>PHP 5.3 now requires that you either have a timezone set in your php.ini file or that you pass the desired timezone via the <code>date_default_timezone_set()</code> function before calling the <code>date()</code> function.</p>
<p>I opened my server&#8217;s <code>/etc/php.ini</code> file and searched for timezone. My ini file had a section like the following:</p>
<pre>[Date]
; Defines the default timezone used by the date functions
; http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone
; date.timezone =</pre>
<p>I uncommented the <code>date.timezone</code> line and added the timezone I wanted.</p>
<pre>[Date]
; Defines the default timezone used by the date functions
; http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone
date.timezone = 'America/Chicago'</pre>
<p>There are two very important things to do in order for this to work properly for you:</p>
<ol>
<li>Use a timezone that is appropriate for your needs. Use PHP&#8217;s <a href="http://nl3.php.net/manual/en/timezones.php">List of Supported Timezones</a> to find the timezone that works for you.</li>
<li>Since your server is likely to cache the PHP configuration, you will want to restart your web server process in order for the change to be recognized. The command to execute varies by system, but for most systems, the following will work:
<pre class="terminal"><span style="color:#8FED99;">[<span style="color:#BBFF33;">user@server</span> <span style="color:#729FCF;">/etc</span>]$</span> <span style="color:#FFF;">sudo service httpd restart</span>
[sudo] password for user:
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]
<span style="color:#8FED99;">[<span style="color:#BBFF33;">user@server</span> <span style="color:#729FCF;">/etc</span>]$</span> <span style="color:#FFF;"></span></pre>
<p>Of course, if you are already root, you won&#8217;t need to use <code>sudo</code>:</p>
<pre class="terminal"><span style="color:#F00;">[<span style="color:#BBFF33;">root@server</span> <span style="color:#729FCF;">/etc</span>]#</span> <span style="color:#FFF;">service httpd restart</span>
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]
<span style="color:#F00;">[<span style="color:#BBFF33;">root@server</span> <span style="color:#729FCF;">/etc</span>]#</span> <span style="color:#FFF;"></span></pre>
</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://chrisjean.com/2011/06/24/php-5-3-and-system-timezone-settings/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>View CSV Data from the Command Line</title>
		<link>http://chrisjean.com/2011/06/17/view-csv-data-from-the-command-line/</link>
		<comments>http://chrisjean.com/2011/06/17/view-csv-data-from-the-command-line/#comments</comments>
		<pubDate>Fri, 17 Jun 2011 14:49:52 +0000</pubDate>
		<dc:creator>Chris Jean</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips 'n Tricks]]></category>

		<guid isPermaLink="false">http://chrisjean.com/?p=1930</guid>
		<description><![CDATA[I recently wrote a script to dump data into CSV files. The CSV files work well for using in other scripts, but they are a bit difficult to read in order to verify that the data looks good. Sure, I could transfer the files to my local system and open them up in OpenOffice Spreadsheet [...]]]></description>
			<content:encoded><![CDATA[<!-- filtered -->
<p>I recently wrote a script to dump data into CSV files. The CSV files work well for using in other scripts, but they are a bit difficult to read in order to verify that the data looks good. Sure, I could transfer the files to my local system and open them up in OpenOffice Spreadsheet or a similar program, but I want to do quick checks of the generated data and constantly copying the data and opening it up again in a program would just slow me down. Fortunately, there is a better way.</p>
<p>Using a combination of the <code>cat</code>, <code>column</code>, and <code>less</code> commands that are available from most *nix shells, the CSV data can be rendered into a nice table and quickly navigated. Here is an example:</p>
<pre class="terminal"><span style="color:#8FED99;">[<span style="color:#BBFF33;">chris@host</span> <span style="color:#729FCF;">data</span>]$</span> <span style="color:#FFF;">cat file.csv | sed -e 's/,,/, ,/g' | column -s, -t | less -#5 -N -S</span>
      1 number_of_tests  execution_time min  execution_time max  execution_time avg  execution_time std_dev  peak_memory_usage min  peak_memory_usage max  peak_memory_usage avg  peak_memory_usage std_dev  real_memory_usage min
      2 449              0.2421700954        0.2522599697        0.24422667392717    0.0013405194115834      22062656               22067696               22062951.732739        552.24028841091            22282240
      3 416              0.2449610233        0.2619900703        0.24721734340337    0.0015257664849685      21295528               21300888               21295541.019231        262.48728836508            21495808
      4 446              0.2286360264        0.2422661781        0.23043336515404    0.001174508347353       20895976               20900800               20895987.03139         228.20177111936            20971520
      5 428              0.1955471039        0.2902140617        0.1981168762521     0.0046106433816399      18045464               18048784               18045487.271028        276.98063531264            18087936
      6 436              0.2208828926        0.2558329105        0.22297720351353    0.0021463518368546      18717960               18723192               18718020.238532        557.06025400191            18874368</pre>
<p>The output is easy to navigate with the cursor keys and is perfect for quickly verifying the generated data.</p>
<p>To use for your files, simply replace <strong><code>file.csv</code></strong> in the above example with your file&#8217;s name. The <strong><code>-#5</code></strong> determines how many columns to scroll when using the left and right arrow keys. You can increase or decrease this as needed to make navigating easier.</p>
<p>For those interested, I&#8217;ve tested this on Debian-based (Ubuntu, Mint, etc) and Redhat-based (CentOS) systems, and it works on all of them.</p>
<p class="post-notice">I updated the command to fix a problem with handling empty entries, such as &#8220;&#8230;,data,,data,&#8230;&#8221;. The sed command takes care of changing those empty values to a space.</p>
]]></content:encoded>
			<wfw:commentRss>http://chrisjean.com/2011/06/17/view-csv-data-from-the-command-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fix &#8220;Insecure $ENV{PATH} while running setuid&#8221;</title>
		<link>http://chrisjean.com/2011/06/06/fix-insecure-envpath-while-running-setuid/</link>
		<comments>http://chrisjean.com/2011/06/06/fix-insecure-envpath-while-running-setuid/#comments</comments>
		<pubDate>Mon, 06 Jun 2011 20:23:37 +0000</pubDate>
		<dc:creator>Chris Jean</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips 'n Tricks]]></category>

		<guid isPermaLink="false">http://chrisjean.com/?p=1923</guid>
		<description><![CDATA[Yet another tale from trying to run a Perl script with the setuid bit turned on. See my earlier post on fixing &#8220;Can’t do setuid (cannot exec sperl)&#8221; for details about why running perl scripts with setuid bits is a special case. I tried to run my script and I got the following message: [user@server [...]]]></description>
			<content:encoded><![CDATA[<!-- filtered -->
<p>Yet another tale from trying to run a Perl script with the setuid bit turned on. See my earlier post on <a href="http://chrisjean.com/2011/06/06/fix-setuid-cannot-exec-sperl/">fixing &#8220;Can’t do setuid (cannot exec sperl)&#8221;</a> for details about why running perl scripts with setuid bits is a special case.</p>
<p>I tried to run my script and I got the following message:</p>
<pre class="terminal"><span style="color:#8FED99;">[<span style="color:#BBFF33;">user@server</span> <span style="color:#729FCF;">~</span>]$</span> <span style="color:#FFF;">run-script</span>
Insecure $ENV{PATH} while running setuid at ~/run-script line 4.</pre>
<p>The basic idea that this message is trying to get across is that an environment variable that is being used may contain data that could open up an attack vector. The way to fix this is by setting the variable to a set of defaults that don&#8217;t come from the user and thus are less susceptible to being manipulated by someone in order to break the security of the system.</p>
<p>In this case, my script executed a program on the shell. Since shell interpretation comes into play, the $PATH variable is looked at to decide where the program could be located. This is an attack vector as someone could just change that variable to cause their own code to be called, thus escalating their code&#8217;s privileges without your knowledge.</p>
<p>In order to avoid this, I set the $PATH variable to a restricted set for use in the script by adding the following in the script before my shell call:</p>
<pre class="code">$ENV{"PATH"} = "/usr/bin";</pre>
<p>This may need to be modified to meet your specific needs. In addition to making this change, I went ahead and changed the call to the shell program to be an absolute reference to the program in order to further mitigate any potential issue, such as aliases.</p>
]]></content:encoded>
			<wfw:commentRss>http://chrisjean.com/2011/06/06/fix-insecure-envpath-while-running-setuid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fix &#8220;Can&#8217;t do setuid (cannot exec sperl)&#8221;</title>
		<link>http://chrisjean.com/2011/06/06/fix-setuid-cannot-exec-sperl/</link>
		<comments>http://chrisjean.com/2011/06/06/fix-setuid-cannot-exec-sperl/#comments</comments>
		<pubDate>Mon, 06 Jun 2011 20:03:51 +0000</pubDate>
		<dc:creator>Chris Jean</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips 'n Tricks]]></category>

		<guid isPermaLink="false">http://chrisjean.com/?p=1918</guid>
		<description><![CDATA[I recently needed to run a perl script with setuid bit set. This allows the script to run as the user the script&#8217;s file is owned by. In this case, I needed the script to run as root. Since doing this can be very dangerous, Perl does something very nice by default: If you have [...]]]></description>
			<content:encoded><![CDATA[<!-- filtered -->
<p>I recently needed to run a perl script with <a href="http://en.wikipedia.org/wiki/Setuid">setuid</a> bit set. This allows the script to run as the user the script&#8217;s file is owned by. In this case, I needed the script to run as root.</p>
<p>Since doing this can be very dangerous, Perl does something very nice by default: If you have the setuid bit set on the script, it forces the script to run in <a href="http://perldoc.perl.org/perlsec.html#SECURITY-MECHANISMS-AND-CONCERNS">Taint Mode</a> which helps to ensure proper sanitation of the environment and inputs. By doing this, Perl can help lock down possible attack vectors that can compromise the security of your script. This isn&#8217;t perfect however, so I do recommend that you read up on <a href="http://perldoc.perl.org/perlsec.html#SECURITY-MECHANISMS-AND-CONCERNS">Perl&#8217;s security measures</a>.</p>
<p>So now down to the main point of this post. I tried to run the script with the setuid bit set, and I got the following error message:</p>
<pre class="terminal"><span style="color:#8FED99;">[<span style="color:#BBFF33;">user@server</span> <span style="color:#729FCF;">~</span>]$</span> <span style="color:#FFF;">run-script</span>
Can't do setuid (cannot exec sperl)</pre>
<p>Well that certainly puts a damper on things. Fortunately, the solution is easy. There is simply an additional package that needs to be installed to provide the wrapper program that puts this Perl security in place.</p>
<p>For Debian (Ubuntu, Mint, etc as well), run the following:</p>
<pre class="terminal"><span style="color:#8FED99;">[<span style="color:#BBFF33;">user@server</span> <span style="color:#729FCF;">~</span>]$</span> <span style="color:#FFF;">sudo apt-get install perl-suid</span></pre>
<p>For CentOS, run the following:</p>
<pre class="terminal"><span style="color:#8FED99;">[<span style="color:#BBFF33;">user@server</span> <span style="color:#729FCF;">~</span>]$</span> <span style="color:#FFF;">sudo yum install perl-suidperl</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://chrisjean.com/2011/06/06/fix-setuid-cannot-exec-sperl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fix aMember &#8220;MYSQL ERROR: MySQL server has gone away in query: INSERT INTO amember_access_log&#8221;</title>
		<link>http://chrisjean.com/2011/01/21/fix-amember-mysql-error-mysql-server-has-gone-away/</link>
		<comments>http://chrisjean.com/2011/01/21/fix-amember-mysql-error-mysql-server-has-gone-away/#comments</comments>
		<pubDate>Fri, 21 Jan 2011 22:31:47 +0000</pubDate>
		<dc:creator>Chris Jean</dc:creator>
				<category><![CDATA[Tips 'n Tricks]]></category>

		<guid isPermaLink="false">http://chrisjean.com/?p=1901</guid>
		<description><![CDATA[I recently encountered a very frustrating problem with aMember (as if I haven&#8217;t encountered enough annoying problems with it already). A customer said that they couldn&#8217;t log in. Each time they tried to log in, they would get the following error message in their browser: MYSQL ERROR:&#60;br /&#62;MySQL server has gone away&#60;br /&#62;in query:&#60;br /&#62;INSERT [...]]]></description>
			<content:encoded><![CDATA[<!-- filtered -->
<p>I recently encountered a very frustrating problem with <a href="http://amember.com/">aMember</a> (as if I haven&#8217;t encountered enough annoying problems with it already).</p>
<p>A customer said that they couldn&#8217;t log in. Each time they tried to log in, they would get the following error message in their browser:</p>
<p><code>MYSQL ERROR:&lt;br /&gt;MySQL server has gone away&lt;br /&gt;in query:&lt;br /&gt;INSERT INTO amember_access_log (member_id, remote_addr, url, referrer) VALUES (ID, 'IP_ADDRESS', '/member/member.php', 'URL')</code></p>
<p>After scratching my head a bit, I delved into the aMember code and found the problem in the <code>plugins/db/mysql/mysql.inc.php</code> file which is where the log_access and log_remote_access functions are located. Both of these functions make use of the <a href="http://php.net/manual/en/function.gethostbyaddr.php">gethostbyaddr</a> PHP function. While this is a handy function, it should never be used in time-sensitive code (such as code that is run as part of a website; such as exactly how aMember uses this function).</p>
<p>The reason is that this function provides no reasonable timeout control, so if the function takes forever to return something, your code has halted until it finishes. In this instance, the visitor had a remote IP that just could not be reversed. This caused the gethostbyaddr function to halt the aMember code for 20 seconds until it finally failed and returned the original IP address. While waiting for this function to return, the MySQL server naturally got tired of waiting and did other things, so when the code finally tried to keep running, everything quickly fell apart.</p>
<p>So ends the theory, time for a fix.</p>
<p>The lines of code that have the gethostbyaddr calls aren&#8217;t necessary by any means, so they can be commented out completely. The lines to be commented out are 1605, 1606, 1617, and 1618. Such as the following:</p>
<p>1605 and 1606:</p>
<pre>//        if (preg_match('/proxy\.aol\.com$/', gethostbyaddr($REMOTE_ADDR)))
//            return;</pre>
<p>1617 and 1618:</p>
<pre>//        if (preg_match('/proxy\.aol\.com$/', gethostbyaddr($ip)))
//            return;</pre>
<p>I would show more code to give better context, but since aMember has a proprietary license, I won&#8217;t.</p>
<p>Note that there are more instances of gethostbyaddr in aMember. The aMember devs are kind enough to put the other gethostbyaddr calls in the PaySbuy, NETbilling, ccbill, and WorldPay payment processing plugins. No worries, this problem can only be found in the payment processing code, what could possibly go wrong?</p>
<p>The specific files that have these calls are:</p>
<ul>
<li><code>plugins/payment/paysbuy/ipn.php</code></li>
<li><code>plugins/payment/netbilling_cc/netbilling_cc.inc.php</code></li>
<li><code>plugins/payment/ccbill/ipn.php</code></li>
<li><code>plugins/payment/worldpay/ipn.php</code></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://chrisjean.com/2011/01/21/fix-amember-mysql-error-mysql-server-has-gone-away/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

