PHP

Zend Framework 2.0 Buzz

Zend Framework logoThe buzz behind Zend Framework 2.0 is growing rapidly everyday, and not without good reason.  Zend Framework 2.0 will utilize the very best of PHP to create a more stable, secure, and better performing framework.  Although nothing is set in stone, listed below are some of the highlights so far:

  • Minimum version:  PHP 5.3+
  • Not backwards compatible
  • Improved consistence between componenets
    • __construct() – Constructors will accept options via arrays or Zend_Config
    • Option keys will not use camel caps or uppercase, but instead will utilize lowercase underscore-separated words
  • Elimination of most singletons
  • Utilization of PHP 5.3 features
    • __invoke() and closures – for use within plugin architecture
    • Namespaces – to help with the super-long class names (Zend_Search_Lucene_Analysis_Analyzer_Common_TextNum_CaseInsensitive comes to mind)
    • goto – to be used when creating Finite State Machines (FSM) and parsers (Zend_Search_Lucene, Zend_Ical, Zend_Markup)
  • Autoload-only for all ZF components
  • Zend_View
    • Allow optional use of streams for systems where short_open_tags are disabled
    • Automatic escaping of variables
    • Use PluginLoader instead of internal system for managing plugins

There’s a lot of great discussion going on within the official Zend Framework 2.0 Roadmap, as well as a general outline on Zend’s plans, so get over there and read up!

Zend_Search_Lucene_Analysis_Analyzer_Common_TextNum_CaseInsensitive
Share

Stability, security-focused PHP 5.2.13 released today

PHP 5.2.13 was released today, fixing over 40 bugs.  PHP recommends that all users on the 5.2 branch upgrade as soon as possible.  Included below are various bugs fixed in this release, and links to the official changelog, release announcement, and download page.

  • Improved LCG entropy (security)
  • Fixed safe_mode validation inside tempnam() when… (security)
  • Fixed open_basedir/safe_mode bypass in session extension (security)
  • Upgraded to PCRE 7.9
  • Fixed strip_tags() bug that removed parameters over 1023 bytes even when in exclude list
  • Regarding define() and defined()
    • :: was allowed to be included within constant name using define(), issuing a fatal error vs. E_WARNING
    • defined() no longer requires a class to exist when testing class constant
  • PHP 5.2.13 Changelog
  • PHP 5.2.13 Release Announcement
  • Download PHP 5.2.13
Share

Optimize PHP, Apache & MySQL for performance

Two MySQL tuner scripts

MySQLTuner (Perl) and MySQL Performance Tuning Primer (Shell) are two scripts that can help diagnose MySQL database performance issues, and provide recommendations on how to solve them.  While both scripts output similar information, the diagnosis can be slightly different with each script, so I like to use both.  Below are directions on how to use them, as well as a few screenshots.

# Download MySQLTuner and MySQL Performance Tuning Primer to ~/scripts.
# To avoid having to invoke Perl/SH each time, make both files executable.
chmod +x ~/scripts/mysqltuner.pl
chmod +x ~/scripts/tuning-primer.sh

# After that, give them a go!
~/scripts/mysqltuner.pl
~/scripts/tuning-primer.sh

Read the rest of this entry »

Share

Major improvements in TPC! Memory Usage for WordPress

Over the past few weeks, I’ve been actively developing some long-awaited TPC! Memory Usage features.  The highlights of the latest release are listed below.  I believe that these will help WordPress developers and administrators improve scalability and performance of their blogs and custom applications.

  • Custom checkpoints allow administrators to measure memory usage anywhere a WordPress action is available.
  • Optional file logging allows administrators to have an effective way of tracking memory usage.
  • Improved Security Check, and listed additional variables in System Overview.
  • Fixed various bugs (special thanks to those who have taken the time to report issues).

As we continue to improve TPC! Memory Usage and implement new features, we would love to hear your thoughts.  Feel free to leave a message on the official TPC! Memory Usage page.  As always, thank you for your continued support.

Download TPC! Memory Usage

Share

PHP 5.3.1 now available in WHM/cPanel’s EasyApache

