Set up the Selenium (with PHPUnit) to generate the code coverage is not hard. You just following the information in the PHPUnit website, that enough. BUT!, If you write your own web application that never ending your script (such as you use exit() function), this thing will make you in the trouble.
The PHP script that not running to the end will not execute the code to end the code coverage session, so, you have to modify Selenium Extensions/SeleniumTestcase/prepend.php to include the function in append.php. Use the register_shutdown_function php function to make your function in prepend.php called even the script terminate by the exit() operation.
Note: During now, you cannot use WebDriver in Selenium2Testcase to generate the code coverage yet. You have to use SeleniumTestcase until the version that they will supported on it.
In my previous week, I just found that my machine have a problem when try to make the second request during the first request still loading. I think something must be wrong in the communication process between Windows - Apache - PHP / MySQL.
I see that during the problem occur, my Windows have many TIME_WAIT TCP/IP connection. So, after search about the apache problem, I try to change Registry of Windows to increase the number of User-port and reduce TIME_WAIT time before close the connection.
The problem was not solved. I try another way by change the Apache MPM parameter, I reduce number of concurrent connection, disable KeepAlive and Disable Win32AcceptEx. Problem seem like disappear for just only a moment and come back.
I found that my Apache (mod_status) is working properly during the Apache not respond. HTML files can be load. So, it should not be about the connection problem, it should be something wrong in our PHP Framework OR Apache <-> PHP.
Last, I try the Apache Benchmark to shooting my Apache server by making 10 concurrent to get more information. I found that all PHP-related files cannot make the concurrent connections at all. (even it just A simple PHP_Info file)
Hmmm, this should be about PHP extension, I think. I begin to disable one-by-one. and....
Yea!.... Finally I found that it is because Alternative PHP Cache (APC -- PHP extension) that make the error occurs. This problem cannot be found in PHP Error log, Apache Error log, MySQL Error Log or whatever. Finally I found from the APC website that my version have the Win7 file locking problem. They fixed in the new released. So, that is the finally time I can run concurrent HTTP Request without problem.
I am in a trap for really long time because it hard to investigate the component problem when there are no any information in the error log. I also trap by the session_write_close() php function that it is about file locking problem.
So, In case that you may have the same problem with me, if you have APC loaded in your PHP configuration, try to disable it and let check, if it help.