PHP Classes

5 Reasons Why the Web Platform War is Over: PHP Won with 75% says Google

Recommend this page to a friend!
  Blog PHP Classes blog   RSS 1.0 feed RSS 2.0 feed   Blog 5 Reasons Why the Web...   Post a comment Post a comment   See comments See comments (36)   Trackbacks (0)  

Author:

Viewers: 1,008

Last month viewers: 306

Categories: PHP opinions

During Google I/O 2013 event a Google manager said PHP runs on 75% of the Web sites. So they decided to finally support PHP as in their AppEngine hosting service.

Read this article to understand why this puts an end to years of false claims that PHP was losing market, as well what it means to Web developers using PHP or other languages.




Loaded Article

Contents

Introduction

Is Google AppEngine a Good Solution for PHP Application Hosting?

5 Reasons Why Web Platform War is Over: PHP Won!

MySQL and Linux are also the Winners of the Web Platform War

PHP May Not Be Dominant Forever

Languages Are Tools Not Religions

Conclusion

Introduction

Google I/O is a event mainly for developers that Google organizes every year to present the latest developments of their products.

This year Google announced a new language being supported in AppEngine, their so called "cloud" hosting platform. This time the new language was PHP.

A Google manager for AppEngine explained that PHP is running in 75% of the Web sites. That explains why PHP support is the top most requested feature for AppEngine.

This the video of the Google I/O presentation on which they announced PHP support. According to the presenter, it was a really crowded session. Given the PHP popularity, it is not a surprise.

Is Google AppEngine a Good Solution for PHP Application Hosting?

The next thing you may be wondering is whether AppEngine is good enough to host a PHP Web site.

Currently it uses the official PHP 5.4 customized to be integrated in the Google Cloud platform. It has many of the regular extensions compiled in but certainly not all that usually are enabled in a regular PHP installation.

It is certainly a constrained environment, so you should not expect all the PHP features you have in a regular dedicated server. There are some differences that may be advantages or disadvantages.

I have not tested it myself but from the available material it was possible to figure some important differences. There are certainly more differences that I did not figure. I may also be misunderstanding some features due to the lack of documentation.

Advantages:

  • Virtually infinite scalability

    If your site gets a peek of requests, in theory AppEngine will handle the load. In a regular PHP setup you would need to take care of adding more servers and distribute the requests between them.

  • Automated backups

    Your application and database data are backed by the AppEngine itself. You can make it take a backup on demand or even schedule it.

  • Distributed sessions

    AppEngine emulates a memcached server, so you can store and retrieve data that will be available to all scripts of your application regardless if they are running on the same machine or not.

    This is useful for instance to store and retrieve session data. This is better than the default session storage that PHP uses which is based in local files.

  • Task queues

    AppEngine provides access to a queue that you can use to dynamically defer the execution of a script to a background process. A class is provided to make it easy to queue the execution of background PHP scripts.

    Your application can also schedule tasks to be executed regularly like you would do configuring a crontab file.

Disadvantages

  • No local file system access to modify PHP scripts

    PHP applications can read and write application files, like for instance configuration files and uploaded files. The data files are written to a cloud storage service using a special file stream handler.

    However, it cannot use the require or include statements to execute script files created dynamically by the application. While this seems to be a nice security feature, it imposes limitations to many PHP applications.

    For instance template engines that generate PHP scripts are not able to execute the scripts using include or require. That also means that you will not be able to update your Wordpress installation in the usual way.

    An alternative solution could be to read the stored files into a variable and use eval to execute the code in the variable. However most applications are not ready to work that way.

  • No remote resource access via sockets or Curl

    At least for now it seems to not be possible to establish socket connections with fsockopen or using the Curl extension.

    If you need to access remote sites you have to use fopen, file_get_contents and similar functions.

  • URLs are mapped via AppEngine configuration not mod_rewrite

    Since AppEngine runs on its own Google Web server, traditional Apache extensions like mod_rewrite are not available.

    The mapping between request URLs and PHP scripts is done using an application configuration file in a format that you need to learn.

  • No PHP error log access

    It seems that at least for now there is no access to PHP error logs. This means that if your PHP code in production is generating errors, you will not be able to see them.

