Skip to content

Ruby on Rails Vs PHP: Which One Is Best?

Ruby on Rails vs PHP: Which is Best?

First, let us try to understand why you want to select a specific technology. All technologies thrive off the tools, developer community, libraries and applications. As a business owner, you might want a technology which can last for many years beyond the inception of the project.

As a developer, you want a technology which can be maintained long enough for you in order get a good return on your investment. Business owners or developers will often make their decisions considering their colleagues and the developer community, depending on the technologies which is highly recommended.

In this post we will a brief look at the pros and cons of PHP and Ruby on Rails. We will see how PHP and Ruby on Rails can be compared with common points like maintenance, performance, scalability, costs and support.

Comparison of PHP with Ruby on Rails is not fair at all. PHP is much more popular than Ruby on Rails, its because Ruby on Rails is a web development framework, not a programming language. Ruby is the language running Ruby on Rails framework in the backend, and PHP is the programming language used to code and create websites and web applications.

Ruby on Rails should be compared with Symfony2, Zend Framework, Codeigniter, Laravel, CakePHP and many other PHP-based web development frameworks. So, to understand why there is so much popularity among Ruby on Rails, it is better to visualize searches made by people.

This trend graph from Google above shows that all PHP web development frameworks still do not add up to the number of searches made for Ruby on Rails (in blue). In fact, the only web framework that is growing in the PHP world is Laravel. So, why is Ruby on Rails so popular?

Well, a big part of creating a web application is deciding what libraries you want to use, how to organize your web application and many other factors. Till date, many PHP projects are still not using a mature and proven web application development framework. Many PHP developers would prefer to create a new PHP framework, instead of using the most popular frameworks such as Zend Framework, Symfony2, etc.

Due to the complexities of an application, as with any framework you will have to spend a lot of time learning to use that particular framework. Therefore, Ruby on Rails tries to simplify the learning process of their framework by rejecting configuration over conventions; In other words, you (the developer or owner of the business) have little time to decide when it comes to organizing, executing, or even hosting the application.

This might seem like a good thing, and for the most part, it really is, which is the reason why Ruby on Rails is very popular. However, since then, many PHP web application development frameworks have recognized it and are following the steps of Ruby on Rails web development. This could be the reason why the growth of the Ruby on Rails community has stagnated in recent years. Now, while the other web development frameworks are shown in small percentage, you should still keep in mind that PHP is completely web focused. So almost everything you write in PHP will run on the web, while in Ruby, there are not many options for you on what code you can write to develop a web application.

1. Scalability and Ease of Maintenance

Whether PHP or Ruby on Rails, both provide the ability to scale. However, due to the amount of resources that Ruby uses compared to PHP, scalability issues will arise much earlier in the life cycle of your application. Scale an application in Ruby on Rails versus PHP will address very common problems. Therefore, the scale will be based on how the application was designed. There are also online services to help solve scaling problems such as using Rackspace Cloud Sites or Amazon Elastic Beanstalk.

The situation becomes very different when you go from wanting to climb to needing climbing. When a developer does not have the experience to scale an application, the most common route is to find online articles, tutorials and other resources to learn. So, when we are talking about scaling a website, there are many resources written and available for PHP developers, while Ruby on Rails has a much smaller group of developer community.

As for the easy maintenance, it totally depends on the organization of the web application. As long as the web developer is using a web development framework, then general maintenance is a lot easier. PHP offers a massive selection of web development frameworks, all designed for specific objectives, while Ruby has a limited selection (apart from Ruby on Rails).

2. Speed and Performance

Since PHP is a programming language, and Ruby on Rails is a web app development framework, you should take the performance with a grain of salt. The goal of using a complete web development framework is to gain productivity at the cost of speed. So let’s put some light on this.

Here is a table of a very simple web application of “hello world”. Below you can see how fast PHP is when it comes to requests: remember, it is a language designed specifically for the web. However, once you start introducing popular full-stack web app development frameworks, performance decreases, and requests per second approach the Ruby on Rails number.

In fact, a famous PHP web development framework Laravel starts performing worse than Ruby on Rails. As a result, many benchmarks are useless, because there is much more to the speed and performance of a web application than the language or web development framework. For instance, the network delays, database system, and caching mechanisms, can add to a slowdown from 10x to 100x. So, how is the design of the application is much more important than the programming language or the web development framework behind it.

3. Cost

Scarcity is a fundamental concept of the economy. So, if you have 10 PHP web developers for each Ruby web developer, and the function of the project depends on the language, there will be a clear winner in the costs. PHP, due to its strong competition, has lower prices. As a business owner, if your motive is based on costs, this should be a very useful incentive. There is the saying “You get what you pay for,” but that does not mean you have to pay the same amount for the experience available. PHP has a very easy learning curve. In addition to that, many PHP developers are new to programming in general and to the programming of web applications in particular.

On the other hand, Ruby is a language more difficult to learn, so people who choose that language already know how to program. It is very natural for a PHP developer to move to Ruby on Rails, and his experience in the worldwide transfer of PHP to Ruby. In fact, many Ruby developers were PHP developers. So, why do developers jump to Ruby on Rails? Well, this answer would be the same for almost any other programming language other than PHP.

In any other language (except PHP), the language will limit it in the code you can write, as well as in what is available to use. Therefore, it becomes a common method to create web applications in that language. For example, C # has ASP.NET, Python has Django, Node.js has Express, Lua has Orbit, and the list goes on. Therefore, to put this in perspective, let’s say you had the option to interact with a mass audience, or be among selected professionals who share the same objectives. It would make sense that the most recognized applications are built in the languages ​​that have the largest audience, therefore, PHP is the target language. Applications like WordPress, Drupal, Magento, Facebook, are just a small part of the many applications available, which are written in PHP.

When it comes to hosting your Ruby on Rails applications, costs can go up very quickly. You will find it more difficult to find a hosting that supports a Ruby on Rails application, and the big brands are not cheap. They start at $ 40 and quickly jump to $ 500 or more. There are even some companies that offer free accommodation, but they will charge a lot of fees when they need to expand their accommodation needs. Almost all hosting companies that offer Ruby on Rails hosting will also provide PHP hosting. Some of the cheapest hosting providers offer old and outdated versions of Ruby (the language), which limits you to previous versions of Ruby on Rails. They also run their Ruby on Rails application as CGI, which is the slowest way to run your web application.