<?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, 21 May 2013 21:56:45 -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[PHPMaster.com: A First Look at React]]></title>
      <guid>http://www.phpdeveloper.org/news/19365</guid>
      <link>http://www.phpdeveloper.org/news/19365</link>
      <description><![CDATA[<p>
On PHPMaster.com there's a new tutorial that <a href="http://phpmaster.com/a-first-look-at-react/">introduces you to React</a>, the PHP-based event-driven non-blocking socket tool that's similar to some of the functionality Node.js provides. The article is a very basic introduction but can help get your feet wet with the tool.
</p>
<blockquote>
For the past couple of years, <a href="http://nodejs.org/">Node.js</a> has been drawing increasing amounts of attention as a promising web technology. While it has some strengths, like being event driven, some people just want to stick to PHP. For over a year now, however, there has been a similar project for PHP named <a href="http://reactphp.org/">React</a>. React is mostly coded by <a href="https://igor.io/">Igor Wiedler</a>, who is also a prominent contributor to the <a href="https://github.com/fabpot/Silex">Silex framework</a>. While reading through the React examples, it really does look similar to Node.js.
</blockquote>
<p>
Included in the post are the instructions on how to get the latest version of React (via Composer) and the code to create a sample server that just writes out a string with a counter for the number of requests made. There's also an example of a "keystroke logger" for all data that's coming across the connection. The author (<i>Igor</i>) notes, however, that he wouldn't recommend using React in production, though, as its target is mostly those working with "cutting-edge technologies" rather than more stable applications.
</p>]]></description>
      <pubDate>Tue, 26 Mar 2013 10:01:33 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Segment.io: How to Make Async Requests in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/19142</guid>
      <link>http://www.phpdeveloper.org/news/19142</link>
      <description><![CDATA[<p>
On the Segment.io blog there's a new post by <i>Calvin</i> talking about <a href="https://segment.io/blog/how-to-make-async-requests-in-php/">making asyncronous requests in PHP</a> and three different approaches you could use, depending on your situation.
</p>
<blockquote>
When designing client libraries to send data to our API, one of our top priorities is to make sure that none of our code affects the performance of your core application. That is tricky when you have a single-threaded, "shared-nothing" language like PHP. [...] Ideally, we like to keep the setup process minimal and address a wide variety of use cases. As long as it runs with PHP (and possibly a common script or two), you should be ready to dive right in. We ended up experimenting with three main approaches to make requests in PHP. Here's what we learned.
</blockquote>
<p>
Their three suggestions don't involve external dependencies (like a queue server) and can operate pretty quickly:
</p>
<ul>
<li>Opening a socket and closing it before waiting for a response
<li>Write to a log file (a pseudo-queue)
<li>Fork a curl process (through something like <a href="http://php.net/exec">exec</a>)
</ul>
<p>
They each have small code examples included with them and explanations as to their plusses and minuses. For their needs, the "forked curl" solution worked out the best, but check out the other options too - you might have different needs.
</p>]]></description>
      <pubDate>Wed, 06 Feb 2013 09:52:49 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Nikita Popov: Cooperative multitasking using coroutines (in PHP!) ]]></title>
      <guid>http://www.phpdeveloper.org/news/18941</guid>
      <link>http://www.phpdeveloper.org/news/18941</link>
      <description><![CDATA[<p>
<i>Nikita Popov</i> has a new post to his blog about a new feature that will be coming in PHP 5.5 and <a href="http://nikic.github.com/2012/12/22/Cooperative-multitasking-using-coroutines-in-PHP">how to use them</a>, coroutines and generators, in an example application.
</p>
<blockquote>
Coroutines on the other hand have received relatively little attention. The reason is that coroutines are both a lot more powerful and a lot harder to understand and explain. In this article I'd like to guide you through an implementation of a task scheduler using coroutines, so you can get a feeling for the stuff that they allow you to do. I'll start off with a few introductory sections. If you feel like you already got a good grasp of the basics behind generators and coroutines, then you can jump straight to the "Cooperative multitasking" section.
</blockquote>
<p>
He starts with a look at generators, a piece of functionality that will allow PHP to, for example, more easily create iterators "on the fly." He then moves on to coroutines, added functions that you have two-way communication with generators instead of just pulling data from them. With the basics out of the way, he gets into the "cooperative multitasking" and a sample socket-based server he implements using some of the concepts. 
</p>]]></description>
      <pubDate>Mon, 24 Dec 2012 09:46:36 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Christoph Hochstrasser: PHP Socket Programming, done the Right Way (tm)]]></title>
      <guid>http://www.phpdeveloper.org/news/18302</guid>
      <link>http://www.phpdeveloper.org/news/18302</link>
      <description><![CDATA[<p>
In one of his recent posts <i>Christoph Hochstrasser</i> looks at <a href="http://christophh.net/2012/07/24/php-socket-programming/">socket programming</a> done the right way, complete with code examples showing both client and server setups.
</p>
<blockquote>
When writing about socket programming with PHP, nearly all articles are about the Socket Extension, despite it's the unfriendliest and most cumbersome way to work with Sockets in modern PHP. Let me introduce you to something, which apparently is pretty unknown among PHP programmers.
</blockquote>
<p>
He starts off by introducing the concept of a socket (for those that are beginners on the topic) and talks about two of the major ways to work with them - the Socket extension and Streams. He shows how to use the stream_socket_client_* functions to connect to a remote server and make a HTTP request for the base page. He also shows the other side of things, making a simple "echo" server that binds to port 1337.
</p>]]></description>
      <pubDate>Wed, 01 Aug 2012 10:16:15 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[BinaryTides.com: PHP Socket programming tutorial]]></title>
      <guid>http://www.phpdeveloper.org/news/18267</guid>
      <link>http://www.phpdeveloper.org/news/18267</link>
      <description><![CDATA[<p>
On the BinaryTides.com site there's a recent tutorial showing you how to <a href="http://www.binarytides.com/blog/php-socket-programming-tutorial-for-beginners/">effectively use sockets</a> in your PHP applications, complete with incoming and outgoing examples.
</p>
<blockquote>
This is a quick guide/tutorial to learning socket programming in php. Socket programming php is very similar to C. Most functions are similar in names, parameters and output. However unlike C, socket programs written in php would run the same way on any os that has php installed. So the code does not need any platform specific changes (mostly).
</blockquote>
<p>
They start with the basics - creating a socket, connecting to a server and sending out information over the connection. They also include the code examples showing how to pull in data from the socket. Their example socket is set up to be a simplistic web server, returning data according to the standards for a normal GET request. They make a mini-server out of it, getting to to accept requests on a bound socket.
</p>]]></description>
      <pubDate>Tue, 24 Jul 2012 12:14:37 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Pavel Shevaev's Blog: Make php-fpm execute arbitrary PHP scripts via socket]]></title>
      <guid>http://www.phpdeveloper.org/news/17045</guid>
      <link>http://www.phpdeveloper.org/news/17045</link>
      <description><![CDATA[<p>
<i>Pavel Shevaev</i> has a quick new post to his blog showing how to get PHP-FPM to <a href="http://efiquest.org/2011-10-22/55/">execute PHP scripts</a> via a socket request.
</p>
<blockquote>
We are using <a href="http://pecl.php.net/APC">APC cache</a> very heavily in our projects and during project deployment the cache must be flushed and warmed up. A common solution to warmup the APC cache is to fetch some special page via HTTP which does the job. The problem with this approach is that it's not reliable enough when PHP is served via several fastcgi back-ends.
</blockquote>
<p>
To solve the problem, he uses a <a href="https://github.com/pachanga/phpfpm">PHP-FPM module</a> to work with the FastCGI socket and execute any file (as permissions allow, of course). In his case, he uses it to "warm up" his APC cache for the user. A code snippet is provided as an example.
</p>
]]></description>
      <pubDate>Wed, 26 Oct 2011 11:19:23 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Tibo Beijen's Blog: Fixing mysqldump on Zend Server CE on OS X]]></title>
      <guid>http://www.phpdeveloper.org/news/15978</guid>
      <link>http://www.phpdeveloper.org/news/15978</link>
      <description><![CDATA[<p>
<i>Tibo Beijen</i> has a new post today showing his method for <a href="http://www.tibobeijen.nl/blog/2011/03/01/fixing-mysqldump-on-zend-server-ce-on-os-x/">fixing mysqldump on Zend Server CE</a> running on an OS X platform. The default install throws a socket error when you try to dump a database using the command.
</p>
<blockquote>
Inspecting the mysql configuration contained in /usr/local/zend/mysql/data/my.cnf confirmed that the section [client] showed the socket as returned by executing SHOW VARIABLES; from the mysql client: /usr/local/zend/mysql/tmp/mysql.sock Although it is possible to specify the socket by using mysqldump's --socket switch, that doesn't really seem a 'solution'.
</blockquote>
<p>
As a real solution to the problem was to copy over the my.cnf file from the custom location Zend Server has it in to the default "/etc/my.cnf" with settings pointing to the correct MySQL socket.
</p>]]></description>
      <pubDate>Tue, 01 Mar 2011 11:50:58 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPBuilder.com: PHP Scripts for Interacting with Networks]]></title>
      <guid>http://www.phpdeveloper.org/news/15585</guid>
      <link>http://www.phpdeveloper.org/news/15585</link>
      <description><![CDATA[<p>
On PHPBuilder.com there's <a href="http://www.phpbuilder.com/columns/php-networking/Leidago_Noabeb12142010.php3">a new tutorial</a> showing you some of the PHP functions that you can use to interact with the network surrounding (and even vaguely related to) your application.
</p>
<blockquote>
PHP has a great many tools for interacting with a network and also with the Internet. In this article, I examine some of those tools and functions to show how exactly you can use them to make your scripts more useful in a network environment. Click here to download the accompanying source code.
</blockquote>
<p>
They show how to use <a href="http://php.net/fopen">fopen</a> to access remote sites, <a href="http://php.net/gethostbyname">gethostbyname</a> and <a href="http://php.net/gethostbyaddr">gethostbyaddr</a> for DNS resolution, <a href="http://php.net/getprotobynumber">getprotobynumber</a> to check the port number for a TCP/IP type and quite a few more. This also includes a brief look at the PEAR Net_Whois package. You can <a href="http://www.phpbuilder.com/columns/php-networking/NetworkingSourceCode.zip">download the examples</a> if you'd like to just jump into the code.
</p>]]></description>
      <pubDate>Wed, 15 Dec 2010 13:49:31 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Joshua Thijssen's Blog: Creating a traceroute program in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/15530</guid>
      <link>http://www.phpdeveloper.org/news/15530</link>
      <description><![CDATA[<p>
<i>Joshua Thijssen</i> has a new post to his blog looking at taking a common unix tool - traceroute - and seeing if he could <a href="http://www.adayinthelifeof.nl/2010/07/30/creating-a-traceroute-program-in-php/">translate it into PHP</a> where it could be called directly without the need for something like <a href="http://php.net/exec">exec</a>.
</p>
<blockquote>
Today i was reading upon <a href="http://blog.ksplice.com/2010/07/learning-by-doing-writing-your-own-traceroute-in-8-easy-steps/">this wonderful article</a> about writing a trace-route program in Python in 40 lines. Even though trace-route is one of the many tools i use on day to day basis, i never really got into writing a version myself (something I like to do just to gain knowledge how things works). So when I was reading this post, i thought, Python is nice, but is it possible to do it in PHP as well? The answer to that: yes and no..
</blockquote>
<p>
His post introduces you to "traceroute" (including a bit on how it works) in case you're either not a unix user or haven't gone much past some of the basics of the operating system type. One issues he butted up against was problems with the socket extension in PHP and inconsistencies with the underlying connection types. Another is the limitation of the tool only working as the root superuser. He includes the actual code and some sample output if you'd like to try it for yourself.
</p>]]></description>
      <pubDate>Thu, 02 Dec 2010 13:09:07 -0600</pubDate>
    </item>
  </channel>
</rss>
