<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Tue, 18 Jun 2013 17:35:50 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Software Gunslinger: PHP is meant to die, continued]]></title>
      <guid>http://www.phpdeveloper.org/news/19511</guid>
      <link>http://www.phpdeveloper.org/news/19511</link>
      <description><![CDATA[<p>
In his <a href="http://phpdeveloper.org/news/19417">previous post</a> ("PHP was meant to die") the point was made that PHP isn't really designed as a language to handle long running processes very well. It's made to handle a few operations and then die at the end of the request. In <a href="http://software-gunslinger.tumblr.com/post/48215406921/php-is-meant-to-die-continued">this follow up post</a> he talks more about using PHP for long running processes and a library that could help.
</p>
<blockquote>
Yes, I already acknowledged that PHP has a garbage collection implementation starting 5.3.0 and up (opt-in or opt-out, that's not the problem). I also acknowledge that garbage collection works, and is able to take care of most circular references just fine. [...] Anyway, as previously stated too, garbage collection is a great thing, but not enough for PHP. It's a borrowed feature that does not play well with old fundamental decisions inherited from the original design. Garbage collection is not a magical solution for every problem, like many tried to argue about. Let's illustrate with another example.
</blockquote>
<p>
His example uses the <a href="http://reactphp.org/">React</a> PHP library (a non-blocking I/O platform) to handle a lot of incoming data to a port and report back some memory usage and limit settings. He explains a bit about what's happening and shares the results of the test, including the end result - a fatal error when the memory limit was hit. He still comes to the same conclusion, ultimately...PHP is just not the language to use for long-running processes that do any large amount of work. 
</p>
Link: http://software-gunslinger.tumblr.com/post/48215406921/php-is-meant-to-die-continued]]></description>
      <pubDate>Fri, 26 Apr 2013 09:15:56 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Software Gunslinger: PHP is meant to die]]></title>
      <guid>http://www.phpdeveloper.org/news/19417</guid>
      <link>http://www.phpdeveloper.org/news/19417</link>
      <description><![CDATA[<p>
In <a href="http://software-gunslinger.tumblr.com/post/47131406821/php-is-meant-to-die">this new post</a>, titled "PHP is meant to die", the author looks at one weakness he sees in the PHP language - how PHP handles long running scripts and functionality.
</p>
<blockquote>
In my opinion, a lot of the hatred that PHP receives misses the utter basic point: PHP is meant to die. It doesn't mean that a perfectly capable (to some extent) programming language will disappear into nothingness, it just means that your PHP code can't run forever. Now, <a href="http://php.net/releases/index.php">13 years after the first official release</a> in 2000, that concept still looks valid to me.
</blockquote>
<p>
He talks about some of the "dying" that PHP is good at (like making general website-related requests) but notes that if you try to have it do much more, PHP acts up. He points to the complexity of web-based applications and notes that, while PHP is good for some of it, it's not a fit for all functionality. He also covers the bringing of processes to the foreground that are best left in the background and how - despite the best of intentions - making a PHP daemon to solve the problem isn't a viable option.
</p>
<blockquote>
Do you see the pattern? I've inherited projects where PHP was used for daemons or other stuff that's not just regular websites (yes, I'm a hired keyboard), and all of them shared that same problem. No matter how good or clever your idea looked on paper, if you want to keep the processes running forever they will crash, and will do it really fast under load, because of known or unknown reasons. That's nothing you can really control, it's because PHP is meant to die. The basic implementation, the core feature of the language, is to be suicidal, no matter what.
</blockquote>
Link: http://software-gunslinger.tumblr.com/post/47131406821/php-is-meant-to-die]]></description>
      <pubDate>Fri, 05 Apr 2013 10:47:40 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Developer Drive: PHP Error Checking]]></title>
      <guid>http://www.phpdeveloper.org/news/18297</guid>
      <link>http://www.phpdeveloper.org/news/18297</link>
      <description><![CDATA[<p>
The Developer Drive site has a new post with a few beginner suggestions about how to <a href="http://www.developerdrive.com/2012/07/php-error-checking/">do some error reporting</a> in your applications:
</p>
<blockquote>
As much as programmers attempt to anticipate every possible action or combination of actions that a user can take when encountering a web application, no one can foresee them all. When the user takes an unanticipated course of action and "breaks" the application, the software needs to catch them before they fall.
</blockquote>
<p>
They show you a few methods for handling the errors that might come up including the <a href="http://php.net/die">die</a> function, <a href="http://us.php.net/throw">exception handling</a>, <a href="http://php.net/trigger_error">triggering errors</a> and just outputting errors via an "echo" or "print" (or something similar).
</p>]]></description>
      <pubDate>Tue, 31 Jul 2012 12:58:49 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Jani Hartikainen's Blog: The "do X or die()" pattern must die]]></title>
      <guid>http://www.phpdeveloper.org/news/14868</guid>
      <link>http://www.phpdeveloper.org/news/14868</link>
      <description><![CDATA[<p>
<i>Jani Hartikainen</i> has a suggestion for all PHP developers out there - <a href="http://codeutopia.net/blog/2010/07/28/the-do-x-or-die-pattern-must-die/">stop using die()</a> for handling errors!
</p>
<blockquote>
What's the most common pattern for error handling you see in beginner's PHP code? - That's right, do_X() or die('do_X failed);. That's nice and all, as at least you have some sort of error handling, but I think this way of handling errors must go. There is no place for it in modern PHP code - it's the worst way to handle errors, not much better than not handling them at all.
</blockquote>
<p>
He talks about why <a href="http://php.net/die">die()</a> is so bad and some alternatives to it - <a href="http://php.net/trigger_error">trigger_error</a> (with a custom error handler) and <a href="http://php.net/Exceptions">exceptions</a>. When used correctly, these two can help your script correctly catch and handle errors without the mess of a die().
</p>]]></description>
      <pubDate>Thu, 29 Jul 2010 09:19:03 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPFreaks.com: or die() must die]]></title>
      <guid>http://www.phpdeveloper.org/news/12593</guid>
      <link>http://www.phpdeveloper.org/news/12593</link>
      <description><![CDATA[<p>
According to <a href="http://www.phpfreaks.com/blog/or-die-must-die">this new article</a> on the PHPFreaks.com site the use of "or die()" in scripts...must die!
</p>
<blockquote>
I see it all the time, and I see people telling other people to do that all the time. It's plain simply bad practice and it's time that people start to understand this. When I confront people with it they usually say something along the lines of "oh, but it's just for debugging purposes". Okay, so I tend to put echo and var_dump() statements in my code for debugging as well. However, this is not the same. 
</blockquote>
<p>
They list several reasons why the "or die trick" is a bad idea including the non-catchable error that's thrown and that there's no control over where the error message from die goes. As a better alternative, they suggest using <a href="http://php.net/trigger_error">trigger_error</a> and the exception handling built into PHP5 to correctly catch any potential errors a statement might throw.
</p>]]></description>
      <pubDate>Fri, 29 May 2009 10:28:37 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Brian Moon's Blog: The death of die()]]></title>
      <guid>http://www.phpdeveloper.org/news/12365</guid>
      <link>http://www.phpdeveloper.org/news/12365</link>
      <description><![CDATA[<p>
<i>Brian Moon</i> has <a href="http://brian.moonspot.net/dont-use-the-die-function">called for the death of die()</a>:
</p>
<blockquote>
Now, I have no actual authority to do so.  My PHP CVS karma does not extend that far.  And I doubt it will actually get removed despite it being nothing more than an alias for exit now. No, what I would like to call a death to is the usage of die such as [echoing out a message to the user instead of doing proper error handling].
</blockquote>
<p>
He points out a few perfectly viable alternatives like the <a href="http://www.php.net/exceptions">exception handlers</a>, the <a href="http://www.php.net/trigger_error">trigger_error</a> function and custom <a href="http://www.php.net/set_error_handler">error handlers</a>.
</p>]]></description>
      <pubDate>Fri, 17 Apr 2009 12:02:29 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Eirik Hoem's Blog: Dying with grace - PHP's register_shutdown_function]]></title>
      <guid>http://www.phpdeveloper.org/news/9808</guid>
      <link>http://www.phpdeveloper.org/news/9808</link>
      <description><![CDATA[<p>
<i>Eirik Hoem</i> has <a href="http://eirikhoem.wordpress.com/2008/03/15/dying-with-grace-phps-register_shutdown_function/">posted a new look</a> at a function that can be amazingly helpful when you have a script with issues that needs a little extra help cleaning up after itself - <a href="http://no2.php.net/register_shutdown_function">register_shutdown_function</a>.
</p>
<blockquote>
Scripts tend to die, and that's not usually nice. We do not want to show the user a fatal error nor a blank page (display errors off) . PHP has a function called <a href="http://no2.php.net/register_shutdown_function">register_shutdown_function</a> which lets us set up a function which is called at execution shutdown. What this means is that our function will be executed when our script is done executing / dying and PHP execution is about to shut down.
</blockquote>
<p>
He <a href="http://eirikhoem.wordpress.com/2008/03/15/dying-with-grace-phps-register_shutdown_function/">suggests</a> various things that can be done with the functionality, including checking for successful script execution (via a false variable that can be checked for success).
</p>]]></description>
      <pubDate>Mon, 17 Mar 2008 12:02:00 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[DevShed: Error Handling in PHP - Coding Defensively]]></title>
      <guid>http://www.phpdeveloper.org/news/4649</guid>
      <link>http://www.phpdeveloper.org/news/4649</link>
      <description><![CDATA[DevShed has <a href="http://www.devshed.com/c/a/PHP/Error-Handling-in-PHP-Coding-Defensively/">a new article</a> posted today dealing with error reporting in PHP applications.
<p>
<quote>
<i>
Since error handling is something that you should introduce (at least progressively) into your applications, in this article I'll explore some of the most common error checking methods available in PHP, in order to make web applications much more robust and reliable. 
<p>
The end result of this experience will be an illustrative list of hands-on examples that utilize different error handling methods, ranging in from using simple "die()" statements, to manipulating errors within an object-oriented context, by utilizing exceptions.
</i>
</quote>
<p>
They <a href="http://www.devshed.com/c/a/PHP/Error-Handling-in-PHP-Coding-Defensively/">cover</a> things like the basic die() statement, triggering errors in your code with the trigger_error() function, using the error handling in PEAR, and setting boolean flags to catch when things go wrong...]]></description>
      <pubDate>Thu, 12 Jan 2006 06:34:19 -0600</pubDate>
    </item>
  </channel>
</rss>
