Props  |  Art of War  |  Leadership  |  Management  |  Software  |  Security  |  Project Management  |  Music  |  Movies  |  Stuff  |  Info
 
dragonCrew Topics
Truism:
Good, Fast, Cheap. Pick any two - you can't have all three.

Poor management can increase software costs more rapidly than any other factor.

Planet PHP

 
Prev  Previous |  Next  next  

PHP


In the Beginning

Thanks to Kevin and Manfred for introducing me to PHP.

Kevin has been talking about Linux and PHP ever since I've known him - mid to late 90's. I didn't end up writing any PHP programs. It wasn't until Manfred got me involved indirectly by way of his NFL site. He'd asked me for some database advice. I had never used MySQL. I ended up helping to design the database. To make a long story short, in order to prove that the design was right, I had to write the SQL and the subsequent PHP code to CRUD the information.

Now look, I've written this site using PHP!!!

Why I Chose PHP

  • Adoption: Just look at the numbers. Rasmus Lerdorf, the creator of PHP, wrote an article, Do You PHP? that shows the explosive install base of PHP in 2004.
  • Money: Commercial languages means hosting is going to cost you. Cold Fusion hosting cost was more than I wanted to spend.
  • Hosting: Everywhere and Cheap. Of cource you have to find one that has the support and a ton of other things (real ftp, Control Panel, SSL, number of MySQL DB's, sub–domains, disk space, infrastructure etc).
  • Classes and Functions: Everywhere and FREE B! Why rewrite stuff that has been tried and true. You just have to spend time testing it.
  • Experts: Developers who are willing to share their knowledge. Sweet!
  • Scales: Chris Shiflett wrote PHP Scales. Rasmus says, "The shared-nothing architecture of PHP where each request is completely distinct and separate from any other request leads to infinite horizontal scalability in the language itself. PHP encourages you to push scalability issues to the layers that require it."
  • Clients: Win Win situation because clients are willing to pay for results!

I'm currently evaluating 3 MySQL classes to see which I will adopt. Well once I figure out how complete each class is for functionality. If someone's already developed a class then why reinvent the wheel.

The Soothingly Seamless Setup of Apache, SSL, MySQL, and PHP – How it Works. The article basically applies to all web development environments. Go figure, good documentation from the Open Source community!

  • Google – Why do you think it is conveniently located at the bottom of the page.
  • I guess you already knew about Google's newsgroups.
  • Everyone has a preferred method of learning. Some can just do. I've found that the the more experienced a developer is, then this inherently becomes their natural style.
  • Find a good book by asking other developers. I usually do this through the newsgroups or just finding reviews. It's funny, you can always tell who who the newbies are because they will buy a book that is the heaviest. Just an observation.
  • Give yourself an incentive by developing something. Or even better try converting an app/site that you're already developed in another language.

Who Uses PHP?

OK, I hate to name drop but here I go! OK, so can you and you probably will.:)

Yahoo

Read why Yahoo chose PHP or just download the PDF file pdf. Here is an interview with Rasmus Lerdorf, Senior Technical Yahoo.

Find out more from Michael J. Radwin talks.

  • Yahoo gets some obscene traffic - 411,000,000 unique visitors per month, 191,000,000 active registered users, 11,400,000 paying customers, and a boggling 3,400,000,000 page views per day.
  • Yahoo organizes code into four categories - HTML templates (95% HTML, 5% PHP), template helpers (50% HTML, 50% PHP), business logic (100% PHP), and core code written in C and C++.
  • Yahoo uses a very basic mod_php and loads extensions as necessary with php.ini.
  • For security, they use open_basedir, disable allow_url_fopen, and use the input_filter hook.
Michael Radwin, Yahoo, ZendCon Day Three – October 22, 2005

Digg

Digg gets approx. 200 million page views per month. Here is a fantastic article from Brian Fioca of Oreilly's ONLamp, Digg PHP's Scalability and Performance. The reason why this article is so critical is that Owen Byrne - Senior Software Engineer at Digg, addresses the business cost of the hardware, database and programming.

Language Wars

PHP vs ASP

PHP vs Java

Oh the ever growing language wars heat up once again. Let the mud slinging begin.