More details can be obtained on the PHP for Google AppEngine site.

5 Reasons Why Web Platform War is Over: PHP Won!

In reality there was never a Web platform war, at least for most PHP developers.

What happens is that PHP gathered so much popularity, that people that prefer other languages often engage in argument wars against PHP just because PHP popularity compromises the chances of their preferred getting more popular. So in the minds of the fans of those other languages, they are in a war against PHP.

With this announcement from Google, it pretty much killed the arguments of those that fight PHP. If there was a war, PHP won it. Lets get over it. Here is why.

1. Google Knows Because They Crawl the Whole Web

Google is the top search engine company. Every day thousands of robots spider the Web to crawl and index Web site contents.

So for Google it is easy to crawl the Web and determine which language is used in each Web site. Most sites with PHP installed respond with an header like this:

Server: Apache/2.2.8 (Unix) PHP/5.3.11

Although it is possible that some PHP sites may omit the information that PHP is running on the server, most sites do not do this.

So if Google figured that 75% of the sites run PHP after crawling the whole Web as they have been doing for all these years, they are the ones that have the most accurate evidence of the overwhelming presence of PHP.

2. Google Does Not Influence Web Developers so much

Definitely Google is a very influential company to anybody using the Internet these days.

It is natural that if Google declares they use a certain technology, it is like an endorsement that may influence people to also use that technology.

I have always heard that Google search engine uses C++ and most other services use Java because of the scalability provided by Java Application servers.

When Google AppEngine launched in 2008, they announced it was only supporting Python. That was odd to me because Python was neither one of the traditional Google languages, nor a popular Web language like PHP.

When I realized that Guido Van Rossum, the creator of Python was behind the Google AppEngine project, it all made sense. Why would he give priority to any other language besides his own creation? It seemed like a personal preference, rather than one based on language features or market share reasons.

It makes sense that a company standardizes on certain tools or programming languages that their employees are more familiar or have more control, but when they think of products for their customers, companies need to pay attention to what the customers prefer.

Microsoft paid attention to their customers many years ago and started actively supporting PHP, so it was odd that Google was not doing it.

Later they added support to Java and even the Go language. That is OK, but given the overwhelming presence of PHP on the Web, what was keeping Google from supporting PHP?

When asked, Google employees gave the standard excuse that Google did not have the necessary resources. Right, a company that makes 100 million dollars a day, does not have resources to support a language that many customers want to use. Something was not quite right in that justification.

Many years ago I heard from a Googler (now ex-Googler) that inside the company there have been huge discussions to add PHP support to AppEngine because it was a huge market that they were neglecting, limiting the commercial success of the product.

Some friends of mine speculated that Guido Van Rossum was against it because PHP support would put Python in the shadow. That made sense but it was still a speculation.

Last December Guido Van Rossum left Google. So, if he was the main opponent of PHP support, after he left the PHP opposition would be gone, or at least the opposition would become much weaker.

Only 5 months after Guido departure, Google announces PHP support for AppEngine. So the speculation that the Python creator was preventing Google from adopting PHP may actually not be far from the truth.

Anyway, if in 5 years Google could not convince PHP developers to switch to Python and use it in AppEngine, I guess Google influence over Web developers is very limited after all.

Too bad for Google that they delayed PHP support for all these years. They could have lead the PHP Platform As A Service (PAAS) market so much earlier. Nevermind, better later than never.

3. Wordpress is the Dominant Blog Platform (not Blogger)

One of the reasons why PHP is so successful is due to killer applications like Wordpress.

Just last month I gave an interview to Khayrattee Wasseem of the 7PHP site on which I have explained that in my opinion the success and prevalence of PHP is tied to WordPress and vice-versa.

Wordpress is so extensible that nowadays it can be almost anything you want besides being a blog. There are plugins to turn it practically into anything you want from a Web site.

