Wednesday, September 02, 2009

How to Install PHP 5.3 on Windows


With all the excitement surrounding Firefox 3.5, it may have escaped your attention that PHP 5.3 has also been released. This is the most significant update since version 5.0 and several features that were originally scheduled for version 6.0 have been slipped into the build. You’ll be hearing about these on SitePoint soon but, first, we need to install PHP 5.3 on our Windows development systems.

A Word of Warning…

PHP 5.3 is new and you may experience some problems (see below). If you already have a stable PHP environment, ensure you keep a backup of your current php folder and settings.

Web Server Installation

If you have not installed Apache, refer to How to Install Apache Web Server on Windows.How to Install MySQL. Optionally, you can also install the MySQL database — refer to

PHP 5.3 Installation

Windows PHP distributions are now available from a dedicated microsite at http://windows.php.net/download/. The choice is a little bewildering and the instructions are vague but, since we will be installing PHP as an Apache 2.2 module using the Apache Lounge build, so you should download the VC9 x86 Thread Safe Zip file.
General note:
Download the VC6 builds if you are using the standard Apache.org web server. The VC9 builds should be used for the Apache Lounge binaries or IIS.
A Thread Safe version should be used if you install PHP as an Apache module. The Non Thread Safe version should be used if you install PHP as a CGI binary.
You can now follow the instructions at How to Install PHP on Windows from step 2 onwards. Note that, in step 3, php.ini-recommended is now named php.ini-development; you still need make a copy and rename it php.ini.
If you have previously defined a working PHP configuration file, a tool such as WinMerge can help you compare and copy existing values to your new php.ini file.

PHP 5.3 Error Reporting

The first time you load your previously bug-free PHP application, you are likely to be confronted by reams of long-winded error messages. Don’t panic! PHP 5.3 introduces a number of new error directives which are enabled by default in the development php.ini configuration:
  • E_STRICT suggests improvements that ensure best interoperability and forward compatibility of your code, and
  • E_DEPRECATED warns you about code that will not work in future versions of PHP.
Very useful. In my experience, the majority of messages report that a time zone has not been defined and assigning a return values using new by reference is deprecated.
Unfortunately, applications can display so many minor errors they become impossible to use. You can disable the new error directives by setting the error_reporting value to "E_ALL & ~E_DEPRECATED" on line 514 of php.ini and restarting Apache.
However, several web applications, including WordPress, define their own error_reporting settings and may continue to show messages. It will take a developers some time to upgrade their applications to full PHP 5.3 compatibility.
Have you installed PHP 5.3 successfully? Have you experienced any major issues or problems with existing code?

How large is the PHP market?


Sometimes it is necessary to know how large is the PHP market in the world or in a specific country.

It may help, for instance, developers to advocate for PHP, companies to decide for sponsoring PHP events, PHP training, developing of products targeting the PHP developers, or any other initiatives directed to the PHP market.

This article presents several sources of information that may help decision makers to invest more in the PHP market.

The article also covers the huge popularity of Firefox browser among PHP developers attributing it to the superb Web development extensions available for this browser. The most useful Firefox extensions for PHP developers are listed.
* How many PHP developers there are in the world?

In the latest years I have participated in many PHP events in different countries, often as a speaker, and sometimes helping in the organization of the events.

Sometimes it is necessary to seek sponsorship. Sponsor prospects need to justify their investment in terms of benefits that they may get from the sponsorship.

If the benefit is to have their products or services being advertised to the participants of the events, it is important to know how large is the market targeted by the event.

Even knowing that only a fraction of the PHP developers in the world will come to a given PHP event, the more PHP developers there are, greater is the chance to have more developers coming to the event.

Therefore the first big question is: how large is the PHP developer community world wide?

This is a difficult question. Zend has been publishing rough estimates of the number of PHP developers that exist in the world. According to this page in the Zend site, there are over 5 million PHP developers in the world:

http://www.zend.com/en/company/management/

No sources are mentioned to base this estimate. It is also not mentioned when this estimate was produced, but it seems reasonable to assume that the estimate is close to the real numbers and is up to date.


* How many PHP developers there are in a given country?

Worldwide figures are useful, but if you want to promote a regional activity that only matters to PHP developers of a certain country, it would be better if we could have a more targeted estimates.

This is something that the PHPClasses site can help. Since many years ago, the site provides a page with several types of statistics. Some statistics are based on information provided voluntarily by the site users.

The PHP
user groups directory was introduced in 2004 in the site:

http://www.phpclasses.org/blog/post/36-PHP-User-Groups-diffu ...

http://www.phpclasses.org/browse/group/

To provide greater visibility to the PHP user groups listed in the directory, every time an user logs in the site, the welcome page shows a map with a listing of PHP user groups of the same country of the user that just logged in.

http://www.phpclasses.org/login.html

The site could guess the user country from the
IP address of the user computer but in some cases the existing IP to country databases are not reliable. Also, sometimes the user is from one country and is accessing the Internet from another country.

Therefore, the site asks the user to voluntarily specify from which country the user is, right after the first login. The user is not required to disclose that information, but if he informs his country, the site shows the country registered user groups.