The simplicity of scripting language PHP means it will be more popular than Java for building Web–based applications, Internet browser pioneer Marc Andreessen predicted

"Simplicity is a huge part of it, " said Rod Smith, vice president of IBM's Emerging Internet Technologies Group, describing PHP's appeal to IBM in a meeting with reporters at the conference. "They weren't interested in adding language features to compete with other languages, " choosing instead "the simple way, and not the way we've done it in Java, unfortunately. "

PHP is more limited in scope than Java, which runs not just on Web servers but also on PCs, mobile phones, chip–enabled debit cards and many other devices. Some parts of the Java technology, though, such as Java Server Pages, handle much the same function.

The fact that IBM and Oracle are behind it–this is for a lot of IT (customers) a quality stamp. The big guys endorse it, so it must be good," Gerstel said in a meeting with reporters.

"JavaScript was, and now with Ajax is, the standard way to do client–side development in a browser, as opposed to Java, " Andreessen said. "Java applets in the browser never took to the extent some of us thought they would. "

Stephen Shankland, CNET, Andreessen: PHP succeeding where Java isn't – October 19, 2005
PHP Pinup

Becoming a Real Programmer

Robert Read's experience and insights are timeless. Be prepared, it's a lengthy read. But it's an absolute must read for rooks and even cowboys. Robert covers topics ranging from personal to team skills and everything in between!

To be a good programmer is difficult and noble. The hardest part of making real a collective vision of a software project is dealing with one's coworkers and customers. Writing computer programs is important and takes great intelligence and skill. But it is really child's play compared to everything else that a good programmer must do to make a software system that succeeds for both the customer and myriad colleagues for whom she is partially responsible. In this essay I attempt to summarize as concisely as possible those things that I wish someone had explained to me when I was twenty–one.

This is very subjective and, therefore, this essay is doomed to be personal and somewhat opinionated. I confine myself to problems that a programmer is very likely to have to face in her work. Many of these problems and their solutions are so general to the human condition that I will probably seem preachy. I hope in spite of this that this essay will be useful.

Software is more an art or skill than a science or engineering discipline. The most effective means of becoming a great programmer is through an apprenticeship (even if self–directed). There is no substitute for coding a big system that evolves over time. It seems to take about 2 to 3 years before somebody absorbs the important lessons. You can read books and papers in an effort to avoid common mistakes, but talking to and working with other programmers still seems to be the best (if slow) approach. As Chris Brooks says, becoming a commercial programmer is like becoming an architect; being a junior associate for a while is part of the process.

In this document, I have tried to remember and distill my hard–fought 3–year experience as I evolved into a programmer capable of building a commercial product, http://www.jguru.com (for more information on the evolution and design of the jGuru server, you can check out this lecture). Naturally this is a not complete list of programming advice, but rather what I learned on this project.

Terence Parr, Little Nybbles of Development Wisdom – October 31, 2002

Getting Started

To get you started, go and download XAMPP from Apache Friends. XAMPP is a package management application that installs all of the software listed below in one fell swoop on Windows, Linux and even Solaris. Sweet!

I have never used XAMPP or any other packaged installer. I'm old school, believing you have to know as much or if not everything about the software you're going to be using. I was surprised at how relatively easy Apache, PHP and MySQL are to setup and integrate. You just have to read the doc's. Now tuning and programming is a different story. But if you're a developer then you should know your tools.

I've been using Apache with Windows NT4 and Windows 2000 for about 5 years in a production enviroment and I can truthfully say that I've never had a problem. I was able to tune Apache so that it could handle 100's of threads more than IIS. A tech head from Rackspace was stunned that I was using Apache with Windows period. You should of heard his voice, just stunned amazement!!!

Practical PHP Programming

There are are a ton of online resources for learning PHP. Paul Graham's book, Practical PHP Programming is online. Paul has also included all of his past articles! Now that's what I can sharing.

MVC Frameworks

I've spent sometime scouring over a bunch of PHP MVC frameworks. Intellectually, I'd love to to forget about the repetive and boring stuff such has creating forms, validation, database, ACL, mail, caching and session management to name a few.

