This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
The Apache HTTP Server does not know anything about Java. However what it can do is specify that certain resources should be handled by some other process, such as a Java Web Application Server (e.g. Tomcat). As an example, you can say that anything that starts with /myApplication/... should be served by Tomcat. Everything else will be handled by the Apache HTTP Server.
For the files that are processed by the Apache HTTP Server, you normally specify that PHP files will be identified by having a ".php" extension (there are ways around that), so that the Apache HTTP Server knows to run it through the PHP processor.
There are more nuances to configuration, but that gives a high-level overview.
Apache web server itself doesn't serve to process java. Rather it delegates java processing to other servers like Tomcat. As Andrew said it does so based on the incoming requests, anything with /so-and-so should go to so and so process etc. So if the request has a .php extension in the end it has something to with PHP likewise. You manually configure these things in one of the Apache's configuration file. (I'm not sure if it is httpd.conf)