<?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>ServerAdminBlog &#187; PHP</title>
	<atom:link href="http://www.serveradminblog.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.serveradminblog.com</link>
	<description>Short Circuit...</description>
	<lastBuildDate>Mon, 06 Sep 2010 10:29:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>PHP redirect</title>
		<link>http://www.serveradminblog.com/2010/09/php-redirect/</link>
		<comments>http://www.serveradminblog.com/2010/09/php-redirect/#comments</comments>
		<pubDate>Mon, 06 Sep 2010 10:28:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.serveradminblog.com/?p=155</guid>
		<description><![CDATA[It is not hard to remember but here it is&#8230; This code can be used to redirect visitors to any other page. header&#40;&#34;Location: http://www.blabla.com/page.php&#34;&#41;; ?&#62;]]></description>
			<content:encoded><![CDATA[<p>It is not hard to remember but here it is&#8230; This code can be used to redirect visitors to any other page.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Location: http://www.blabla.com/page.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.serveradminblog.com/2010/09/php-redirect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP error reporting</title>
		<link>http://www.serveradminblog.com/2010/09/php-error-reporting/</link>
		<comments>http://www.serveradminblog.com/2010/09/php-error-reporting/#comments</comments>
		<pubDate>Mon, 06 Sep 2010 10:14:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.serveradminblog.com/?p=150</guid>
		<description><![CDATA[Error reporting in PHP is a very usable option but sometimes you can be buried with &#8220;PHP Notice&#8221; lines which you don&#8217;t need (save space and bandwith). PHP Notice: Undefined index: 11 in /home/website/blabla.php on line 52 To turn on reporting on all errors add this line above all other php lines (before error happens) [...]]]></description>
			<content:encoded><![CDATA[<p>Error reporting in PHP is a very usable option but sometimes you can be buried with &#8220;PHP Notice&#8221; lines which you don&#8217;t need (save space and bandwith).</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">PHP Notice:  Undefined index: 11 in /home/website/blabla.php on line 52</pre></div></div>

<p>To turn on reporting on all errors add this line above all other php lines (before error happens)</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Report all PHP errors</span>
<span style="color: #990000;">error_reporting</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">E_ALL</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>To turn on all errors except E_NOTICE</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">error_reporting</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">E_ALL</span> ^ <span style="color: #009900; font-weight: bold;">E_NOTICE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>To turn off reporting (not recommended)</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">error_reporting</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>To be sure that this will work, place error_reporting right below opening php tag (< ? php)</p>
<p>More about this options can be found <a href="http://php.net/manual/en/function.error-reporting.php" target="_blank">HERE</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.serveradminblog.com/2010/09/php-error-reporting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using PHP as a shell scripting language</title>
		<link>http://www.serveradminblog.com/2010/07/using-php-as-a-shell-scripting-language/</link>
		<comments>http://www.serveradminblog.com/2010/07/using-php-as-a-shell-scripting-language/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 12:28:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tips & Tricks]]></category>

		<guid isPermaLink="false">http://www.serveradminblog.com/?p=133</guid>
		<description><![CDATA[As most of us already know, PHP is one of the most popular scripting language for developing dynamic web pages. But you probably don&#8217;t know that PHP can be used as a shell scripting language. It isn&#8217;t robust as Bash or Perl but it has some advantages. The only difference between a PHP shell script [...]]]></description>
			<content:encoded><![CDATA[<p>As most of us already know, PHP is one of the most popular scripting language for developing dynamic web pages. But you probably don&#8217;t know that PHP can be used as a shell scripting language. It isn&#8217;t robust as Bash or Perl but it has some advantages. </p>
<p>The only difference between a PHP shell script and a regular PHP file which serves web page is the first line:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/usr/bin/php -q</span></pre></div></div>

<p>The &#8216;-q&#8217; switch is here to suppress the HTTP headers. After the first line, you just add standard PHP tags:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Here is the example so you can see what I&#8217;m talking about:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">#!/usr/bin/php -q
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
    <span style="color: #b1b100;">print</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Hi there folks !<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Save these lines as test.php and execute with:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># php test.php</pre></div></div>

<p>Good idea is to add the next lines at the beginning:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;argv&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REQUEST_METHOD'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>  <span style="color: #339933;">||</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REMOTE_ADDR'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #990000;">die</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;br&gt;&lt;strong&gt;Shell access only&lt;/strong&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>In this case, this script can be accessible via browser but those lines will kill the script in case if it is issued via browser.  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.serveradminblog.com/2010/07/using-php-as-a-shell-scripting-language/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrading to PHP 5.2.5 on RHEL and CentOS</title>
		<link>http://www.serveradminblog.com/2009/04/upgrading-to-php-525-on-rhel-and-centos/</link>
		<comments>http://www.serveradminblog.com/2009/04/upgrading-to-php-525-on-rhel-and-centos/#comments</comments>
		<pubDate>Wed, 01 Apr 2009 23:12:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.serveradminblog.com/?p=23</guid>
		<description><![CDATA[As you probably know, the latest CentOS and RHEL distros are available only with PHP 5.1.6 and if you want to upgrade PHP, you need to install it manually (or to find someone to do it for you ). The 5.2.5 release brings several security enhancements, more than 60 bug fixes, and improved performance for [...]]]></description>
			<content:encoded><![CDATA[<p>As you probably know, the latest CentOS and RHEL distros are available only with PHP 5.1.6 and if you want to upgrade PHP, you need to install it manually (or to find someone to do it for you <img src='http://www.serveradminblog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ).  The 5.2.5 release brings several security enhancements, more than 60 bug fixes, and improved performance for those of you that like arrays (and really, who doesn&#8217;t?). I wanted to install latest RoundCube webmail application and it won&#8217;t work if you don&#8217;t have PHP> 5.2. Also, latest Vivvo won&#8217;t work without 5.2.x</p>
<p>So, if you don&#8217;t want to build rpms or to go through ./configure, make, make install nightmare, you can enable Jason Litka yum repository to your RHEL or CentOS system. To do this please follow next few steps.</p>
<p>First you need to validate that the packages came from Jason Litka and you&#8217;ll do it with next command:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">#rpm --import http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka</pre></div></div>

<p>After you added his public GPG key, you&#8217;ll need to adjust yum so he can search at his repo. To do this, please follow next steps:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">#nano -w /etc/yum.repos.d/utterramblings.repo</pre></div></div>

<p>Now copy next lines inside this file and save those changes.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">[utterramblings]
name=Jason's Utter Ramblings Repo
baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka</pre></div></div>

<p>Now you can upgrade your PHP installation with simple:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">#yum update php</pre></div></div>

<p>More information about this can be found <a href="http://www.jasonlitka.com/yum-repository/" target="_blank">HERE</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">#php -v</pre></div></div>

<p>should return</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">[root@ns1 ~]# php -v
PHP 5.2.6 (cli) (built: May  5 2008 10:32:59)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
[root@ns1 ~]#</pre></div></div>

<p>I forget to say that you should restart httpd after upgrade.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.serveradminblog.com/2009/04/upgrading-to-php-525-on-rhel-and-centos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
