Frequently asked questions about PHP with Web Server
How to Return 404 Error if a PHP file is not found?
This issue is discussed in forum - http://forum.java.sun.com/thread.jspa?messageID=9916301
With Web Server 7, one can use <If -f $path> <Else> tags to achieve this.
# Use -f $path to determine if the requested PHP file exists.
# If it exists, execute the appropriate Service stage to service
# the request.
<If \-f $path>
Service type="magnus-internal/php" fn="responder-fastcgi" ...
</If>
# If the requested PHP file does NOT exist, return a 404 rather than
# let have the server be left confused about how to service PHP.
<Else>
Service type="magnus-internal/php" fn="set-variable" error="404"
</Else>