PHPTutor.info - The Place to Start for PHP Programming
PHPTutor.info is the place to get started with PHP, the powerful open-source
server side scripting language. For starters, we have prepared a totally syndicated tutorial
section that lists recent PHP tutorials to keep you updated.
You will also find useful PHP discussion links and recommended PHP scripts
that have been downloaded by many PHP developers.
Our PHP Security section will focus on how to establish secure coding habits that will help minimize hacker exploits to your scripts.
What is PHP?
Some of you may wonder what PHP is, and what can it do for you. To explain simply, PHP stands for Hypertext Preprocessor. It is a server-side programming language that can be used to create applications from the most simple HTML website to extremely complex multi-platform implementations. Popular applications coded using PHP include Friendster and MyBlogLog. PHP is also the primary languages for many open-source applications such as PHPbb, PHP-Nuke and WordPress.
PHP News - Powered by PHPDeveloper.org
- Gonzalo Ayuso's Blog: Using Monkey Patching to store files in CouchDb using the standard filesystem
Gonzalo Ayuso takes his "CouchDb as a filesystem" approach one step further (see the previous post about it here) with this new post talking about monkey patching to store files into the CouchDb server using the normal PHP file handling functions.
Since PHP5.3 a new design pattern is available for us: Monkey Patching. With this pattern we can override PHP's core functions with a home-made functions in a different namespace (another example here). That's means if I have fopen function in the above example, PHP uses the filesystem function "fopen" but if we set a namespace in our example, PHP will search first the function within the current namespace.
By defining the new interface inside of a namespace (with functions to override the default PHP file handlers) you can have the rest of the code call the same functions (fopen, fread, etc) but they'll do different things. In this case it handles them as push and pull to the CouchDb instead of the normal filesystem. You can grab the source for this example here.
- Kevin Schroeder's Blog: You want to do WHAT with PHP? Chapter 4
Kevin Schroeder has another new post to his blog today with an excerpt from his "You Want to Do WHAT with PHP?" book. This new post is a section from the fourth chapter looking at stream handling.
Communication is key to building applications now and for the future. While it is not something that I think that everyone should do, I have not seem many applications that make good use of streams in PHP. Streams can be immensely useful in the right situations, but a lot of developers are not really aware of how streams can be used. [...] While I don't think you will end up basing your application around streams it is a really good idea to know how streams work.
The sample code (and description) talk about changing the properties of a stream on the fly. He shows how, with a fgets loop checking the input, he can catch a command from the already running script and change the compression setting on the currently open stream. The compression changes the stream's data from plain text to a binary format as handled by the streams functionality.
- TechTatva.com: [How To] Setup Cherokee with PHP5 FPM
On the TechTatva.com site today there's a new tutorial posted about getting the Cherokee web server set up and running PHP5 FPM. It's a few simple steps to install and a few clicks around the GUI to get things configured.
In this "how to" we will see how to setup cherokee on Ubuntu with PHP5-FPM (FastCGI Process Manager). Although the cherokee CookBook claims that "If PHP-fpm binaries are found, those will be prioritized over the regular binaries." it turns out that the latest stable version of cherokee in Launchpad gives errors while enabling
A few calls to "apt-get" install some packages (Cherokee and php5-fpm) and changes to the Cherokee configuration - handled through its web-based interface - are all that's needed to add a new behavior rule to the default vServer to link to the PHP5-FPM install (as FastCGI).
- Zend Developer Zone: Zend Framework is a BOSSie Award Winner
According to this new post on the Zend Developer Zone, the Zend Framework has won itself a BOSSie award (from InfoWorld) in the "best open source application development software" category. Matthew Weier O'Phinney has this to say about the award:
I am one of the privileged few to have worked with Zend Framework since before the original public pre-alpha release. [...] What [Mike Naberenzy] showed me at the time captured my imagination: the company with the best known name in the PHP industry was building an application framework, and the code I was seeing was simple, straight-forward PHP. It was the first time I'd seen a framework I was actually interested in using -- even if it was in its early, early infancy. I knew at that moment that I wanted to be involved in the project.
He mentions some of the things that "shook up" the development world when those first versions of the Zend Framework came out - like the PHP5 requirement and the CLA you had to sign to contribute.
Other BOSSie award winners include jQuery, Apache Hadoop, Git and Go.
- ThinkPHP Blog: Contributing to Zend Framework
On the ThinkPHP blog today there's this new post talking about open source contribution and, more specifically, making contributions to a popular PHP project - the Zend Framework.
Who hasn't ever started writing his own Framework/CMS? It is considered best practice for learning purposes, but going through all the security stuff can be stressful and boring at the same time. That's where most devs start to contribute to big Open Source-projects like Typo3 or the Zend Framework, because they are already experienced working with it and yet evolving another system on the market or even getting people to contribute seems like an unachievable task.
They talk about the evangelizing that all of the Zend Framework tutorial posts do to further the cause of ZF use and how they can help introduce beginners to the framework even easier than them trying to submit bugfixes right from the start. They also talk about the process of contributing back to the Zend Framework - signing a CLA, reading the standards, grabbing the code from the subversion server and checking out the bug tracker for things to get in and fix (and write unit tests for, of course).
- Developer.com: Getting Started with Memcached Distributed Memory Caching
On Developer.com today there's a new article talking about memcache and how you can implement it in your application to provide a performance boost for applications in a distributed environment.
As distributed system is part of the Memcached definition, you can install Memcached on various servers to make a larger caching server. In this way, Memcached helps reduce database loads to a minimum, resulting in faster and more responsive Web applications
They take some time to explain what memcache is - a simple to use caching system that reduces the dependency on other data sources - and how to get it installed (via the package manager of your choice). They suggest times on when and when not to use it as well as some of the security implications you'll need to worry about when implementing it. There's also a bit of sample code to help you get started in your application. You'll need the memcached extension to make it all work, though.
- AjaxRay.com: Extending Zend Form Element to create customized Phone number field
On the AjaxRay.com site today there's a new tutorial for the Zend Framework users out there with a library they can use to extend Zend_Form for custom phone number fields.
When taking Phone number as user input, we can worn users about phone number format by setting a hint/description and can validate using Regular Expression. [...] Now, if we try provide this feature in Zend Form, that's possible. We can create three individual Zend_Form_Element_Text objects and join there value together to make the phone number. But, in this case, validating them together is a hassle.
Instead of separate fields, the library they create makes it simple to handle them as a whole field. It works as a helper for Zend_Form and lets you set things like the separator between the text fields, a "format" string and a validator to apply to their fields (in the example code, it's the "digits" validator). Sample code is included to show you how it fits in your form.
- Site News: Blast from the Past - One Year Ago in PHP
Here's what was popular in the PHP community one year ago today:- Community News: PHP Cache Accelerator for Windows
- Joomla Blogger: Update: Joomla 1.6 Release Plan
- Developer.com: Build your own MVC Framework: Making Headway
- Lorenzo Alberton's Blog: Create a video preview as animated GIF with FFmpeg and PHP SPL
- David Kent Norman's Blog: Drupal on Snow Leopard
- Davey Shafik's Blog: Fixing ZDE 5.5 on Snow Leopard (Crashing & Text Selection Bugs)
- Web Development Blog: Sending e-mails via SMTP with PHPmailer and Gmail
- NETTUTS.com: CodeIgniter From Scratch: Day 5 '" CRUD
- Blue Parabola Blog: Magento Feature Analysis Series, Part 7: Order Management Offering
- Samuel Folkes' Blog: Where Has All The PHP Gone?
- Daniel Krook's Blog: Technology of the day: Zend Server
- The Bakery: Clearing Up Some Confusion on the Release Versions of CakePHP
- Benjamin Eberlei's Blog: Enums in PHP
- Dagfinn Reiersol's Blog: Don't refactor without unit tests
- DevShed: Sanitizing Strings with Filters in PHP 5
- Gonzalo Ayuso's Blog: Using CouchDb as filesystem with PHP
In a new post to his blog Gonzalo Ayuso shows an interesting use for the CouchDB tool - using it as a filesystem for cross-server handling of things like images or other binary resources.
One of the problems I need to solve in my clustered PHP applications is where to store files. When I say files I'm not speaking about source code. I'm speaking about additional data files, such as download-able pdfs, logs, etc. Those files must be on every node of the cluster. [...] CouchDb has two great features to meet or requirements with this problem. It allows us to store files as attachments and it also allows to perform a great and very easy multi-master replica system.
He shows how use two libraries he's created to connect to the CouchDB instance and, based on this structure, be able to insert the content - a text file in this case - pull it back out, get the meta data about it and even move it to another location in the structure.
- Web Builder Zone: The different kinds of testing
On the Web Builder Zone (from DZone) Giorgio Sironi has posted a new article that talks about the different kinds of testing you can do on your application - both on the frontend and backend.
Automated testing supports your constant effort in design and refactoring, and besides that ensures that your application actually works in a reliable and repeatable way. [...] In this article I'll describe the different categories of testing, as applied to a Zend Framework 1 application, but this classification pertains to every web application based on object-oriented programming. Since this kind of applications is obviously PHP-based, PHPUnit will be the tool of choice along with some of its standard extensions.
He looks at five different types of testing you can do on your application:
- Unit testing
- Pragmatic unit testing
- Functional testing
- Integration testing
- Acceptance testing
Not all of these can be done with PHPUnit on the backend, but they (mostly) have automated tools of their own like Selenium for frontend interface testing.