After much patience and persistence on the part of myself and many other individuals, we now have PHP 5.3.x support in EasyApache, starting with PHP 5.3.1.  For those of you who may be unaware, EasyApache is WHM/cPanel’s tool for creating custom compilations of Apache and PHP.  This solves many problems for those who have been doing this “behind the scenes,” as well as those who wish to utilize some of the great new features implemented in the 5.3 series.  PHP 5.3.1 introduces namespaces, late static binding, decreased memory usage (YMMV), several new extensions, and improved MySQL support.  Be sure to check your scripts for compatibility before going live with PHP 5.3.1 on a production server.  Some scripts will be affected by some of the changes, so testing is extremely important.

Share

Using memcached with WordPress

wp-settings.php

wp-settings.php

Today, I decided to implement a popular distributed caching system called memcached.  Memcached allows PHP objects and variables to be stored in memory, which when used properly, can decrease page load time and server load.  Memcached can also work as a central cache for a cluster of servers.  File-based caching systems work by generating static files, and storing them in a local directory to be served in place of the dynamic content.  This can reduce the number of database queries, and help avoid having to process the script with each new request; however, there is a downside. Read the rest of this entry »

Share

PHP 5.2.12 released

PHP LogoWe’ve been paying close attention to new PHP releases, with a focus on the 5.3.x series release branch, but an important security update has been made to the 5.2.x branch.  The new max_file_uploads PHP directive will prevent DOS (denial of service) attacks that happen by using file uploads to create temporary file exhaustion.  This is an important one, and should be implemented as soon as possible.  Links to the release announcement, changelog, and download page are listed below.  On a side note, WHM/cPanel has not updated EasyApache yet, but we are assuming this will come soon.  We’ve also gotten word that, due to popular demand (thank you everyone), cPanel is working as fast as possible in getting PHP 5.3.1 into EasyApache (see cPanel forum post for more info: http://bit.ly/931YpZ).

Download PHP 5.2.12

http://www.php.net/releases/5_2_12.php
Share

Generate HTML drop downs from arrays & ranges with a PHP class

There comes a time (or a multitude of times) where a developer finds him- or herself rewriting the same code over and over again. Eventually, we get tired of it and need to find a solution. Recently, I frequently found myself writing code to generate HTML drop downs.  This became tedious, and I started to think it was unnecessary. But wait!  There must be a better way!  I didn’t want to use Zend_Form or any other 3rd party solution; I wanted to create my own class to help take care of this problem.  Below is the code/examples for the class, then a description of some of the methods, and lastly a link to download the source code.  As you can see, there are some nice features, and the class is easy to use and extend. Read the rest of this entry »

Share

PHP 5.3.1 is finally here!

PHP LogoAfter four release candidates, we finally have a stable PHP 5.3.1 release.  For those already running PHP 5.3.0, there’s not much that is different, but there are some improvements.  For others, it means there will probably be PHP 5.3 support in cPanel/WHM via EasyApache very soon.

In PHP 5.3.1, the max_file_uploads directive was introduced into php.ini to help prevent DOS (denial of service) attacks via file exhaustion.  max_file_uploads is set at 20 by default.  There were also several other security issues patches, and many bugs fixed in this release.  Links containing additional details are below:

Share

PHP 5.2.12 RC1 and PHP 5.3.1 RC4 released!

Yes, that’s right, another PHP 5.2 version, and the fourth release candidate for PHP 5.3.1… the details are as follows:

  • PHP 5.3.1 RC4
    • Three bug fixes including one for mysqli and safe_mode_include_dir
    • Complete list
  • PHP 5.2.12 RC1
    • Added max_file_uploads as seen in PHP 5.3.1 RC3, which helps prevent DOS attacks occurring via temporary file exhaustion
    • Fixed Snow Leopard build error
    • Fixed make install-pear failure
    • Fixed parse_url() incorrect with ? in fragment
    • Complete list

Clearly, the PHP 5.2.12 release candidate is much more exciting than PHP 5.3.1′s, which tells me we are getting closer to a stable PHP 5.3.1 release.  A download link for both versions is included below.

Download PHP 5.3.1 RC4 or PHP 5.2.12 RC1

Share