You are not understanding correctly, both are interpreted languages, java just has an extra step.
When you run PHP, the PHP engine loads in the php script and starts to parse it. Once it's done parsing it, it creates something called "opcode" this is highly condensed code that provides instructions for the PHP engine. This engine then takes that opcode and converts it to machine code as needed in order to actually run it on the machine. That machine code is also stored for later, so if you run the same piece of code twice in PHP, it only has to interpret it once.
Java is slightly different in the fact that it does the parsing in a separate step. You can't just write java code and say "ok, go run my code" like you can in PHP. It's still parsed and creates something called "bytecode" which is exactly the same as what opcode is. This gets compiled out into a .class file. Then when you run the .class code, the java engine interprets the bytecode and turns it into machine code as needed. Exactly the same as php does.
The reason they do this is portability: machine code only works on one machine, but this special in between "opcode" or "bytecode" can run on any machine that has the php or java engine.All languages get first changed into something more universal: some sort of bytecode. The difference between the interpreted languages and the compiled ones is that the compilers change everything to machine code. There is no on the fly compilation. This has the advantage of not requiring the Java Runtime Engine or the PHP engine. Once you compile a C program in C, you don't need C anymore. But if you write your code in Java or PHP, you can't remove the engines. The disadvantage to compiled code is that it only works on one architecture (64bit intel machine code will only work on that CPU or something compatible.)
You can download true compilers for both PHP and Java thought to make pure machine code.
True compilers have bytecode too, they do that so that they only need to write one compiler. Look at the GNU compilers: C, C++, Fortran, Java... lots and lots of languages. So what they write is parsers for each language. They write a converter from C to GNU bytecode, and another for Fortran to GNU bytecode, then another for Java to GNU bytecode. Then a converter from bytecode to AMD, bytecode to Intel 32, bytecode to Intel 64. See how they've dramatically reduced complexity? Could you imagine if they had to maintain a C -> AMD, C -> Intel 32, C -> Intel 64, Fortran -> AMD, Fortran -> Intel 32... Bytecode is not new, using it for portability and requiring the end machine to have an engine for it is.