the ebuild for php-4.1.2-r9 has java as a dependant, so portage automatically downloads and installs java (among many other things). hoever, during the configuration of php itself, it errors out when it looks for Java VM (forgive me, i dont know what this is). the solution for this is to hack the ebuild. i used nano and search for entries of "java". the first entry is a dependancy value, and cannot be commented out as portage thinks the # is a dependancy, and doesnt know what to do about it. so i removed that line entirely. all other entries of java can be commented out. they are in if/then/else statements, so the whole nest should be commented out. there are two nests containing the phrase "java". after i did this. it worked fine. good luck!
after a java vm is installed you need to configure it using java-config! after that run env-update and this should be fine if you want to compile php without java support # export USE="-java" # emerge php