<?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>takizo, not takezo &#187; php</title>
	<atom:link href="http://systems.takizo.com/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://systems.takizo.com</link>
	<description>the systems admin blog</description>
	<lastBuildDate>Fri, 25 Nov 2011 00:55:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Perl, Trim White Space from a String</title>
		<link>http://systems.takizo.com/2010/07/13/perl-trim-white-space-from-a-string/</link>
		<comments>http://systems.takizo.com/2010/07/13/perl-trim-white-space-from-a-string/#comments</comments>
		<pubDate>Tue, 13 Jul 2010 01:06:47 +0000</pubDate>
		<dc:creator>takizo</dc:creator>
				<category><![CDATA[Systems]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[trim]]></category>

		<guid isPermaLink="false">http://systems.takizo.com/?p=1026</guid>
		<description><![CDATA[When we grep a bunch of string, there are white spaces where we wish to trim, especially the white space at the beginning and the end of a string. There is no trim function in Perl like trim in PHP. The Perl function below should help you to trim the string. #!/usr/bin/perl sub trim($); sub [...]]]></description>
			<content:encoded><![CDATA[<p>When we grep a bunch of string, there are white spaces where we wish to trim, especially the white space at the beginning and the end of a string. There is no trim function in Perl like trim in PHP. The Perl function below should help you to trim the string. </p>
<pre>
<code>
#!/usr/bin/perl

sub trim($);
sub ltrim($);
sub rtrim($);

sub trim($)
{
	my $trim_string = shift;
	$trim_string =~ s/^\s+//;
	$trim_string =~ s/\s+$//;
	return $trim_string;
}

sub ltrim($)
{
	my $trim_string = shift;
	$trim_string =~ s/^\s+//;
	return $trim_string;
}

sub rtrim($)
{
	my $trim_string = shift;
	$trim_string =~ s/\s+$//;
	return $trim_string;
}

my $long_string = "  \t  foo foo        bar \t \t bar          ";
print trim($long_string);
</code>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://systems.takizo.com/2010/07/13/perl-trim-white-space-from-a-string/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Upgrade to php52 on FreeBSD</title>
		<link>http://systems.takizo.com/2010/07/02/upgrade-to-php52-on-freebsd/</link>
		<comments>http://systems.takizo.com/2010/07/02/upgrade-to-php52-on-freebsd/#comments</comments>
		<pubDate>Fri, 02 Jul 2010 03:48:55 +0000</pubDate>
		<dc:creator>takizo</dc:creator>
				<category><![CDATA[Systems]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[ports]]></category>
		<category><![CDATA[portsnap]]></category>
		<category><![CDATA[portupgrade]]></category>

		<guid isPermaLink="false">http://systems.takizo.com/?p=1006</guid>
		<description><![CDATA[By default, after portsnap to latest FreeBSD port tree, it will upgrade your php5.2 to php5.3 automatically. There isn&#8217;t any option where you can to remain your PHP version to 5.2. In order to keep my PHP applications running on PHP version 5.2, what I did is upgrade all php5-* packages to php52-*, but it [...]]]></description>
			<content:encoded><![CDATA[<p>By default, after portsnap to latest FreeBSD port tree, it will upgrade your php5.2 to php5.3 automatically. There isn&#8217;t any option where you can to remain your PHP version to 5.2. </p>
<p>In order to keep my PHP applications running on PHP version 5.2, what I did is upgrade all php5-* packages to php52-*, but it will be a little waste of time if doing it manually, port by port. </p>
<p>So I written this simple bash to output me the packages of php5-* which need to upgrade to php52-*</p>
<pre>
<code>
for d in `portversion -vL= | grep php5 | awk '{print $1}'`; do  OLD=`echo $d | cut -d - -f 1,2`; NEW=`echo $d | sed s/php5/php52/ | cut -d - -f 1,2`; THEPATH=`whereis $NEW | awk '{print $2}' | cut -d / -f 4,5`; echo "portupgrade -o $THEPATH $OLD &#038;&#038; \\"; done
</code>
</pre>
<p>The bash will actually output </p>
<pre>
<code>
portupgrade -o textproc/php52-simplexml php5-simplexml &#038;&#038; \
portupgrade -o devel/php52-spl php5-spl &#038;&#038; \
portupgrade -o databases/php52-sqlite php5-sqlite &#038;&#038; \
portupgrade -o devel/php52-tokenizer php5-tokenizer &#038;&#038; \
portupgrade -o textproc/php52-xml php5-xml &#038;&#038; \
portupgrade -o textproc/php52-xmlreader php5-xmlreader &#038;&#038; \
portupgrade -o textproc/php52-xmlwriter php5-xmlwriter &#038;&#038; \
portupgrade -o archivers/php52-zip php5-zip &#038;&#038; \
portupgrade -o archivers/php52-zlib php5-zlib &#038;&#038; \
</code>
</pre>
<p>Before upgrading the php extensions package, upgrade your php52 as below</p>
<pre>
<code>
portupgrade -o lang/php52 php5
</code>
</pre>
<p>On the last time, remember to remove &#8220;&#038;&#038; \&#8221;, or you can press enter key twice to activate the upgrade. </p>
]]></content:encoded>
			<wfw:commentRss>http://systems.takizo.com/2010/07/02/upgrade-to-php52-on-freebsd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Disable phpinfo() on Apache Web Server</title>
		<link>http://systems.takizo.com/2008/07/22/tips-of-the-day-phpinfo-code-that-shouldnt-show-to-public/</link>
		<comments>http://systems.takizo.com/2008/07/22/tips-of-the-day-phpinfo-code-that-shouldnt-show-to-public/#comments</comments>
		<pubDate>Tue, 22 Jul 2008 09:00:00 +0000</pubDate>
		<dc:creator>takizo</dc:creator>
				<category><![CDATA[Systems]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[web programming]]></category>
		<category><![CDATA[website]]></category>

		<guid isPermaLink="false">http://systems.takizo.com/?p=277</guid>
		<description><![CDATA[Information displays from phpinfo() may provide resourceful information to attacker, such as file patch, web server environment, php modules, web server modules and etc. It&#8217;s better to disable phpinfo() function on your webserver.]]></description>
			<content:encoded><![CDATA[<p>Information displays from phpinfo() may provide resourceful information to attacker, such as file patch, web server environment, php modules, web server modules and etc. It&#8217;s better to disable phpinfo() function on your webserver.</p>
]]></content:encoded>
			<wfw:commentRss>http://systems.takizo.com/2008/07/22/tips-of-the-day-phpinfo-code-that-shouldnt-show-to-public/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

