Those instructions are for embedding PHP support within the JBoss Web Server, not the JBoss Application Server (they are two separate products).
However, the JBoss Web Server is the default Web server in JBoss Application Server 4.2 and 5.0 (JBoss Application Server 4.0.x uses Tomcat as its Web server). You might be able to use the instructions to embedd PHP support into JBoss Application Server 4.2 or 5.0 (trying this is on my todo list but rather low priority right now).
You might be able to get more help on the JBoss Web Server forum. http://www.jboss.com/index.html?module=bb&op=viewforum&f=230
I will also post the question on the JBoss Web Server.
It is good you posted it there, but look at my reply again. You cannot do what you want to do with JBoss AS 4.0.4, you will have to switch to JBoss AS 4.2 or 5.0 beta2. So in the JBoss Web Server forum you should have asked if the instructions to get PHP to work with JBoss Web Server also work with JBoss AS 4.2 or 5.0 given that those versions come with JBoss Web Server.