PHP – Smart Web Developer

Skip to the content
Categories
Mac

## Mac Moves to PHP 5.3.6 With Release of OS X Lion

- Post author
  By Tasman Hayes
- Post date
  July 23, 2011

With Apple‘s release of OS X Lion, the bundled version of PHP has been updated to PHP 5.3.6, the very latest production version of PHP.

PHP 5.3 includes features like:

- namespaces,
- lambda funtions,
- late static binding, and
- a native mysql driver, mysqlnd.

This is good news for web developers using Mac. If we want to work the latest PHP release, we don’t have to resort to installing a separate version of PHP, using a tool like MacPorts.

Probably the fact that Lion is only available as a download through the Apple App Store has helped Apple ship with the latest PHP version.

Mac OS X 10.6 Snow Leopard currently uses PHP 5.3.4, even with the latest 10.6.8 update.

A PHP 5.4 Alpha has just been released, with useful features like traits. I wonder whether Apple will update to PHP 5.4 during Lion’s lifetime? I can only hope.

- Tags
  Mac, Mac OS X 10.7 Lion, PHP, PHP 5.3

Categories
PHP

## PHP 5.4 Alpha Released

- Post author
  By Tasman Hayes
- Post date
  July 23, 2011

An alpha version of PHP 5.4 has been released to the public on php.net. PHP 5.4 alpha 2 is available for download from qa.php.net.

The PHP 5.4 alpha was first released 26 June 2011. The proposed release date for PHP 5.4 is 26 July 2011. (Source: “PHP” on Wikipedia.)

PHP 5.4’s features include:

- better performance
- lower memory usage
- array dereferencing – you don’t need to store an array before access, so code like get_person_by_id(5)[‘address’] is now possible; Razvan Tudorica gives a straightforward example of array dereferencing
- traits, essentially a mechanism for two classes with a common parent class to still share some common methods – very useful – Simias Toleikis explains traits very well
- support for DTrace for real time tracing of PHP processes

There’s also been some cleanup to improve the security and code quality of PHP:

- syntax for continue/break $var removed
- register_long_arrays, allow_call_time_pass_by_reference and register_globals configuration parameters have been removed
- session_registered(), session_is_registered(), session_unregister() have been removed
- support for old sqlite databases has been moved to PECL; sqlite3 support is still built in

Big features like Unicode in the core and performance acceleration from having APC built in looks like they’ll wait until PHP 6 is released.

- Tags
  PHP, PHP 5.4

Categories
PHP

## PHP 6: Features, Release Date, Hosting and Download

- Post author
  By Tasman Hayes
- Post date
  May 6, 2011
- 10 Comments on PHP 6: Features, Release Date, Hosting and Download

This article covers PHP 6, including the status of its development, features, release date and download. There’s a section on each topic below. Links to PHP downloads and source code are included.

I’ve updated this article to include the effects of the release of PHP 5.4 and the timelines of the new PHP release process.

### PHP 6’s Status

Several books have already been written and published about PHP 6, such as Professional PHP6 by Edward Lecky-Thompson & Steven Nowicki. Despite this, PHP6 does not exist yet. There is no PHP 6 beta or even alpha. PHP 6 does not exist.

To see that PHP 6 doesn’t exist yet, see PHP’s official Subversion page. Subversion, or `svn`, is the source code control software used for the development of PHP. There are instructions for getting the code for PHP 5.3 or 5.4, but not for any newer version:

    PHP 5.3: svn checkout http://svn.php.net/repository/php/php-src/branches/PHP_5_3 php-src-5.3
    PHP 5.4: svn checkout https://svn.php.net/repository/php/php-src/branches/PHP_5_4 php-src-5.4

As you can see here from the branches in the PHP source code the newest branch is PHP_5_3:

      FIRST_UNICODE_IMPLEMENTATION/	 296285	 16 months	 derick	 - Committing my session cookie patch; it's a bug fix and good to have in the h…
    ...
      PHP_4_4/	 295390	 16 months	 derick	 - Set-up externals for the Zend engine so 4.4 can at least be build from SVN a…
      PHP_5_0/	 284180	 2 years	 gwynne	 one more attempt at ridding us of some of those annoying mime types
      PHP_5_1/	 284180	 2 years	 gwynne	 one more attempt at ridding us of some of those annoying mime types
      PHP_5_2/	 311125	 2 months	 dmitry	 Fixed crash on recursive error handler invocation
      PHP_5_2_WITH_DRCP/	 284180	 2 years	 gwynne	 one more attempt at ridding us of some of those annoying mime types
      PHP_5_3/	 313616	 31 hours	 scottmac	 When we have a blocking SSL socket, respect the timeout option. reading from SS…
      PHP_5_4/	 313646	 3 hours	 stas	 No E_STRICT in production

(Older code branches omitted for brevity.)

There’s no PHP 6 code branch yet. Notice the `FIRST_UNICODE_IMPLEMENTATION` branch – the story behind this code branch, and why it delayed PHP 6 follows.

What does exist is an official todo for PHP 6, authored by Andrei Zmievski, which includes a rough list of PHP 6 features in the PHP Wiki.

UPDATE 21 July 2011: Now the PHP 5.4 Alpha has been released, a PHP 6 branch may exist for PHP’s developers without showing up on PHP’s public subversion. The code for PHP 5.4 did not show up on the sites above until the PHP 5.4 Alpha was released.

### Reasons for Delays to PHP 6

The reasons for the delay to PHP 6 appear to be:

1. Issues with Unicode support: The development team initially decided to use UTF-16 internally in PHP 6. This causes double memory usage for strings, more CPU usage and increased complexity of coding PHP 6. Using UTF-16 apparently took a lot of fun out of developing PHP, caused tension amongst PHP’s developers and slowed development. The choice to use UTF-16 was aborted by Rasmus Lerdorf, creator of PHP, in 2010. The developers restarted the Unicode implementation.
2. PHP 5.3 took some PHP 6 features: PHP 5.3 included many of the features slated as desirable for PHP 6. This removed a lot of momentum for PHP 6.
3. High Hopes: PHP 6 is a major version number change. It’s possible in a major release to make significant changes, including making breaks from the past. Agreeing and delivering major changes can take some time.
4. Feature Set Not Finalized: Agreement hasn’t been reached on the features in PHP 6.0.
5. Lack of Urgency: PHP works very well. There are no burning issues forcing the release of PHP 6.
6. PHP 5.4 takes some PHP 6 features: Rasmus Lerdorf previously stated, when he scrapped PHP 6’s original Unicode implementation, that there may be a PHP 5.4 yet, or PHP may go straight to version 6. Jani Taskinen created a PHP 5.4 development branch on 11 March 2010, but this appears to be due to frustration as being able to move PHP’s development forward. The PHP 5.4 code branch is no longer there. There is however an official PHP 5.4 todo wiki, with Stanislav Malyshev as the tentative release manager. So it looks there will be PHP 5.4, which would push out the PHP 6.0 release further. UPDATE on 24 July 2011: The PHP 5.4 Alpha has been released, and it includes some features originally targeted for PHP 6.0, such as traits and the removal of register_globals and safe_mode.

### PHP 6 Features

The likely set of PHP6 features is:

1. Internationalization: Native Unicode – UTF-8 – to the core (strings, APIs).
2. Performance: Page level (opcode) caching through moving Alternative PHP Cache (APC) into the PHP core. Native application caching.
3. Break to label: Sending a break to a label (like a goto).
4. Enhanced array indexing: Array indexing can be used to substring or take an array slice.
5. Removed features: Magic quotes will be removed.

The are quite a few more minor features and changes in PHP 6.

### PHP 6 Download

You cannot download PHP 6 yet. There is no PHP6 download available. When a PHP 6 download becomes available I will post the download link here.

The current production release of PHP is 5.3.6. PHP 5.3 can be downloaded from php.net/downloads.php.

An alpha version of PHP 5.4 is also available.

Once the PHP 6 alpha is released, snapshots of the development code will likely become available from snaps.php.net.

### PHP 6 Release Date

There is no PHP6 release date set. PHP 5.4 is only just being released now.

There is a PHP release process which has been accepted by a team vote. The release process stipulates:

> Beginning on June 28th, 2011, the PHP Group began following a timeline for when new versions of PHP will be released. [33] Under this timeline, at least one release should occur every month. Every one year, a minor release should occur which can include new features.
> (Source: “PHP” on Wikipedia.)

This means minor releases, such as PHP 5.4 to PHP 5.5 are now scheduled yearly. The timeline shown in the PHP release process also shows the PHP 6 release occurring in sync with this one year cycle.

Given the PHP 5.4 release is expected on 27 July 2011, the most likely date for the production PHP 6 release is one year after the PHP 5.4 release: late July or early August 2012.

If the PHP team do decide to release PHP 6 in 2012 (rather than just PHP 5.5) according to the release process we’d expect to see the first PHP 6 alpha in June 2012.

### PHP 6 Hosting

People are already looking for PHP 6 hosting. As PHP 6 doesn’t exist, there are no PHP 6 hosting providers yet.

PHP is the defacto website programming language provided by web hosting companies. Some web hosting companies will be eager to provide an option for PHP 6 shortly after its release to be on the “cutting edge”.

PHP 6 will become more widely available as the popular hosting control panel vendors, such as cPanel and Plesk built in PHP 6 support.

If you have a virtual private server or a dedicated server, you will of course be able to install PHP 6 yourself.

### References

1. What is the Holdup on PHP 6?
2. Resetting PHP 6
3. PHP 6 Features
4. Prepare for PHP 6

### Comments

Something to add? Comments, questions, feedback, more information – please comment below.

- Tags
  PHP, PHP 6

Categories
CentOS

## Install the PHP DOM Extension on CentOS – the Easiest Way

- Post author
  By Tasman Hayes
- Post date
  March 9, 2010
- 28 Comments on Install the PHP DOM Extension on CentOS – the Easiest Way

Here we cover the fastest, most effective way to get the PHP DOM extension installed on CentOS. If you’ve just found out you need to install this extension, but don’t really know what it is, we’ve included some background first.

### What is DOM?

> “The Document Object Model (DOM) is a cross-platform and language-independent convention for representing and interacting with objects in HTML, XHTML and XML documents.” (Source: DOM in Wikipedia.)

### What is PHP DOM extension?

> “The DOM extension allows you to operate on XML documents through the DOM API with PHP 5.” (Source: Introduction to the PHP DOM Extension on php.net.)

### How to install the PHP DOM Extension on CentOS

You will need superuser privileges. Run the following command:

    sudo yum install php-xml

Don’t forget to restart Apache so PHP picks up the new extension:

    sudo service httpd restart

### How to Check PHP DOM is Installed

You can see PHP DOM is installed by creating a simple web page that calls the phpinfo() function:

    <?php phpinfo(); ?>

When you go to this webpage in a browser, you should see this output for the dom extension if it’s installed:

> ## dom

> DOM/XML | enabled
> DOM/XML API Version | 20031129
> libxml Version | 2.6.26
> HTML Support | enabled
> XPath Support | enabled
> XPointer Support | enabled
> Schema Support | enabled
> RelaxNG Support | enabled

Tested on CentOS 5.3.

- Tags
  CentOS, PHP