|
|
PHP-4.0.6 In class we looked at the installation of PHP3.
These notes are written on a Sunday night, three days after the lecture.
So I will use them as a jumpstart for Tuesday.
Here's how we install PHP4 as an Apache module.
Create a temporary directory /tmp/username
Copy /u/dgerman/public/php-4.0.6.tar.gz there and uncompress and unarchive it.
Then remove the .tar file and go into the directory created.
Inside that directory run ./configure as follows:
Then runburrowww.cs.indiana.edu% pwd /tmp/dgerman/php-4.0.6 burrowww.cs.indiana.edu% ./configure \ --with-mysql=/l/mySQL \ --with-apache=/u/dgerman/apache/apache_1.3.20 \ --with-config-file-path=/u/dgerman/apache/apache_1.3.20/conf \ --with-xml --enable-track-vars \ --prefix=/u/dgerman/apache/apache_1.3.20/src
make.
Then run make install.
Copy php.ini-dist as php.ini into the directory
Now you need to recompile/u/username/apache/apache_1.3.20/conf
apache.
Then runburrowww.cs.indiana.edu% pwd /nfs/paca/home/user1/dgerman/apache/apache_1.3.20 burrowww.cs.indiana.edu% ./configure \ --prefix=/u/dgerman/apache/apache_1.3.20 \ --activate-module=src/modules/php4/libphp4.a
make.
Then run make install.
Change your httpd.conf by uncommenting this line:
# LanguagePriority allows you to give precedence to some languages
# in case of a tie during content negotiation.
#
# Just list the languages in decreasing order of preference. We have
# more or less alphabetized them here. You probably want to change this.
#
<IfModule mod_negotiation.c>
LanguagePriority en da nl et fr de el it ja kr no pl pt pt-br ru ltz ca es sv tw
</IfModule>
#
# AddType allows you to tweak mime.types without actually editing it, or to
# make certain files to be certain types.
#
# For example, the PHP 3.x module (not part of the Apache distribution - see
# http://www.php.net) will typically use:
#
#AddType application/x-httpd-php3 .php3
#AddType application/x-httpd-php3-source .phps
#
# And for PHP 4.x, use:
#
AddType application/x-httpd-php .php
#AddType application/x-httpd-php-source .phps
AddType application/x-tar .tgz
#
# AddHandler allows you to map certain file extensions to "handlers",
# actions unrelated to filetype. These can be either built into the server
# or added with the Action command (see below)
Then restart your server
Also verify that your server now has the PHP module inside:../bin/apachectl restart
burrowww.cs.indiana.edu% pwd /nfs/paca/home/user1/dgerman/apache/apache_1.3.20/conf burrowww.cs.indiana.edu% ../bin/httpd -l Compiled-in modules: http_core.c mod_env.c mod_log_config.c mod_mime.c mod_negotiation.c mod_status.c mod_include.c mod_autoindex.c mod_dir.c mod_cgi.c mod_asis.c mod_imap.c mod_actions.c mod_userdir.c mod_alias.c mod_access.c mod_auth.c mod_setenvif.c mod_php4.c suexec: disabled; invalid wrapper /u/dgerman/apache/apache_1.3.20/bin/suexec burrowww.cs.indiana.edu%
Don't forget to remove everything you had on /tmp.
Now create a simple file one.php that looks like this
and access it from the web.<? phpinfo() ?>
Here's the page with all three examples, of which the last one
burrowww.cs.indiana.edu% cat three.php
<? session_start();
if (session_is_registered("acc")) {
if ($fun == "add") $acc += $arg;
else if ($fun == "sub") $acc -= $arg;
} else {
$acc = 0;
session_register("acc");
}
?>
<html><head><title>Sessions Examples</title></head><body bgcolor=white>
<form method="POST" action="<? echo $SCRIPT_NAME; ?>">
The current value of the accumulator is: <? echo $acc ?>
<table cellpadding=2><tr>
<td> Amount: </td> <td>
<input type="text" name="arg" size=4> </td> <td>
Function: </td> <td> <select name="fun">
<option value="non"> Click Me!
<option value="add"> Deposit
<option value="sub"> Withdraw
</select> </td> </tr> </table>
<p> Enter the amount, select a function, then press
<input type="submit" value="Proceed"> <p>
</form></body></html>
burrowww.cs.indiana.edu%
is by far the most important. Can you see how it works?