Wordpress code may not be very beautiful in the opinion of prude developers, but that does not matter. Even developers that preach for other languages use Wordpress. Isn't ironic, don't you think?

More than a software application, Wordpress is an ecosystem, a way of life. Many people developers live exclusively from developing sites based on Wordpress. I see that here every day in the PHP jobs section.

The same could be said to a certain degree about Drupal, Joomla and other popular PHP applications. It is just that Wordpress is much more popular.

The Wordpress community seem to live in a world of their own apart from the regular PHP world. They organize their own events. Those events are always very crowded. I suspect that Wordpress events are even more crowded and frequent than regular PHP events. That says a lot about the importance of Wordpress to the PHP popularity.

4. Programming Does Not Have to Be Beautiful

Many years ago I started seing people praising Ruby On Rails as the best way to develop Web applications, as opposed to use languages such as Java or PHP.

I have seen talks from its creator David Heinemeier Hansson on which he was preaching that programming had to be beautiful. I wondered what that meant. Was it the coding style? The project architecture? The development methodology? Something else?

Maybe I missed the point but I assumed that Ruby On Rails imposes a certain methodology as the only way to do it right and be productive. If you do not get out of the rails you train can travel very fast.

It seems to me that using a certain methodology consistently does not require that you use a specific language or a specific framework to be productive.

I use the same methodology to develop PHP projects for years. I feel very productive because I follow the same methodology very consistently. I develop my projects really fast because work becomes mechanic.

It seems that Ruby On Rails brought consistency to the development of Web projects of people that did not know what method they should follow.

However, that does not have to be done with Ruby On Rails, not even with Ruby. It could well be in PHP using a similar framework or not. As a matter of fact many PHP frameworks appeared afterwards copying some things from Ruby On Rails.

Ironically certain things from Ruby On Rails were copied from PHP. For instance the ERB is a templating system that later merged in Ruby On Rails project. It is basically a way to define templates with some code inside, just like what you can do in PHP since ever.

It is even more ironic that some people preach that you should not mix code in HTML templates, as if that is an ugly thing and if do that you will go to hell when you die. After all, I guess Ruby On Rails people agree that programming does not have to be beautiful.

Another thing considered ugly by some is the use of global code in your applications instead of classes. Well, if you take a look at Wordpress source code, you see global code all over it.

I already have written about why organizing your code in classes is better than using global code but that does not have to be a mandatory rule for everything.

Global code may not be beautiful but it works, PHP allows it, a lot of developers use it, and make a living from it.

5. PHP Detractors Have the Wrong Focus

PHP is not perfect but that does not matter. Actually those are not my words. Those are from Jeff Atwood of StackOverflow fame. Despite he knows that, it is not unusual to see him preaching against PHP. Well if it does not matter, why bother spending time and effort preaching against PHP?

Jeff is not alone. Haters will gonna hate, will do it in public spaces a lot, sometimes in disguised ways.

One site where I see a lot of disguised anti-PHP preaching is in Quora. This is a more sophisticated form of anti-PHP warfare. Some people make allegations against PHP disguised of questions. Some ask if PHP project startups have less chance of succeeding, others ask if PHP popularity is declining, others ask if PHP is still worth learning, and so on.

All this anti-PHP preaching is pointless. It only helps bringing more attention to PHP. Well, if other languages are so much better than PHP, why don't PHP haters try to be positive and focus their efforts in showing the benefits of other languages? That would probably be a better approach to attract more people to their language of choice.

MySQL and Linux are also the Winners of the Web Platform War

PHP did not succeed alone. MySQL is definitely a winner too. PHP applications often need a database. Not just any database, a SQL database. Not any SQL database, a database compatible with MySQL, not necessarily MySQL of Oracle.

Google AppEngine for PHP provides MySQL access. Well it is not exactly MySQL but rather extensions compatible with mysql, mysqli and PDO-MySQL. They connect to service that Google calls Cloud SQL.

