<?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>php | /var/logs/paulooi.log</title>
	<atom:link href="https://logs.paulooi.com/tag/php/feed" rel="self" type="application/rss+xml" />
	<link>https://logs.paulooi.com</link>
	<description>Systems Admin, Web Development and etc</description>
	<lastBuildDate>Tue, 25 Mar 2014 01:49:58 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>How to Disallow or Rate Limit Web Server Mail in Exim</title>
		<link>https://logs.paulooi.com/how-to-disallow-or-rate-limit-web-server-mail-in-exim.php</link>
					<comments>https://logs.paulooi.com/how-to-disallow-or-rate-limit-web-server-mail-in-exim.php#respond</comments>
		
		<dc:creator><![CDATA[Paul Ooi]]></dc:creator>
		<pubDate>Tue, 25 Mar 2014 01:49:58 +0000</pubDate>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Systems]]></category>
		<category><![CDATA[acl]]></category>
		<category><![CDATA[Exim]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[mail server]]></category>
		<category><![CDATA[php]]></category>
		<guid isPermaLink="false">http://systems.takizo.com/?p=1666</guid>

					<description><![CDATA[<p>Recently one of the apache webserver&#8217;s vhost was compromise and allow spammer to use the script to perform massive outgoing email spam. As usual, due to un-patch WordPress&#8217;s engine from a user on the web server. Ended up the &#8220;hacker&#8221;...</p>
The post <a href="https://logs.paulooi.com/how-to-disallow-or-rate-limit-web-server-mail-in-exim.php">How to Disallow or Rate Limit Web Server Mail in Exim</a> first appeared on <a href="https://logs.paulooi.com">/var/logs/paulooi.log</a>.]]></description>
										<content:encoded><![CDATA[<p>Recently one of the apache webserver&#8217;s vhost was compromise and allow spammer to use the script to perform massive outgoing email spam. As usual, due to un-patch WordPress&#8217;s engine from a user on the web server. Ended up the &#8220;hacker&#8221; been using the PHP&#8217;s mail() function sending a massive 100k++ outgoing email to email provider such as yahoo mail and gmail. <span id="more-1666"></span></p>
<p>There were a lot email queue in Exim&#8217;s queue, due to the blockage from recipient server. Unfortunately WordPress doesn&#8217;t have SMTP setting for outgoing email notification, it has to rely on third party plugins. </p>
<p>Here is what we implement on SMTP MTA to deny/rate limit outgoing from PHP&#8217;s mail() function. </p>
<p>On Exim config file, before hitting ACL configuration, place this config for non-smtp setting</p>
<pre>
<code>
acl_not_smtp = acl_check_not_smtp
</code>
</pre>
<p>After &#8220;begin acl&#8221; section, place this config </p>
<pre>
<code>
acl_check_not_smtp:

  deny
        senders = www@domain.com
        message = sorry server is offline

  deny
        ratelimit = 20 / 1h / strict / $sender_address_domain
        senders = *@domain.com
        message = sorry server is offline

  accept
</code>
</pre>
<p>The first rule is totally deny anything from apache&#8217;s vhost. It means non of the apache&#8217;s vhost can send outgoing email with PHP mail() function. If you are not comfortable with this. Can try on the second rules, which is rate limit the outgoing email, which can help to eliminate the massive outgoing email happened on apache web server UID. </p>
<p>Have fun controlling and fight with the spam <img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f609.png" alt="😉" class="wp-smiley" style="height: 1em; max-height: 1em;" /> </p>The post <a href="https://logs.paulooi.com/how-to-disallow-or-rate-limit-web-server-mail-in-exim.php">How to Disallow or Rate Limit Web Server Mail in Exim</a> first appeared on <a href="https://logs.paulooi.com">/var/logs/paulooi.log</a>.]]></content:encoded>
					
					<wfw:commentRss>https://logs.paulooi.com/how-to-disallow-or-rate-limit-web-server-mail-in-exim.php/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Symfony lib-icu 4.4 Error on CentOS</title>
		<link>https://logs.paulooi.com/symfony-lib-icu-4-4-error-on-centos.php</link>
					<comments>https://logs.paulooi.com/symfony-lib-icu-4-4-error-on-centos.php#respond</comments>
		
		<dc:creator><![CDATA[Paul Ooi]]></dc:creator>
		<pubDate>Sun, 22 Dec 2013 14:53:04 +0000</pubDate>
				<category><![CDATA[Application]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[symfony]]></category>
		<guid isPermaLink="false">http://systems.takizo.com/?p=1643</guid>

					<description><![CDATA[<p>Having problem to install symfony on CentOS due to the lib-icu 4.4 error. When running &#8220;php composer.phar install&#8221;, the error below pops up. # php composer.phar install Loading composer repositories with package information Installing dependencies (including require-dev) from lock file...</p>
The post <a href="https://logs.paulooi.com/symfony-lib-icu-4-4-error-on-centos.php">Symfony lib-icu 4.4 Error on CentOS</a> first appeared on <a href="https://logs.paulooi.com">/var/logs/paulooi.log</a>.]]></description>
										<content:encoded><![CDATA[<p>Having problem to install symfony on CentOS due to the lib-icu 4.4 error. When running &#8220;php composer.phar install&#8221;, the error below pops up. </p>
<pre>
<code>
# php composer.phar install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - symfony/icu v1.2.0 requires lib-icu >=4.4 -> the requested linked library icu has the wrong version installed or is missing from your system, make sure to have the extension providing it.
    - symfony/icu v1.2.0 requires lib-icu >=4.4 -> the requested linked library icu has the wrong version installed or is missing from your system, make sure to have the extension providing it.
    - Installation request for symfony/icu v1.2.0 -> satisfiable by symfony/icu[v1.2.0].
</code>
</pre>
<p>There is some configuration on &#8220;composer.json&#8221; need to be changed on &#8220;required&#8221; tree. </p>
<pre>
<code>
"symfony/icu": "1.0.0",
"symfony/symfony": "2.3.5",
</code> 
</pre>
<p>After that run the command again &#8220;php composer.phar install&#8221;. The details of the ticket error can be found on <a href="https://github.com/symfony/symfony/issues/8035">Symfony&#8217;s github site</a> (scroll to the last line) </p>The post <a href="https://logs.paulooi.com/symfony-lib-icu-4-4-error-on-centos.php">Symfony lib-icu 4.4 Error on CentOS</a> first appeared on <a href="https://logs.paulooi.com">/var/logs/paulooi.log</a>.]]></content:encoded>
					
					<wfw:commentRss>https://logs.paulooi.com/symfony-lib-icu-4-4-error-on-centos.php/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Perl, Trim White Space from a String</title>
		<link>https://logs.paulooi.com/perl-trim-white-space-from-a-string.php</link>
					<comments>https://logs.paulooi.com/perl-trim-white-space-from-a-string.php#comments</comments>
		
		<dc:creator><![CDATA[Paul Ooi]]></dc:creator>
		<pubDate>Tue, 13 Jul 2010 01:06:47 +0000</pubDate>
				<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[<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....</p>
The post <a href="https://logs.paulooi.com/perl-trim-white-space-from-a-string.php">Perl, Trim White Space from a String</a> first appeared on <a href="https://logs.paulooi.com">/var/logs/paulooi.log</a>.]]></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>The post <a href="https://logs.paulooi.com/perl-trim-white-space-from-a-string.php">Perl, Trim White Space from a String</a> first appeared on <a href="https://logs.paulooi.com">/var/logs/paulooi.log</a>.]]></content:encoded>
					
					<wfw:commentRss>https://logs.paulooi.com/perl-trim-white-space-from-a-string.php/feed</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Upgrade to php52 on FreeBSD</title>
		<link>https://logs.paulooi.com/upgrade-to-php52-on-freebsd.php</link>
					<comments>https://logs.paulooi.com/upgrade-to-php52-on-freebsd.php#respond</comments>
		
		<dc:creator><![CDATA[Paul Ooi]]></dc:creator>
		<pubDate>Fri, 02 Jul 2010 03:48:55 +0000</pubDate>
				<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[<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. In order to keep my PHP applications running on...</p>
The post <a href="https://logs.paulooi.com/upgrade-to-php52-on-freebsd.php">Upgrade to php52 on FreeBSD</a> first appeared on <a href="https://logs.paulooi.com">/var/logs/paulooi.log</a>.]]></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 && \\"; done
</code>
</pre>
<p>The bash will actually output </p>
<pre>
<code>
portupgrade -o textproc/php52-simplexml php5-simplexml && \
portupgrade -o devel/php52-spl php5-spl && \
portupgrade -o databases/php52-sqlite php5-sqlite && \
portupgrade -o devel/php52-tokenizer php5-tokenizer && \
portupgrade -o textproc/php52-xml php5-xml && \
portupgrade -o textproc/php52-xmlreader php5-xmlreader && \
portupgrade -o textproc/php52-xmlwriter php5-xmlwriter && \
portupgrade -o archivers/php52-zip php5-zip && \
portupgrade -o archivers/php52-zlib php5-zlib && \ 
</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>The post <a href="https://logs.paulooi.com/upgrade-to-php52-on-freebsd.php">Upgrade to php52 on FreeBSD</a> first appeared on <a href="https://logs.paulooi.com">/var/logs/paulooi.log</a>.]]></content:encoded>
					
					<wfw:commentRss>https://logs.paulooi.com/upgrade-to-php52-on-freebsd.php/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Disable phpinfo() on Apache Web Server</title>
		<link>https://logs.paulooi.com/tips-of-the-day-phpinfo-code-that-shouldnt-show-to-public.php</link>
					<comments>https://logs.paulooi.com/tips-of-the-day-phpinfo-code-that-shouldnt-show-to-public.php#respond</comments>
		
		<dc:creator><![CDATA[Paul Ooi]]></dc:creator>
		<pubDate>Tue, 22 Jul 2008 09:00:00 +0000</pubDate>
				<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[<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>
The post <a href="https://logs.paulooi.com/tips-of-the-day-phpinfo-code-that-shouldnt-show-to-public.php">Disable phpinfo() on Apache Web Server</a> first appeared on <a href="https://logs.paulooi.com">/var/logs/paulooi.log</a>.]]></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>The post <a href="https://logs.paulooi.com/tips-of-the-day-phpinfo-code-that-shouldnt-show-to-public.php">Disable phpinfo() on Apache Web Server</a> first appeared on <a href="https://logs.paulooi.com">/var/logs/paulooi.log</a>.]]></content:encoded>
					
					<wfw:commentRss>https://logs.paulooi.com/tips-of-the-day-phpinfo-code-that-shouldnt-show-to-public.php/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