But to tell you honestly, some of the frameworks are abstracted and objectified to death. This means that people are making complex. The other negative is their templating forces you to use another language. I'm specifically talking about Smarty. Definitely, no thanks.

No wonder developers have a hard time writing and maintaining code. Wells the documentation again? hehehe!!!

Fabio Cevasco does a nice write on Rails-inspired PHP frameworks showing the pro's and con's of each.

Advantages of MVC

Disadvantages of MVC


Name Rating Description
Blueprint For Php Applications: Cornerstone Frameworks PHP Best Practices
CakePHP Wired Cake is a well done port of the Ruby on Rails framework to PHP. This includes all its Ajax integration with the prototype js lib. Cake is a rapid development framework for PHP which uses commonly known design patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC.
symfony ? Too bad I don't have PHP5 installed. Features: simple templating and helpers, cache management, multiple environments support, deployment management, scaffolding, smart URLs, multilingual and I18N support, object model and MVC separation, Ajax support
The value of MVC Frameworks I think we are seeing the same transition now in the web application space. Web MVC brings a standard structure to web applications, and in a way, once again takes over the OS event interface for web applications. In 2007, writing a web application without an MVC framework will seem as quaint and be as rare as a polling event loop is today in a GUI application. The emergence of web MVC frameworks is a sign that we as a profession are mastering the art of building web applications. Check out Model View Controller
Why MVC works for Web Applications Frameworks The largest stickler with MVC, is seperations of Data and Presentation. This is remarkably similar to the current web standards push of seperating Semantic Markup (Data) and Design (Presentation) through the use of CSS-P. This is, I believe another small part of why MVC is seeing much more hype lately. Go look at a lot of Ruby on Rails websites, see how many are using CSS in abundance?
Why Frameworks Suck Frameworks And this is ultimately why I think frameworks suck. Learning a framework is really like learning a language. A framework adds a level (or more) of abstraction to the overall rendering process. As a result, when something goes wrong, more work goes into understanding how the framework ticks than solving the problem. Here is a follow up redux
Top 10 PHP MVC frameworks Frameworks A good framework is easy to learn, simple to use, intuitive to work with, easy to extend or to modify, rapid to build (maintain) applications with and of course stable.
Taking a look at ten different PHP frameworks Frameworks "PHP frameworks are the latest hot topic in the PHP community, and new frameworks are being released daily. With over 40 frameworks available it\'s difficult to decide which framework works best for you, especially as each framework offers different functionality."

Improve Performance

A little–used or discussed feature of PHP4 is the ability to compress output from the scripts using GZIP for more efficient transfer to requesting clients. By automatically detecting the ability of the requesting clients to accept and interpret GZIP encoded HTML, PHP4 can decrease the size of files transferred to the client by 60% to 80%.

PHP 4 – The Good

  • Brian Bailey's provides an excellent article on .NET vs PHP, Why the Switch?

PHP 4 – The Bad

  • Dates and Time functions!
  • Persistentcy is the weak point in PHP against Java.
  • Exception Handling

PHP 4 and PHP 5

Here's some nice articles on running both PHP 4 and 5 on Windows.

Migrating to PHP5

WOW, where to start? First, wait for the my host to upgrade, wait for all 3rd party app's, classes and functions to be fully compatible and then test like a dog! Lastly, close my eyes and flick the switch. Like most developers, I've got PHP 4 app's that will require much attention. Me-ouchhh.

HOWTO