This is a great initiative to help user groups attracting more active members, but some time later after this initiative was started, the user country information started being used to provide more interesting statistics about the site users.

In statistics page there is a section named "Logged users countries" that shows a ranking of all countries of the users that have logged in the site in the last 30 days.

http://www.phpclasses.org/browse/statistics/statistics.html# ...

Right below that ranking there is a ranking grouped by continent:

http://www.phpclasses.org/browse/statistics/statistics.html# ...

Currently, the number of users logged in the last 30 days is of about 41,700 users. This is not a small number, so it is valid to make extrapolations based on the number of logged users.

So, if you want to make an estimate of how many PHP developers there are in your country, just multiply the global developer count estimate mentioned in the Zend site by the percentage of users in your country or continent displayed in these rankings.

For instance, right now the United States appears first with 12.74%. Assuming that the total number of PHP developers worldwide is 5 million, that gives about 637,000 PHP developers in the United States.

There is a link to the statistics page at the bottom of every site page. This page is updated automatically once a day, so the statistics are up to date.


* What PHP developers use in the development environment?

Right below the ranking of logged users by country and continent there are two other rankings for the operating systems and browsers that logged users run to access the site.

These rankings shows what PHP developers use to access the Internet. While the fact that Windows is the dominant operating system on the desktop is not really a surprise, it is interesting to notice that already 8.7% PHP developers use Linux, which is more than the 7% that use Mac OS X.

Despite Windows and Macs have been considered more user friendly to the average desktop users, nowadays Linux platforms became more friendly and are much more popular in the desktop machines of PHP developers than they were in the past.

This growth of popularity of Linux among PHP developers may also be a consequence of the fact that developers often prefer to use the same platforms on the desktop as they use on the servers that host the sites they are developing, so it is easier to test new developments in a platform that is similar to what they have on the server.

The ranking of browsers is also interesting: 68% use Firefox against 18.5% of share of Internet Explorer. Google Chrome already appears with almost 6% of share, but that seems to be mostly due to the power of Google marketing, as that browser development is still in beta phase.

Despite Windows is the dominant platform, unlike the majority of the average desktop users that may still prefer Internet Explorer, PHP developers largely prefer using Firefox.

The reason for Firefox dominance seems to be the overwhelming availability of browser extensions for Firefox that help developers do their job.

If you are not familiar with these great Web development extensions for Firefox, here I will just mention a few that I think are the most useful:

- Firebug

Analyze page elements, locate Javascript errors, etc..
https://addons.mozilla.org/en-US/firefox/addon/1843

- FirePHP

Extension of the Firebug add-on to show PHP debug information on Firebug console.
https://addons.mozilla.org/en-US/firefox/addon/6149

- YSlow

Currently another extension of the Firebug add-on to measure page loading times and identify problems that make your pages load slower.
https://addons.mozilla.org/en-US/firefox/addon/5369


- Web Developer

Several tools like disabling Javascript, CSS, redirection, clearing browser caches, resizing the browser window to test pages with different sizes, etc..
https://addons.mozilla.org/en-US/firefox/addon/60

- User Agent Switcher

Switch the browser identification to test how sites respond to different browsers.
https://addons.mozilla.org/en-US/firefox/addon/59

- HTML Validator

Validate page HTML to help finding page generation errors cause by eventual bugs in the PHP scripts.
https://addons.mozilla.org/en-US/firefox/addon/249

- JavaScript debugger

Run page Javascript code with single step support and ability to show Javascript variable values during debugging.
https://addons.mozilla.org/en-US/firefox/addon/216

- LiveHTTPHeaders

Show page request and response headers.
https://addons.mozilla.org/en-US/firefox/addon/3829


* What PHP developers use in the production environment?

There are several sites that provide information about the production environment that PHP sites run on. Unfortunately not all information is available for free or is not updated regularly.

For several years, Nexen has been polling Web servers worldwide to check whether they are running PHP. Unfortunately they seem to have stopped doing that last October. The latest results are available on this page:

http://www.nexen.net/chiffres_cles/phpversion/18821-php_stat ...

As you may see, PHP was found in 1/3 of the servers that were polled. That is 50% more that the 21% of the servers that were found running Microsoft ASP variants.

Also notice that the adoption of PHP 5 versions has practically matched PHP 4 presence.

SecuritySpace also polls Web servers worldwide. Every month they publish the latest statistics. As you may see here, in April Apache lead the Web servers ranking with almost 72% of share against 17% of Microsoft IIS.

http://www.securityspace.com/s_survey/data/200904/index.html ...

They also compile a report of the most popular extensions running on Apache Web servers. Unfortunately since 2007 that report is only made available to paying customers.

The last free version of this report was made available on May 2007. Then mod_php and PHP-GGI were leading with 41.3% of the share.

http://www.securityspace.com/s_survey/data/man.200704/apache ...


* Other statistics

I suppose the statistics presented above are interesting and may be very useful for those interested to advocate for PHP or seeking sponsorship to PHP related initiatives.

However, if you know of any other interesting statistics that may also be helpful for these purposes, please post a comment and mention them here.