Operation Manual

The final step is to confirm that the PHP scripting module is loaded correctly in Apache. This module is important: it allows the
Apache web server to run PHP scripts to serve dynamic content. Without a working PHP moduleor an alternative module for
another scripting language like PythonApache is only able to server static pages. To test the Apache PHP module, create a
new PHP script file using the following command, typed as a single line:
sudo sh -c echo <?php phpinfo(); ?> >
/var/www/phptest.php
This command creates a new file called phptest.php in the /var/www directory. This file tells PHP to create an information
page for diagnostic purposes. Visit this using either a browser on another computer by typing http://ipaddress/phptest.php
(replacing ipaddress with the IP address of the Raspberry Pi) or on the Pi itself by typing http://localhost/phptest.php
into the address bar (see Figure 9-4).
Figure 9-4: Testing Apache’s PHP module on the Raspberry Pi