You will be adding PHP server-side scriping to your web server.
You will be implementing and benchmarking a PHP-version of the file-based name/value pair program.
Part 1.
Install, configure, and test PHP on your Apache server.
Before installing PHP, you need to install libxml.
Decompress and untar the libxml source file.
Build and install it in the usual way:
./configure
make
sudo make install
Install PHP as an Apache module. First decompress and untar the PHP source file.
You need to set the --with-apxs2 switch during configuration in order to use PHP as a Apache 2 shared module.
Build and install as follows:
The PHP installation process should have modified your httpd.conf file to load the PHP shared module.
You also need to tell Apache what types of files are to be parsed for PHP code.
Our servers will support PHP on files ending in .php.
Check/add the following options to httpd.conf:
LoadModule php5_module modules/libphp5.so (near the top after the foo_module line)
AddType application/x-httpd-php .php (inside of <IfModule mime_module>)
Now test out the new PHP functionality of your server. If something doesn't work, check the log files in /usr/local/apache2/logs.
Start or restart your Apache server using apachectl.
Create an HTML page in your htdocs 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. <? phpinfo(); ?>
Copy test.php to test.html. What happens if you go to http://localhost/test.html? You may want to View Source in Firefox.
Part 2.
Create a file-based name/value pair storing program just like in Assignment #1.
The PHP script will store the pairs in a files in the htdocs directory.
You will need to set the permissions of this folder as in Assignment #1.
Create a PHP script lookup.php in your htdocs web server root 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.
A common use of PHP is to include() a standard header or footer containing HTML code shared by all pages on a site.
Develop your own header.php and footer.php and use them from your new get.php and set.php pages.
The cheesier your web site design the better.
Bonus points for approximating the infamous blink tag.
Part 3.
Benchmark your CGI program using the Apache benchmark utility ab.
The utility is located in /usr/local/apache2/bin.
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).
This time you only need to do the read tests with 1000 repeated requests.
Submission.
I will be testing your application by logging into your sever, starting Apache and then going to your get.php and set.php pages.
Submit the files lookup.php, set.php, get.php, header.php, footer.php and readme.txt
to the Moodle dropbox.
The Moodle timestamp is the completion time for the assignment.