Article Type Description
Getting started with objects with PHP V5 Classes From IBM. This article describes the fundamentals of objects and classes in PHP V5, from the very basics through to inheritance, for experienced object–oriented programmers and those who have not yet been introduced to objects.
Guidelines for Designing Classes Classes In this article we'll look at a few essential tips which may help in designing classes, to help in writing flexible and re–usable code. The idea is to lay some foundations as a platform for taking advantage of design patterns.
A Few Tips for Writing Useful Libraries in PHP Libraries 20 Great tips from Kellan, the creator of MagpieRSS
Getting started with objects with PHP V5 Objects Object basics. Now here is "Advanced PHP V5 objects
Using PHP's Custom Error Handling to Control Applications Error Handling PHP's custom error handling is a powerfool tool to create advanced PHP applications. This article looks at one novel use of custom error handlers for building a Controller in an MVC pattern.
Installation on Windows systems Installation Tips and Tricks, i.e. install PHP 4 and 5 on the same Apache server
PHP 4 and PHP 5 on the Same Windows 2000 Computer Installation This is a tutorial on how to install two parallel running webservers with PHP 4 and PHP 5 and multiple MySQL database server versions all on the same machine and have them live happily on your computer.
Installing Apache, PHP5, MySQL and phpMyAdmin on Windows XP Installation This document explains how to set up a WAMP (Windows Apache MySQL PHP) development environment on a Windows XP/2k machine, without having all the clutter a package installer creates.
Implement Bayesian inference using PHP, Part 1 Probability Conditional probability – the probability of observing one event as a result of having observed another event – is a potentially important factor in designing intelligent Web applications. Paul Meagher introduces Bayesian inference by discussing the basic mathematical concepts involved and demonstrating how to implement the underlying conditional probability calculations using PHP. In this article, the author discusses how Bayesian inference can be used to build an online PHP–based wizard that guides a user through the process making a medical diagnosis. This three–part series features interesting applications designed to help you appreciate the power and potential of Bayesian inference concepts.
PHP MySQL Connector for Windows MySQL Windows In late 2005, MySQL began releasing its own builds of libmysql.dll, php_mysql.dll and php_mysqli.dll for the latest version of PHP 5, christening the packages Connector/PHP. If you have downloaded PHP 5 (not 4!), download these Connector/PHP zips from http://dev.mysql.com/downloads/connector/php/, and unzip them into the folder where you installed PHP 5, overwriting files of the same name.
Remote Scripting with IFRAME JS Huh, from Apple no doubt.
Expandable Listmenu Script Menu Javascript Expandable Tree Menu
ajax im IM OMG. Definitely MUST HAVE
Building Modular XHTML Web Pages with PHP XHTML A series of labs describing the process of building modular, structured and valid XHTML Web pages using the PHP server-side scripting language.
Top 7 PHP Security Blunders Security Unvalidated Input Errors, Access Control Flaws, Session ID Protection, Cross Site Scripting (XSS) Flaws, SQL Insertion Vulnerabilities, Error Reporting, Data Handling Errors. Configuring PHP For Security and MORE!
Ajax & PHP without using the XmlHttpRequest Object Ajax Definitely on the must read list!
Creating a MySQL connection with PHP/Ajax MySQL Simple tutorial on creating a connect to MySQL with all the neccessary code.
Guide to Using Ajax and XMLHttpRequest from WebPasties Form Plain and simple tutorial with sample code
Building an Ajax–Based Chat: The Barebones Structure Chat The title says it all
Benchmarking PHP with no BS Performance (a) Choosing appropriate algorithms (b) Understanding the performance characteristics of PHP (c) Tuning your application subsystems, such as the operating system, the caching sub-system, the network, and your database
20 ways to Secure your Apache Configuration Apache Good tips with proper perspective on performance!
APC and eAccelerator Benchmarks Caching Tim Door tests APC, eAccelerator, Zend Optimizer and no cache in Sept. 2005. The results show APC is the winner. APC is an opcode cache for PHP. See Using APC functions in your PHP scripts. Here's a good resource APC Manual
Accelerating PHP Applications Apache Ilia Alshanetsky's slides from PHP Conference 2004
PDFB Library - Barcodes in Dynamic PDFs PHP If you've ever wanted to generate PDFs on-the-fly on your server and wanted to do more than just plain text, PDFB Library just might be what you're looking for.
Tips for PHP Developers PHP The list is broken up into five different sections - Security, Preformance, Tools, New Technologies/Techniques, and the Speakers/Site/Blogs/Lecturers from the conference. Most of the items are just random bits from several of the talks that he attended, but still provide a great deal of information not only about the conference, but about the current state of PHP in general. Great Tips
Tuning Apache and PHP for Speed on Unix PHP John Lim the creator of ADOdb, provides tips and links to other sources. A must read.

Web Application Stress Tool

