My advice would depend on your own goals, which might look like this... you might want to ask yourself (or score each of these from 1-10) if you prefer to:
- learn a new language you might use in future? = Ruby
- deepen your Python skills by using it for everything (say Django or Web.Py) = Python
- move the Ruby testing away from Rails = Ruby
Other questions you could ask yourself to help the decision might be:
- is speed important? Do some tests in the various languages. (If Ruby, then use Ruby 1.9 and get the other Ruby book).
- is integration important? If so, why use a PHP front end?
- is your connection to the language community important? If so, choose on 'community feel'.
- is there a lot of backend text processing? (Perl?)
- do you want to use an ORM or write SQL? = look at Ruby and Python lightweight frameworks.
I don't think the libraries will be an issue, since (I'm pretty sure that) libraries for popular languages cover all common tasks.
If you can score all the above from 1-10 it may help isolate a preferred direction...
Then, as I see it, the issue breaks down into 3 things:
- what language do you most like to code in (work should be enjoyable)?
- can the front end and back end be generated in a single language?
- do you want to use a framework or a ready-made CMS for the front end?
It's worth looking at the origins of languages: PHP was originally announced as an extension of SSI, Ruby tries to take the best of Perl, Smalltalk and Lisp but has elements of a C/Java-like syntax, Perl is intimately connected to Unix and everywhere, although usually invisible to end users (despite some very good Perl web frameworks). You already know about Python.
As for frameworks and CMSs, a trawl through the distinctions/limitations/features might also help. It is too easy to install a PHP CMS (fine for a site with a well-defined purpose) but then find yourself hampered in acres of impenetrable code when you want do do something it can't do out of the box. A framework in the backend language will enable you to hook the back and front ends together more easily.