About ten years ago, (how's that for leading with an implication I'll be talking about old, outdated technology?) my CEO and CTO called me in a panic shortly after I started with the company. An advertisement came out prematurely before the company had a chance to bullet proof it's website which was still in beta at the time. Traffic flooded in and the one poor web server ran up a CPU load of I think 50 or 80 which was far higher than I had seen in my years of Unix system admin experience.
The application they were running was a 14,000 line Perl CGI program. No mod_perl. No FastCGI. So, every time a person visited the site, Apache would bring in perl, all 14,000 lines of code (with all the includes), and then do a just-in-time compile. After that, the application would start running, initialize its variables, log into the database, and only then could any real work take place.
The lead engineer made a very small modification, made it a FastCGI program with a loop so the program would start with the web server and loop. It ran literally 135 times as fast. One alternative we might have chosen was to buy and rack up 135 servers instead, but once the change was made, we had a hard time getting the two servers to show any indication they were being burdened in the least, so we had plenty of room to grow.
That's a wordy way of saying what the others said, that FastCGI is a way of delivering Perl based services in a way that can be blindingly fast compared to CGI, and that can be true regardless of what language you use.
Now, as for PHP, I set up an APC cache for my web applications. I believe it brings in the PHP code, does the just in time compilation thing, and then keeps the code in memory giving a similar boost. You can also issue commands to store data in the memory cache for fast access which sort of brings up the point of caching, and there are many kinds. APC caches your code and can cache data. Memcached is a memory cache that can be accessed via tcp meaning that several web servers could share a single cache. I think it is about 2 or three times slower than APC, but it serves a different purpose. Memcached also lacks security protections, so you have to rely on good firewalling to keep it accessible only where you want it to be.
Many blogging and CMS systems based on PHP have modules or plugins that can make use of APC memcached or other caching methods including caching to the disk. There are page caches that can store the entire generated page if desired with limitations so that logged in users don't get cached, for example. There are object caches that may store the results of a module or block making construction of pages happen faster. And there are caches for database queries which are usually done in memory possibly for the time of a session, but more likely just to avoid making the same query twice during generation of a page, and sometimes that can be done better sticking the results into a variable rather than trying to access something external.
And whatever language you use, if you're using Apache, for instance, or most likely most web servers, you can generate the page and stick it into a cache directory on disk and tell your server to check there first before going back and re-generating the page. This will buy you some rather extreme speed as well. For Apache, this is usually done in .htaccess pages, but since I'm on a VPS and have the freedom to configure my apache server more completely, I avoid using .htaccess files altogether to get a little bit of a performance gain there as well. So, I put all that stuff into a mini-configuration file for each virtual server and "Include" them at the end of my httpd.conf file.
Java is a fast language--about half the speed of C or C++ I believe since there is a little interpretation going on. But, it's nice in that it is multi-threaded and it's pretty easy to set up connection pools for a database. Other languages also have methods for setting up persistent or shared database connections. You have to be careful about security, but it's so common that security measures are also common.
However, whenever you have some multi-threaded listener or handler or multiple processes waiting on ports for a connection, you have the possibility that one of them will hang. On the other hand, there are ways to get around that. For example, having one process write to a request queue internally while other readers pick up the requests and execute on them much the way Tuxedo works, for example. If one server hangs, it can be killed and restarted and there is a good chance that only the outstanding request will be affected.
What else? Minimize the work required of the database. It will make your application scale better. It's easier to multiply the number of web servers than the number of database engines since the databases would have to be kept in sync. Analyze your database tables. Make sure they're indexed properly--not overdone, not under. They will speed up your access and slow down your writes.
Every time I touch on something, it seems there are a million more things to go into, and I've probably gone into way too much and have veered far off from the original question about which languages were fastest. I just have to concur with some of the other folks who may feel that any language can be fast or slow depending on how you code and configure it. But, for raw speed, I imagine C would go like blazes with C++ only slightly slower, Java about 1.5 to 2 times slower these days with older versions slower. It's weird. I use PHP all the time, but I have never compared it to other languages, but with an APC cache, I find my WordPress installations pretty fast on a simple VPS. I cannot say about Ruby or Python as I've only played with them a little. I've heard Ruby is nice but slow and that Python is easy for beginners.
I hope something I wrote here will be worth reading. It sure was long :-) Yikes...