ApacheBench (ab) is a nice tool for sending large number of HTTP requests and measuring the response times. But it has its limitations. There are serious scalability issues when you want to test anything that involves sessions. ApacheBench limits you to one hard-coded PHPSESSID. If you run 10 concurrent threads, the threads will be serialised because the session file will be constantly locked. This means your benchmark figures with ApacheBench will be wrong if you are using sessions - the figures will be too low. One other symptom of this behaviour is no matter how many requests you pump to the server, the server continues to idle 70-80% of the time, and the throughput (pages/second) remains static.

That's when you have to throw away these simplistic tools and bring out the rectal probe. My favorite web server probe when ApacheBench is insufficient is Web Application Stress Tool (WAST), a free download from Microsoft.

WAST allows you to run multiple threads (similar to the -c parameter in ab) in a benchmarking test. You can assign virtual users to each thread, and each user can be assigned a unique cookie. This allows you to assign different PHPSESSID's to each thread.

West Wind's presentation on Microsoft's Stress Testing Web Applications using WAST.

John Lim, Rectal Probes and Benchmarking with WAST – March 14, 2005

Ajax

Tutorials

Framework and Libraries

The Open Source Applications Foundation (OSAF) has a list of Open Source libraries, with pros and cons, Survey of Ajax/JavaScript Libraries.

Michael Mahemoff, does a good job at listing and commenting on Ajax Frameworks round–Up from pure Javascript and PHP to everything else under the sun. Ajax Matters has a fuller list with short descriptions.

Server Side

Name Rating Description
AjaxAC Tired Ajax library for php with a focus on doing all the coding php side. Allows for very clean html, as all the javascript is generated from your php classes. Basic development is object oriented and widget based. BUT it's not ready for primetime just yet. A whack of missing must have capabilities, i.e. Cross-browser compatibility, debugging and XML support to name a few!
CPAINT Tired Very little forum activity. CPAINT (Cross-Platform Asynchronous INterface Toolkit) is a multi-language toolkit that helps web developers design and implement Ajax web applications with ease and flexibility. It was originally born out of the author's frustration and disappointment with other open-source Ajax toolkits.
HTML_Ajax Watchlist Pear Package for Ajax and PHP
JSON-PHP Wired PEAR! Mike Migurski the creator of JSON-PHP based on JSON which also has other ports
Pajax Tired PHP objects to be made remotable in JavaScript, using XMLHttpRequest.
PAJAJ ? PHP5 - good examples. PAJAJ: PHP Asynchronous Javascript and JSON
SACK Forget About It No action
Sajax ? Lite Weight. Sajax Still UnSafe. Here is a tutorial from IBM, Using Ajax with PHP and Sajax. Save yourself the hassle - just download the code and PDF file!
xajax Alpha Has a reasonably active forum. open source PHP class library that allows you to easily create powerful, web-based, Ajax applications using HTML, CSS, JavaScript, and PHP. Applications developed with xajax can asynchronously call server-side PHP functions and update content without reloading the page. Here's a good end-to-end example from Michael Bommarito. Check out the tutorial, Easy Ajax for the masses with xajax and demos
XOAD Wired XOAD formerly NAjax is a PHP Ajax framework using JSON. Not only does it look easy to use, it also appears to have well-written and well-documented code.
phAtJAX ? Tons of features!

Client Side

Name Rating Description
Google AjaxSLT ? AjaxSLT is an implementation of XSL–T in JavaScript, intended for use in fat web pages, which are nowadays referred to as Ajax applications. Because XSL–T uses XPath, it is also an implementation of XPath that can be used independently of XSL–T. Too bad Safari doesn't support XSLT from Javascript
XHConn ? Pure Javascript. Thin wrapper around XMLHttpRequest
Prototype ? unique, easy–to–use toolkit for class–driven development and the nicest Ajax library around, Prototype is quickly becoming the codebase of choice for Web 2.0 developers everywhere. Also used in other projects, i.e. Ruby on Rails and Rico.
Rico ? Rico originated as work done in Sabre Airline Solutions to create a suite of rich internet components, behaviors and effects for the web application space
qooxdoo So Wired Qooxdoo is an Open Source (licensed under LGPL) DOM–based javascript toolkit. Qooxdoo starts where simple HTML is not enough. It can help you get your rich web application interface done easier than ever. Here's the toolkit for building a MS Windows web site – Me Likey
Flash / JavaScript Integration Kit ? The Flash / JavaScript Integration kit makes it possible to seamlessly communicate between Flash and JavaScript. You can call JavaScript functions from Flash, and ActionScript functions from JavaScript.

