This marks the Friday prior to the start of the Adobe MAX conference. I was asked to speak on the topic of integrating Flash and PHP and I will be.
I’m working on an example of mobile detection with the new Zend Framework 1.11 beta that was just released when I came upon an interesting problem. That problem is; how do I debug requests coming in from the mobile phone? The answer is actually relatively easy. I’m doing this using a Zend Framework application, but the concepts that you’ll see here can be used quite easily across any type of framework.
Tis the season for Zendcon. I am going to be giving a talk at Zendcon called “Do You Queue”. It will be about doing asynchronous computing in PHP. In order for me to gather some data I posted a twtpoll poll. The response has been pretty good. However, there have also been several misunderstandings as well. A few of them:
With the book out and released I now reach the final chapter excerpt that I will have. As I said in one of my previous chapter excerpts, I did not write this book to cover a wide range of topics. I wrote it to cover a narrow range of topics, more fully. But the topics I chose were based off of my experiences as a Zend Consultant for several years. If you are someone with 2-5 years of experience (the typical requirement for a PHP job) you need this book. This book was born out of my experience dealing with code written by people with 2-5 years of experience, sometimes more.
There is a bunch I could say to introduce this chapter. However, I think that by reading the first few paragraphs you will know what I’m talking about. For those who are experienced developers some of these items might seem a little basic, but there are reams and reams of PHP developers who do not follow several of these rules.
In other news, “You want to do WHAT with PHP?” is now available for purchase in the Amazon store.
PHP is a langauge generally not suited for running daemons. That said, PHP can do it, and in certain circumstances does it sufficiently for the job. In this chapter we look at some of the things you need to know about to build a PHP-based daemon. This excerpt doesn’t feature any code, but it does set the foundation for why I think PHP is fine for daemons in some circumstances. Later in the chapter we get into the code.
Most PHP developers are used to dealing with files. Files that are uploaded, downloaded, etc. If we work with data files it is usually in the form of XML or CSV or something like that. But what if the files that users were uploaded and downloading had information in them that you wanted to get. Say that you were hosting MP3 files on your website that people could upload. You might want to get the ID3 information that states who has the copyright. Or if people were uploading Word documents and you wanted to get author information. There are often libraries available to read certain file formats in PHP, but more often than not, there isn’t. The purpose of this chapter is to get you started in being able to read and understand binary files. Even if you aren’t using them directly in your application, knowing how to read them is a good exercise since there is a good chance that at some point you will need to be able to work with them. Even if it’s something that you would be writing a one-off script for to do some basic data transormation, knowing how to access binary files is a good thing and, as I said earlier, a lot of PHP developers don’t do this.
So I was sitting here thinking to myself “This is Friday and I’m not getting much of anything done. Maybe I should write another Friday Framework Highlight.” I figured that it was a good idea so I pondered what I should write. I came up blank and so I asked Matthew Weier O’Phinney. “Multiple writers for Zend_Log,” he said. I agreed.
One of the things that I think PHP developers do not do well is asynchronous processing. PHP developers have written reams of applications that do all their calculations up front and over-and-over again for multiple requests. Or they will just write their code to work linearly, regardless of the scalability implications. In this chapter I wrote a simple example showing how you can do some asynchronous processing. It is a basic example that I use and there is a LOT more I could have talked about, and perhaps I should have. But this example will get you started thinking about how to architect your application so that you can greatly increase the scalability of your application.
I was getting ready to post the Powerpoint presentations from my last two user group meetings when I fat-fingered my “My Documents” folder and accidentally opened up a Word doc that had an old article that I had written for a Zend newsletter a while ago. So for this case of serendipity I decided that I would repost this article, which I had written long before I had a blog. The basic premise is that once you get past a few minor differences, an organization can move from Java development to PHP development in a very short amount of time, saving time, money and headaches.