faq_php

Searching Sun Java System Web Server

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>

Related blogs

Web Server, PHP, and a hosted environment

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

Sign up or Log in to add a comment or watch this page.


The individuals who post here are part of the extended Sun Microsystems community and they might not be employed or in any way formally affiliated with Sun Microsystems. The opinions expressed here are their own, are not necessarily reviewed in advance by anyone but the individual authors, and neither Sun nor any other party necessarily agrees with them.

Copyright 1994-2009 Sun Microsystems, Inc.
Powered by Atlassian Confluence
Sun Guidelines on Public Discourse Privacy Policy Terms of Use Trademarks Site Map Employment Investor Relations Contact