Tips

Article Type Description
Ajax What Is It Good For? History 101 covers not only how to code in Ajax, and to implement it into your site, but also the history of it, and how it came to be
Usable Interactivity with Remote Scripting Tutorial A good read if you are still having trouble understanding Ajax, and remote scripting.
Degradable Ajax Form Validation Forms provide real-time feedback to the user using server-side validation scripts and eliminate the need for redundant validation functions without giving up a solution that degrades gracefully when JavaScript is disabled.
Design Patterns for Ajax Usability Design The point is to discover best practices by investigating how developers have successfully traded off conflicting design principles. Ajax is all about usability, so the patterns focus particularly on delivering usability in the face of constraints, most notably: user capabilities and expectations, bandwidth limits, the stateless nature of HTTP, the complexity of Javascript.
Google Maps via PHP/Mysql Tutorial Forms provide real-time feedback to the user using server-side validation scripts and eliminate the need for redundant validation functions without giving up a solution that degrades gracefully when JavaScript is disabled.
How to Handle Bookmarks and Back Buttons Programming RSH is a simple module that can be included into existing Ajax systems. Further, the Really Simple History library uses techniques to avoid the bugs that affect other history frameworks.
Javascript Benchmarking - Part I Article The Javascript implementation is the fastest method one can use to insert HTML into a web page [1]; a string array is used to store all the rows of the table after which the array join method is called to return a string that is inserted into the DOM using innerHTML, just as the XML/XSL approach does.
Ajax Tutorials Tutorials Brad Neuberg has started created a bunch of nice tutorials; Saving Session Across Page Loads Without Cookies, On The Client Side, A Tale of Two IFrames (or, How To Control Your Browsers History), How to Catch Evil Errors with OnError and more!
XMLHttpRequest - Security Bypass Tutorial Firefox is more stringent about security! Learn all about it
The Hows and Whys of Degradable Ajax Tutorial Includes code - sweet
Fighting Ajax's Enemy: Legacy HTML Forms Tutorial Many designers have jumped on the Ajax/Javascript/Shiny bandwagon, developing interactive-this or on-the-fly-that, but nobody has stopped to address Ajax from a very common business standpoint. It's not always feasible to convert everything at once, nor is it always possible to work in a world of non tabular layouts. This is one designer's story
Ajax FAQ for the Java Developer FAQ FAQ is targeted for Java developer that would like to add Ajax functionality to an application.
Javascript Programming Conventions Guide Article follows the basic outline of the Java Programming Conventions Guide, a copy of which may be found at http://geosoft.no/javastyle.html
10 Realistic Steps to a Faster Web Site Article I'd like to give you a more realistic guide on how to achieve the goal. I have written my master thesis in computer sciences on this topic and will refer to it throughout the guide.
Technorati API Service Example using DuckSoup. Marco Rosella put together the Technorati API, the Duck Soup PHP library, and good old XMLHttpRequest, and built an ajax technorati query.
Speed up your AJAX based webapps Code After facing the trouble of a slow server and the JavaScript file being downloaded every time, I came up with this solution for PHP and .net based web application. You need to download getjs.php or getjs.aspx depending on your server.
Devise Web 2.0 applications with PHP and DHTML, Part 1: Cook up your own with these recipes Code Create popups, show/hide, spinners and tabs
Scriptaculous Cheat Sheet #1 Code Combination Effects Cheat Sheet by Amy Hoy
 

PHP B-Roll Collapse

CakePHP B-Roll Collapse

Yahoo'er Collapse

Forums Collapse

Frameworks Collapse

Code Collapse

RSS Collapse

XML Collapse

Security Collapse

Design Patterns Collapse

Resources Collapse

Presentations Collapse

Apache Collapse

Open Source Collapse

Coding Guidelines Collapse

Books Collapse

XForms Collapse

Web Hosting Collapse

Rollyo

Make Poverty History
 

 
Top of Page