It is not clear if this is really a MySQL cluster instance or something else that emulates MySQL. Well what matters is that applications built for MySQL will still run compatibly.

Linux is also winner of the Web. Actually Web hosting may be the most successful environment using Linux probably after Android based phones.

Even Microsoft is offering support to PHP, MySQL and Linux in their Windows Azure cloud hosting platform.

PHP May Not Be Dominant Forever

While PHP is very successful for the Web and that does not seem it will change any time soon, PHP as a language may not be dominant forever.

PHP is not perfect. Newer technologies and platforms may always rise in the future.

We have seen for instance JavaScript being used on the server side providing certain advantages that the current PHP implementation does not provide in built-in manner, like for instance asynchronous programming like Node.js does.

However, this may not be enough to make people exchange PHP for JavaScript. I think it is more likely that somebody develops asynchronous programming support in PHP.

Anyway, PHP is successful because the Web is popular, just like Windows is successful while the desktop computers are popular.

As more people move from the desktop computers to mobile devices, Windows may lose relevance. Likewise if people move from the Web to some other platform, PHP may no longer be as relevant as it is today.

For instance, for native mobile applications PHP is not relevant, despite it is possible to develop native PHP applications for Android. Still PHP is relevant for the Web server side of many mobile applications.

Languages Are Tools Not Religions

No matter what is your language of preference, keep in mind that a language is just a tool for a purpose. It is just a means to the end.

In some cases it really does not matter what language you used to develop an application. That is the case for instance of Web applications. The code is run on the server side. So for the end user it does not matter if it is PHP or something else.

In my opinion it does not make sense to treat languages like religions. You can use different languages for different projects. You can even mix multiple languages in the same project.

So for developers I always recommend that you learn more than one language if you have the time. That will make you more prepared to participate in different types of projects.

Conclusion

I wonder if this announcement of PHP support in Google AppEngine willl make a big difference to PHP developers, especially now that there are already plenty of other Platform As A Service alternatives that support PHP?

Are you willing to move your PHP applications to Google AppEngine or do you feel it is not yet ready?

What do you think? Post a comment if you have an opinion on these subjects.




You need to be a registered user or login to post a comment

Login Immediately with your account on:



Comments:

10. Async PHP - Robert Landers (2017-04-05 03:29)
You said: I think it is more likely that somebody develops async... - 1 reply
Read the whole comment and replies

9. GAE PHP tutorial - MohanKumar (2013-10-13 01:15)
Tutorial on hosting php application on Google App engine... - 0 replies
Read the whole comment and replies

5. A lot of PHP haters - Jeff (2013-05-26 22:52)
Everytime something becomes popular developers become haters... - 2 replies
Read the whole comment and replies

6. There is no war at all - Stanislav Shramko (2013-05-23 07:03)
Some contras... - 4 replies
Read the whole comment and replies

7. Will Google the rules of game in PHP? - fadhil m (2013-05-22 02:42)
Google enters PHP.. Will that lead to limit Free usage of PHP?... - 2 replies
Read the whole comment and replies

8. very good choice - José Filipe Lopes Santos (2013-05-22 02:36)
very good choice... - 0 replies
Read the whole comment and replies

3. Well you can actuall log - Stuart Langley (2013-05-22 02:36)
use syslog for logging on app engine... - 8 replies
Read the whole comment and replies

2. PHP learning courve is "roller coaster" - Daniele Cruciani (2013-05-21 03:37)
you go up and down, and it is not very good... - 6 replies
Read the whole comment and replies

4. AppEngine what? - Frederik Yssing (2013-05-20 22:18)
AppEngine what, what is the advantage?... - 1 reply
Read the whole comment and replies

1. LAMP / WAMP - Jorge Castro (2013-05-20 21:44)
I was asking PHp for Google App engine (GAE) for years..... - 2 replies
Read the whole comment and replies



  Blog PHP Classes blog   RSS 1.0 feed RSS 2.0 feed   Blog 5 Reasons Why the Web...   Post a comment Post a comment   See comments See comments (36)   Trackbacks (0)