PHP is a programming language, Ruby on Rails is a programming framework written in Ruby. You would be better comparing PHP with Ruby or something like CakePHP with Ruby on Rails to get a similar comparison.
You would be able to do virtually anything in Ruby that you can do in PHP, there would be very little (dare I say nothing?) you could do in one that you couldn't do in the other.
I'd advise taking a look as both of the languages and having a play around with them to see which you like and get on with the best. They have very different philosophies and ways of working and you may find you get on better with one that the other. Ruby has a much more engrained philosophy of testing and test/behaviour driven development which is not as prominent in the PHP community if that's a consideration.
I've personally used both extensively for many years however I now only code in Ruby because I much prefer it and get far more enjoyment out of coding in the language.
As said before in this thread, comparing a programming language to a framework is comparing apples to oranges.
CakePHP is the base comparison to Ruby on Rails (in fact, cakePHP founders say they developed it to be a direct port of RoR to PHP).
So, that said, any framework will have advantages over the straight programming language because common tasks (such as Database interfaction, templating, mail, etc) are already created in modules for you to implement. However, it also results in several unknown limitations that you need to be aware of. CakePHP and RoR both use ORM, and if you're not careful in how you implement something, you can end up using a lot (A LOT) of extra memory in your application that you don't need to, or end up with nested foreach loops that slow your entire app down.
To me, CakePHP = RoR. I haven't seen any benefit of one over the other. To me, the biggest issue is finding support / hosts that support RoR and actually know what they're doing.
I'm going through this decision making process myself. I haven't programmed for 15 years and have set myself a goal of developing a web application which earns more than £500 per month.
I've been research development technologies and am overwhelmed by the number of options.
The main thing I've found is getting unbiased comments on either PHP or Ruby on Rails is near to impossible. Most people out their seem blindly loyal to one or the other.
On first impressions it's clear that PHP is much rawer. You are able to carefully control everything and do things very well or very badly.
Ruby on Rails seems to offer a much faster development cycle due to it being a framework but you are slightly further removed from full control.
To me both have merits and I am investigating both for a while before deciding on which technology to go with.
Here's hoping no one gives me any more languages to consider!
Chris if planning on selling licences to use your application then php would be the obvious choice as there's far more hosting companies/existing sites using that technology. If planning on offering a service then ROR could be the better choice as it's a rapid development environment.
This of course doesn't take into account asp.net, coldfusion, or the myriad other options available to you.
I know this is older, but since it still comes up on Google, I'll weigh in.
If your interest in programming is in being able to build dynamic websites, and you are or plan on being a freelancer, then you want to go with PHP.
PHP runs EVERYWHERE. It's installed EVERYWHERE. There are tons of applications out there to learn from, tons of developers to ask questions to, and in general it is just a hugely popular web programming language. All of the major open source CMS all run on PHP (Drupal, Wordpress, Joomla) so as a freelancer or someone who is thinking of getting in to making websites, you will NEED to know PHP. It will come up. Period.
However, if your desire is to develop custom web-APPLICATIONS (i.e. not just websites), and if you like building tools and frameworks, and your desire is to work in a boutique agency with other like minded individuals then go with Ruby.
Ruby is more than just web programming. You can write scripts to automate your whole server like Python or Perl. It just happens to have a decent framework for Web with Ruby on Rails. Ruby is best learned slow, when you can take the time to REALLY learn the language.
I've been out of school for 3 years, and I am loving Ruby more and more, but most of my living is made with PHP.