server is generally configured as a minimally privileged user who can access only those files that everyone else can access. (We explained how
to find the document root in“The Apache Document Root and how to set the correct file permissions in “Checking
Whether Your Apache Installation Supports PHP,” both in Chapter Now, you’re ready to test the script by requesting it with a web browser. Suppose the web server
serves pages for the domain http://www.invyhome.com. You can request
shop.php by loading the URL
http://www.invyhome.com/shop.php with your web browser. If you’re trying things out on your own development system (
localhost
), you can use
http://localhost/shop.php.
To
supply the required parameters, you (or typically, another script) can add them after a question-mark character in the URL, as in
http://www.invyhome.com/shop.php?productID=12&quantity=4 and send a request for this address to the server. There- quest asks for 4
units of productID12 to be added to the cart. When you request the
URL, the web server looks in the directory
/var/www/html/,
finds the script shop.php,
starts the PHP script processor, runs the script and supplies the parameters, and captures the output. The output
is then sent to the browser, which displays the response:
in this case, an HTML success message that shows 4 units of productID
12 have been successfully added to the cart. Figure 13-2 illustrates these steps.
Three-Tier ArchitecturesFigure 13-3 shows the architecture of atypical web database application. The web browser is the
client tier, providing the interface to the application but very little of the application logic itself. The
middle tier is the web server,
the script processor, and the scripts most of the application logic resides here, typically including user authentica-
User’s
computerHost running invyhome.com
(running database and web servers)
Web server software shop.php
PHP software
(component of web server)
Share with your friends: