My rule of thumb is to use a language for something a domain that its community uses it for. Python for scientific programming, Ruby or nodejs for web servers, PHP for embedding dynamism in a static site. Then you're more likely to find libraries and support, and to find adoption for your own libraries and pull requests.
This doesn't mean you're always safe even on a language's home turf (Rails and Node each had significant problems as a server platform for their first, hyped, years), or that it's never worth stretching the domains that a language is used for (that's where Ruby's Rails and Python's Numpy came from), but you should recognize that you're out on a limb when you do so.