There was a small mistake in the original instructions that broke the PHP/MySQL interface (you couldn't use any of the mysqli functions). I've fixed it in the notes now.
In this lab, you will install PHP to your Silo directory and configure it to interface with your Apache and MySQL installations. Then you'll create a simple test page with PHP to see if it worked.
Here is a rough walkthrough, similar to what we did to install Apache.
#Check to see if Apache is running.
ps -ef | grep username
#If it is running, stop it.
cd apache
cd bin
./apachectl stop
#And then back up to your user directory.
cd ..
cd ..
#Copy the PHP archive from wherever Erik put it
cp /l/www/classes/a202-ewennstr/software/php-5.5.13.tar.gz .
#Don't forget that period at the end!
#Unzip it
gunzip php-5.5.13.tar.gz
#Unarchive it
tar xvf php-5.5.13.tar
cd php-5.5.13
#Read the installation readme, if you want
more INSTALL
#When you're done reading...
#Configure the installation for your directory
./configure \
--with-mysql=/u/username/mysql \
--with-mysqli=/u/username/mysql/bin/mysql_config \
--with-apxs2=/u/username/apache/bin/apxs \
--with-config-file-path=/u/username/apache/conf \
--prefix=/u/username/apache
# Of course, if you installed Apache or MySQL into a different directory, you
#should change these instructions to fit where you installed it.
#build the program
make
#install the program
make install
#Copy the default configuration file into the Apache configuration directory.
cp php.ini-development ~/apache/conf/php.ini
#Edit the PHP configuration file.
cd ..
cd apache/conf
pico -w php.ini
#Find the line that reads:
;session.save_path = "/tmp"
#and change it to:
session.save_path = "/u/username/apache/phpsessions"
#Remember to delete the semicolon at the beginning of the line. We're setting up
#a directory in which to store PHP sessions.
#Exit and save the file.
#Now the directory we just told it to look for might not exist, so we should fix
#that.
cd ..
ls
#If the directory "phpsessions" is there, great! If not, create it:
mkdir phpsessions
#Edit the Apache configuration file so that it knows to execute .php and .phtml
# files as PHP and to show .phps files as PHP source code.
cd conf
pico -w httpd.conf
#I don't think it matters much where you put these lines in the file, but I put
#them in right after the other "FilesMatch" statements.
<Filesmatch "\.ph(p|tml)$">
SetHandler application/x-httpd-php
</FilesMatch>
<Filesmatch "\.phps$">
SetHandler application/x-httpd-php-source
</FilesMatch>
#Exit and save.
#Start up Apache again.
cd ..
cd bin
./apachectl start
#Next, create a simple web page with PHP to see if it's working.
cd ..
cd cgi-bin
pico test.php
#Put the following code into the file.
<html>
<head>
<title>PHP Test Page</title>
</head>
<body>
<h1>PHP Test Page</h1>
<?php
echo "Hooray!";
?>
</body>
</html>
#Exit and save the file. Then open your browser and load up the page you just
#created to see if it works!
When you're done, get it checked by one of the AI's during the lab, or send me a link via e-mail.
This assignment is due Monday, July 7th before class.