<?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; error</title>
	<atom:link href="http://shahidz.com/tag/error/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>mysql-proxy: error while loading shared libraries: libmysql-proxy.so.0 or libmysql-chassis.so</title>
		<link>http://shahidz.com/mysql-proxy-error-while-loading-shared-libraries-libmysql-proxyso0-or-libmysql-chassisso/</link>
		<comments>http://shahidz.com/mysql-proxy-error-while-loading-shared-libraries-libmysql-proxyso0-or-libmysql-chassisso/#comments</comments>
		<pubDate>Fri, 01 Jan 2010 08:06:32 +0000</pubDate>
		<dc:creator>Shahid</dc:creator>
				<category><![CDATA[Mysql]]></category>
		<category><![CDATA[Add new tag]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[lua]]></category>
		<category><![CDATA[mysql-proxy]]></category>

		<guid isPermaLink="false">http://shahidz.com/?p=108</guid>
		<description><![CDATA[Getting the below errors:
$ ./agent/sbin/mysql-proxy -V
mysql-proxy: error while loading shared libraries: libmysql-chassis.so.0: cannot open shared object file: No such file or directory
mysql-proxy: error while loading shared libraries: libmysql-proxy.so.0: cannot open shared object file: No such file or directory
The error occurred because the mysql-proxy can&#8217;t find the library files needed for it. So copy the needed [...]]]></description>
			<content:encoded><![CDATA[<p>Getting the below errors:</p>
<pre>$ ./agent/sbin/mysql-proxy -V
mysql-proxy: error while loading shared libraries: libmysql-chassis.so.0: cannot open shared object file: No such file or directory
mysql-proxy: error while loading shared libraries: libmysql-proxy.so.0: cannot open shared object file: No such file or directory</pre>
<p>The error occurred because the mysql-proxy can&#8217;t find the library files needed for it. So copy the needed files to necessary directory.</p>
<pre> $ sudo cp /usr/local/lib/libmysql-* /usr/lib/i486-linux-gnu/
 $ mysql-proxy -V
  mysql-proxy 0.7.2
  glib2: 2.20.1
  libevent: 1.3e
  lua: Lua 5.1.4
    LUA_PATH: /usr/local/lib/mysql-proxy/lua/?.lua
    LUA_CPATH: /usr/local/lib/mysql-proxy/lua/?.so
  == plugins ==
  admin: 0.7.0
  proxy: 0.7.0
</pre>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fshahidz.com%2Fmysql-proxy-error-while-loading-shared-libraries-libmysql-proxyso0-or-libmysql-chassisso%2F&amp;linkname=mysql-proxy%3A%20error%20while%20loading%20shared%20libraries%3A%20libmysql-proxy.so.0%20or%20libmysql-chassis.so"><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/mysql-proxy-error-while-loading-shared-libraries-libmysql-proxyso0-or-libmysql-chassisso/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>URL Redirecting (301,302) in Varnish</title>
		<link>http://shahidz.com/url-redirecting-301302-in-varnish/</link>
		<comments>http://shahidz.com/url-redirecting-301302-in-varnish/#comments</comments>
		<pubDate>Wed, 22 Oct 2008 17:37:04 +0000</pubDate>
		<dc:creator>Shahid</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[301]]></category>
		<category><![CDATA[302]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[rewrite]]></category>
		<category><![CDATA[url redirection]]></category>
		<category><![CDATA[varnish]]></category>
		<category><![CDATA[vcl]]></category>

		<guid isPermaLink="false">http://shahidz.com/url-redirecting-301302-in-varnish/</guid>
		<description><![CDATA[There is no straight forward method for 301/302 URL redirection as we did with rewrite rule. But there are some situations where we need to redirect a URL on a host to some URL on different host. In this situation we need to use 301/302 redirection.  There are two ways we can implement this.
First method [...]]]></description>
			<content:encoded><![CDATA[<p align="justify">There is no straight forward method for 301/302 URL redirection as we did with <a href="http://shahidz.com/apache-url-rewriting/" title="Rewrite Rule" target="_blank">rewrite rule</a>. But there are some situations where we need to redirect a URL on a host to some URL on different host. In this situation we need to use 301/302 redirection.  There are two ways we can implement this.</p>
<p align="justify">First method is to use  <em>set req.http.host</em> and <em>set req.url</em> in the vcl.conf file. Using these two methods we perform normal redirection. Using these method we will redirect the url to some other URL on the same host. For example say the URL http://example.com/error500.php will be redirect to the URL http://example.com/redirect.php. We specify 301/302 redirection to the URL http://foo.com/index.php in the redirect.php file using header method.</p>
<ul>
<li>In the sub vcl_recv method use the following code.</li>
</ul>
<pre>sub vcl_recv {
   if (req.http.host ~ "example.com") {
      if (req.url ~ "error500.php") {
         set req.http.host = "example.com";
         set req.url = "/redirect.php";
      }
   }
}</pre>
<ul>
<li>In the redirect.php file use the following method.</li>
</ul>
<pre>&lt;?php
header("HTTP/1.1 302 Moved Temperarly");
header('Location:http://foo.com/index.php');
exit;
?&gt;</pre>
<p>Second method is to use <em>vcl_error</em> error method. In this error method we can specify HTML tags, so using meta tags we can implement redirection. This option is available with the latest version of varnish.</p>
<ul>
<li>In the sub vcl_recv method use the following code.</li>
</ul>
<pre>sub vcl_recv {
   if (req.http.host ~ "example.com") {
      if (req.url ~ "error500.php")
         error;
      }
   }
}
sub vcl_error {
        set obj.http.Content-Type = "text/html; charset=utf-8";
        if (req.http.host ~ "example.com") {
                if (req.url ~ "error500.php") {
                        synthetic {"
                                &lt;?xml version="1.0" encoding="utf-8"?&gt;
                                &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
                                &lt;html&gt;
                                        &lt;head&gt;
                                                &lt;meta http-equiv="refresh" content="0;url=http://foo.com/index.php"&gt;
                                        &lt;/head&gt;
                                &lt;/html&gt;
                        "};
                }
        }
        deliver;
}</pre>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fshahidz.com%2Furl-redirecting-301302-in-varnish%2F&amp;linkname=URL%20Redirecting%20%28301%2C302%29%20in%20Varnish"><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/url-redirecting-301302-in-varnish/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>
	</channel>
</rss>
