You will be adding PHP server-side scriping to your web server.
You will be implementing and benchmarking a PHP version and an Apache module version of the file-based name/value pair program.
You will further investigate a dynamic content generating technology of your own choosing.
Part 1. Install, configure, and test PHP on your Apache server.
To install PHP into your Apache web server, do the following:
sudo apt-get install php5 libapache2-mod-php5
Now test out the new PHP functionality of your server.
If something doesn't work, check the log files in /var/log/apache2.
Start or restart your Apache server using /etc/init.d/apache2.
Create an HTML page in your /var/www under the name test.php.
Test that a normal HTML page can be loaded from the test.php file.
Test adding some PHP script to test.php, e.g. <?php phpinfo(); ?>.
Your browser should show display all sorts of information about the PHP installation.
Note that by default, the shorthand <? ?> tags will not work.
Copy test.php to test.html. What happens if you go to http://X.X.X.X/test.html? You may want to View Source in Firefox.
Part 2.
Create a file-based name/value pair storing program just like in the previous assignment.
The PHP script will store the pairs in files in the /var/www directory.
Create a PHP script lookup.php in your web server's home directory.
The script is controlled by the HTML GET parameters: file, name, and val.
Parameters from a GET request are available in the PHP superglobal $_GET variable, e.g. $_GET["file"].
PHP supports a wide-variety of C-like file function, for example fopen.
To test your script, create two web pages get.php and set.php.
These pages should provide a form that allows the user to get and set values via your lookup.php script.
Part 3.
Create an in-process Apache module version of the name/value pair program.
The module will store the pairs in files in the /var/www directory.
You will need to develop the module in C.
The following instructions show how to build and install a simple module that prints "Hello world!" and returns the passed in query string.
Compile the module: apxs2 -c mod_lookup.c.
Note: You may need to install development tools onto your server first:
sudo apt-get install apache2-dev
Install the compiled module into Apache: sudo apxs2 -i -a -n lookup mod_lookup.la
You should now find that the module has been copied to the /usr/lib/apache2/modules directory.
You should also find that a lookup.load file has been added to your /etc/apache2/mods-available directory with a symbolic link placed in /etc/apache2/mods-enabled.
Configure your Apache server to send requests to a specific subdirectory to your custom Apache module by creating /etc/apache2/mods-available/lookup.conf.
You need to make sure Apache loads the above configuration whenever it starts. To do this, add a symbolic link to the lookup.conf file to the /etc/apache2/mods-enabled subdirectory.
Restart your Apache server.
Test that requests to the /lookup subdirectory are now serviced by the Apache module.
For example, try visiting http://localhost/lookup?name=val
Modify mod_lookup.c to support getting and setting of parameters.
Copy your get.php and set.php pages from Part 2 to get_mod.php and set_mod.php.
Modify get_mod.php and set_mod.php to use your Apache module instead of the PHP script.
Part 4.
Create final version of the name/value pair program using a dynamic content generation technique of your own choosing (but not CGI, PHP or an Apache module).
Some possibilities include FastCGI, mod_perl, mod_python, a custom web server, or a web server besides Apache.
The student achieving the fastest average requests per second will be awarded extra points.
Part 5.
Benchmark your PHP, Apache module, and other technique using the Apache benchmark utility ab.
Type ab with no arguments to get a list of its features.
Complete this readme.txt file with the requests per second you measure using ab connecting locally to your server (that is using the base URL http://127.0.0.1).
Run results for all three versions of the application.
Submission.
I will be testing your application by logging into your sever, starting Apache and then going to your get and set pages.
Submit the files lookup.php, set.php, get.php, get_mod.php, set_mod.php, mod_lookup.c, readme.txt,
and the relevant source code for your final technique to the Moodle dropbox.
The Moodle timestamp is the completion time for the assignment.