I made two very basic HTTP servers, one coded in PHP and one in Java. Their function is simple, and their code is as identical as possible. They get a html page from the local filesystem and send it to the client if the page is available, or send a 404 error if not - thats it (not trying to create a full featured server, just comparing performance). They are both functional HTTP servers tested with FF and IE7.
I used PHP's stream functions over the higher performing socket family because Java can create SSL sockets. This is a significant downfall for PHP socket's, but you can create SSL sockets in PHP using the higher level stream family.
I ran these tests on a Linux VDS running Debian. PHP 5.2.6 and Java 1.6.0_06 (aka Java "6").
The Java server was compiled and ran using Sun's java compiler and JRE.
The PHP server was ran using the CLI with a default php.ini.
I ran 10 tests on each using a script that was made to hit the server 10,000 times. Attached is a copy of all the code so that it can be viewed and tested by others (client script and both servers)
Here is a copy of the logs (and no, I didn't switch them LOL)
PHP
10000 times in 0 minutes and 12.2015838623 seconds. <-- Highest
10000 times in 0 minutes and 10.2867138386 seconds.
10000 times in 0 minutes and 9.98223209381 seconds.
10000 times in 0 minutes and 10.389275074 seconds.
10000 times in 0 minutes and 10.8108680248 seconds.
10000 times in 0 minutes and 9.90578699112 seconds.
10000 times in 0 minutes and 10.2501511574 seconds.
10000 times in 0 minutes and 10.6506991386 seconds.
10000 times in 0 minutes and 9.31919288635 seconds.
10000 times in 0 minutes and 9.02534914017 seconds. <-- Lowest
JAVA
10000 times in 0 minutes and 15.6838850975 seconds.
10000 times in 0 minutes and 13.8331971169 seconds.
10000 times in 0 minutes and 14.7244591713 seconds.
10000 times in 0 minutes and 14.584854126 seconds.
10000 times in 0 minutes and 14.2438700199 seconds.
10000 times in 0 minutes and 14.3222107887 seconds.
10000 times in 0 minutes and 18.0508570671 seconds. <-- Highest (!!WOW!!)
10000 times in 0 minutes and 14.0483140945 seconds.
10000 times in 0 minutes and 12.6151368618 seconds.
10000 times in 0 minutes and 12.2505831718 seconds. <-- Lowest