There is no problem with client-side Java and PHP.
PHP does not know, or care about, your applet. It simply generates the text you tell it to generate.
If you generate a valid HTML applet tag pointing to a valid location where a valid classfile can be retrieved, your browser should fetch and execute the applet, unless Java is broken in your browser. Either way, it has nothing to do with PHP. The browser fetches the applet separately and PHP is not involved in that process.
If the applet isn't loading, it's either because you are not generating a valid HTML applet tag that embeds a valid applet call, or because your classfile itself is corrupted.
<applet codebase="http://java.sun.com/applets/jdk/1.1/demo/NervousText"
code="NervousText.class" width=400 height=75>
<param name="text" value="How to embed an applet">
This text will appear for browsers with Java disabled.
</applet>
is the same as
<?
echo "
<applet codebase=\"http://java.sun.com/applets/jdk/1.1/demo/NervousText\"
code=\"NervousText.class\" width=400 height=75>
<param name=\"text\" value=\"How to embed an applet\">
This text will appear for browsers with Java disabled.
</applet>
";
?>
Simply follow the rules for embedding text in PHP double-quoted strings.