<?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>Linux, Programming, Telephony, Asterisk, Apache, Tips &#38; Tricks &#187; PHP</title>
	<atom:link href="http://shahidz.com/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://shahidz.com</link>
	<description>Passionate About Technology</description>
	<lastBuildDate>Sun, 10 Jan 2010 17:38:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>eAccelerator</title>
		<link>http://shahidz.com/eaccelerator/</link>
		<comments>http://shahidz.com/eaccelerator/#comments</comments>
		<pubDate>Sat, 24 Jan 2009 07:45:04 +0000</pubDate>
		<dc:creator>Shahid</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[accelerator]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[eAccelerator]]></category>
		<category><![CDATA[open-source]]></category>
		<category><![CDATA[optimizer]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[speed]]></category>

		<guid isPermaLink="false">http://shahidz.com/eaccelerator/</guid>
		<description><![CDATA[
eAccelerator is a free open-source PHP accelerator, optimizer, and dynamic content cache. It increases the performance of PHP scripts by caching them in their compiled state, so that the overhead of compiling is almost completely eliminated. It also optimizes scripts to speed up their execution. eAccelerator typically reduces server load and increases the speed of [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://shahidz.com/wp-content/uploads/2009/01/eaccelerator.png" alt="eAccelerator" /></p>
<p><a href="http://www.eaccelerator.net" title="www.eaccelerator.net" target="_blank">eAccelerator</a> is a free open-source PHP accelerator, optimizer, and dynamic content cache. It increases the performance of PHP scripts by caching them in their compiled state, so that the overhead of compiling is almost completely eliminated. It also optimizes scripts to speed up their execution. eAccelerator typically reduces server load and increases the speed of your PHP code by 1-10 times.</p>
<p>eAccelerator stores compiled PHP scripts in shared memory and executes code directly from it. It creates locks only for a short time, while searching for a compiled PHP script in the cache, so one script can be executed simultaneously by several engines. Files that can&#8217;t fit in shared memory are cached on disk only.</p>
<p><strong>Installing From Source</strong></p>
<p>unpack it by ::</p>
<pre>$ sudo tar -xjvf eaccelerator-0.9.5.3.tar.bz2
$ cd eaccelerator-0.9.5.3/</pre>
<p>Linux User Read README file</p>
<p>Windows User Read README.win32</p>
<p>Compile and install it with ::</p>
<pre>./configure
make
sudo make install
make test</pre>
<p>Add the below line to php.ini file</p>
<pre>extension=eaccelerator.so</pre>
<p>Check phpinfo()  and conform the module eAccelerator is loaded</p>
<p><img src="http://shahidz.com/wp-content/uploads/2009/01/screenshot.png" alt="phpinfo" /></p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fshahidz.com%2Feaccelerator%2F&amp;linkname=eAccelerator"><img src="http://shahidz.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://shahidz.com/eaccelerator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Log or mail Errors in PHP Code</title>
		<link>http://shahidz.com/how-to-log-or-mail-errors-in-php-code/</link>
		<comments>http://shahidz.com/how-to-log-or-mail-errors-in-php-code/#comments</comments>
		<pubDate>Tue, 09 Sep 2008 17:21:26 +0000</pubDate>
		<dc:creator>Shahid</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[handling]]></category>

		<guid isPermaLink="false">http://shahidz.com/how-to-log-or-mail-errors-in-php-code/</guid>
		<description><![CDATA[There are a number of things that can go wrong in code and they bound to through errors, even if you&#8217;ve tested them hundreds of times. PHP provides some error handling methods such as error_reporting(), set_error_handler(), error_log(), restore_error_handler() for handling errors in the PHP code.
error_reporting &#8211; Sets which PHP errors are reported.
int error_reporting ([ int [...]]]></description>
			<content:encoded><![CDATA[<p>There are a number of things that can go wrong in code and they bound to through errors, even if you&#8217;ve tested them hundreds of times. PHP provides some <a href="http://in2.php.net/manual/en/ref.errorfunc.php">error handling</a> methods such as <em>error_reporting()</em>, <em>set_error_handler()</em>, <em>error_log(), restore_error_handler() </em>for handling errors in the PHP code.</p>
<p class="refpurpose"><a href="http://in2.php.net/manual/en/function.error-reporting.php"><strong><span class="refname">error_reporting</span></strong></a> &#8211; <span class="dc-title">Sets which PHP errors are reported.</span></p>
<pre class="refpurpose"><span class="type">int</span> <span class="methodname"><strong><strong>error_reporting</strong></strong></span> ([ <span class="methodparam"><span class="type">int</span> <tt class="parameter">$level</tt></span>] )</pre>
<p><a href="http://in2.php.net/manual/en/errorfunc.constants.php" target="_blank">error_reporting() level constants</a></p>
<pre>&lt;?php error_reportinng(E_ALL);?&gt;</pre>
<p class="refpurpose"><a href="http://" target="_blank"><strong><span class="refname">error_log</span></strong></a> &#8211; Sends an error message to the web server&#8217;s error log, a    <acronym title="Transmission Control Protocol">TCP</acronym> port or to a file.</p>
<pre class="refpurpose"><span class="type">bool</span> <span class="methodname"><strong><strong>error_log</strong></strong></span> ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$message</tt></span>  [, <span class="methodparam"><span class="type">int</span> <tt class="parameter">$message_type</tt></span>  [, <span class="methodparam"><span class="type">string</span> <tt class="parameter">$destination</tt></span>  [, <span class="methodparam"><span class="type">string</span> <tt class="parameter">$extra_headers</tt></span> ]]] )</pre>
<p class="refpurpose"><strong>Parameters</strong></p>
<p class="refpurpose">$message &#8211; The error message that should be logged.</p>
<p class="refpurpose">$message_type &#8211; Says where the error should go. The possible message types are as         follows:</p>
<p class="refpurpose">$extra_headers &#8211; The extra headers. It&#8217;s used when the <em><tt class="parameter">message_type</tt></em>         parameter is set to <em>1</em>.        This message type uses the same internal function as         <a href="http://in2.php.net/manual/en/function.mail.php" target="_blank" class="function">mail()</a> does.</p>
<p class="refpurpose"><a href="http://in2.php.net/manual/en/function.restore-error-handler.php" target="_blank"><strong><span class="refname">restore_error_handler</span></strong></a> &#8211; <span class="dc-title">Restores the previous error handler function</span></p>
<pre class="refpurpose"><span class="type">bool</span> <span class="methodname"><strong><strong>restore_error_handler</strong></strong></span> ( <span class="methodparam">void</span> )</pre>
<pre>&lt;?phprestore_error_handler();?&gt;</pre>
<p class="refpurpose"><a href="http://in2.php.net/manual/en/function.set-error-handler.php"><span class="refname">set_error_handler</span></a> &#8211; <span class="dc-title">Sets a user-defined error handler function</span></p>
<pre ><a href="http://" target="_blank"><span class="type"></span></a><a class="type mixed">mixed</a> <span class="methodname"><strong><strong>set_error_handler</strong></strong></span> ( <span class="methodparam"><a href="http://" target="_blank"><span class="type"></span></a><a class="type callback">callback</a></span> <tt class="parameter">$error_handler</tt>  [, <span class="methodparam"><span class="type">int</span> <tt class="parameter">$error_types</tt></span>] )</pre>
<p>Example:</p>
<pre> &lt;?php 
error_reporting(E_ALL); 
function on_error($num, $str, $file, $line) {
    print "Encountered error $num in $file, line $line: $str\n"; 
    error_log("Error: Encountered error $num in $file, line $line: $st",1,  "dev@gmail.com","From: sys@gmail.com"); 
} 
set_error_handler("on_error"); 
restore_error_handler();?&gt;</pre>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fshahidz.com%2Fhow-to-log-or-mail-errors-in-php-code%2F&amp;linkname=How%20to%20Log%20or%20mail%20Errors%20in%20PHP%20Code"><img src="http://shahidz.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://shahidz.com/how-to-log-or-mail-errors-in-php-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Symfony Framework in Ubuntu</title>
		<link>http://shahidz.com/installing-symfony-framework-in-ubuntu/</link>
		<comments>http://shahidz.com/installing-symfony-framework-in-ubuntu/#comments</comments>
		<pubDate>Mon, 23 Jun 2008 16:24:27 +0000</pubDate>
		<dc:creator>Shahid</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[symfony]]></category>

		<guid isPermaLink="false">http://shahidz.com/installing-symfony-framework-in-ubuntu/</guid>
		<description><![CDATA[Install these packages with apt:
php5
php5-cli
php5-dev
php5-sqlite
php-pear
$ sudo apt-get install php5 php5-cli php5-dev php5-sqlite php-pear
Test if Apache and PHP are up and running typing in the browser:
http://localhost/
You should see something like:
Apache/2.0.55 (Ubuntu) PHP/5.1.2-1ubuntu1 Server at localhost Port 80
From the command line, as root:
$ sudo pear upgrade PEAR
$ sudo pear channel-discover pear.symfony-project.com
Edit /etc/php5/cli/php.ini and change the line:
memory_limit = [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Install these packages with apt:</strong></p>
<p>php5<br />
php5-cli<br />
php5-dev<br />
php5-sqlite<br />
php-pear</p>
<pre>$ sudo apt-get install php5 php5-cli php5-dev php5-sqlite php-pear</pre>
<p>Test if Apache and PHP are up and running typing in the browser:</p>
<p>http://localhost/</p>
<p>You should see something like:</p>
<p>Apache/2.0.55 (Ubuntu) PHP/5.1.2-1ubuntu1 Server at localhost Port 80</p>
<p><strong>From the command line, as root:</strong></p>
<pre>$ sudo pear upgrade PEAR
$ sudo pear channel-discover pear.symfony-project.com</pre>
<p>Edit /etc/php5/cli/php.ini and change the line:</p>
<p>memory_limit = 8M To memory_limit = 16M</p>
<p>Then</p>
<pre>$ sudo pear install symfony/symfony
$ sudo pear install –alldeps http://phing.info/pear/phing-current.tgz</pre>
<style type="text/css">- 		@page { size: 21cm 29.7cm; margin: 2cm } 		P { margin-bottom: 0.21cm } 	--> 	</style>
<p>Using the command:</p>
<pre>$ sudo pear config-show</pre>
<p>we find the symfony libraries have been installed in:</p>
<pre>$ php_dir/symfony/ /usr/share/php/symfony/ main libraries
$ data_dir/symfony/ /usr/share/php/data/symfony/ skeleton of symfony applications, default modules and configuration
$ doc_dir/symfony/ /usr/share/php/docs/symfony/ documentation</pre>
<p>From the command line enter bellow command:</p>
<pre>$ symfony -Vsymfony version 0.6.2</pre>
<p>From the command line, as root:</p>
<pre>$ mkdir /var/www/myproject
$cd /var/www/myproject
$ symfony init-project myproject
$ symfony init-app myapp</pre>
<p>Edit /Virtual Host configuration file , and append the following at the end:</p>
<pre>&lt;VirtualHost 192.168.1.2:81&gt;
ServerAdmin webmaster@localhost
ServerName servername.com
ServerAlias www.servername.com
DocumentRoot /var/www/project/web
Alias /sf /usr/share/php/data/symfony/web/sf
&lt;Directory /var/www/project/web&gt;
     Options FollowSymLinks MultiViews
     AllowOverride all
     Order allow,deny
     allow from all
&lt;/Directory&gt;
&lt;/VirtualHost&gt;</pre>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fshahidz.com%2Finstalling-symfony-framework-in-ubuntu%2F&amp;linkname=Installing%20Symfony%20Framework%20in%20Ubuntu"><img src="http://shahidz.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://shahidz.com/installing-symfony-framework-in-ubuntu/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Installing PHP and PHP modules in Linux</title>
		<link>http://shahidz.com/installing-php-and-php-modules-in-linux/</link>
		<comments>http://shahidz.com/installing-php-and-php-modules-in-linux/#comments</comments>
		<pubDate>Thu, 14 Feb 2008 11:34:01 +0000</pubDate>
		<dc:creator>Shahid</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[php installation]]></category>
		<category><![CDATA[php-modules]]></category>

		<guid isPermaLink="false">http://shahidz.com/?p=4</guid>
		<description><![CDATA[In Redhat and Fedora you can use the command &#8216;yum&#8217;
yum -y install php
yum -y install php-devel
yum -y install php-gd
yum -y install php-imap
yum -y install php-ldap
yum -y install php-mysql
yum -y install php-odbc
yum -y install php-pear
yum -y install php-xml
yum -y install php-xmlrpc
yum -y install curl
yum -y install curl-devel
yum -y install perl-libwww-perl
yum -y install ImageMagick
yum -y install libxml2
yum [...]]]></description>
			<content:encoded><![CDATA[<p>In Redhat and Fedora you can use the command &#8216;yum&#8217;</p>
<p>yum -y install php<br />
yum -y install php-devel<br />
yum -y install php-gd<br />
yum -y install php-imap<br />
yum -y install php-ldap<br />
yum -y install php-mysql<br />
yum -y install php-odbc<br />
yum -y install php-pear<br />
yum -y install php-xml<br />
yum -y install php-xmlrpc<br />
yum -y install curl<br />
yum -y install curl-devel<br />
yum -y install perl-libwww-perl<br />
yum -y install ImageMagick<br />
yum -y install libxml2<br />
yum -y install libxml2-devel<br />
yum -y install httpd</p>
<p>In Ububtu and Debian you can use the command &#8216;apt-get&#8217;</p>
<p>apt-get install php5</p>
<p>apt-get install php5-mysql</p>
<p>apt-get install php5-cli</p>
<p>To search the packages you can use the command apt-cache search &lt;name&gt;</p>
<p>Example :</p>
<p>sudo apt- cache search php5</p>
<p>This will list all the packages for php</p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fshahidz.com%2Finstalling-php-and-php-modules-in-linux%2F&amp;linkname=Installing%20PHP%20and%20PHP%20modules%20in%20Linux"><img src="http://shahidz.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://shahidz.com/installing-php-and-php-modules-in-linux/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
