Quick Guide to Installation
The Quick Start chapter tries to give you a ten-minute introduction to
PHPLIB installation, outlines a few simple testing procedures and closes
with an overview of PHPLIB features.
These instructions apply to PHPLIB running with CGI PHP. Most of
them are valid for mod_php as well, though. VERY
IMPORTANT NOTE: This is a quick installation guide to get
you started if you have an installation where you control the
web server, PHP interpreter and database server completely. They
are not suitable for a web hosting setup where you have only
limited to no control over the installation. Refer to the next chapter
of this documentation for the complete installation instructions
and troubleshooting information.
Before installing PHPLIB, get your web server up and running and
have it executing files with the extension .php3. Check that
with a simple <?php phpinfo() ?> script. Make sure
the web server accepts index.php3, index.php as well as index.html
as a default file for URLs ending in "/" (Apache:
DirectoryIndex index.html index.php3 index.php ).
Get your MySQL database server up an running. Create an empty
database for your application and make sure the owner of your
web server processes can access this database with SELECT,
INSERT, UPDATE and DELETE access. Don't forget
the mysqladmin reload after changing the user and db tables.
Step 1:
Create an include directory named php parallel to your
web servers document root directory. Do not put the include
directory below your web servers document root.
Step 2:
Unpack your PHPlib distribution. Move the contents of the
php distribution directory into the php directory
you just created.
Step 3:
Get to the php3.ini OR php.in file for your web servers PHP
interpreter and update the include_path statement so
that it points to that php directory. Update the
auto_prepend_file statement so that it points to the
prepend.php3 file in that include directory.
If you do not have control over your php.ini file, you did not
read the VERY IMPORTANT NOTE above.
Step 4:
Also check that track_vars are enabled and that you have
enabled magic_quotes_gpc. While you are at it, you might
want to check sendmail_path, if you plan to send mail from
your application. It has to be set to /usr/lib/sendmail -t
on most UNIX systems to work.
If you do not have control over your php.ini file, you did not
read the VERY IMPORTANT NOTE above.
Step 5:
cd into the php include directory. Edit local.inc.
In class DB_Example supply the appropriate parameters for
your database connection.
Step 6:
For this database, run create_database.mysql from the
distribution to create active_sessions and
auth_user. auth_user will be populated with a
sample user named kris with a password test.
Step 7:
Move the contents of the pages directory and all its
subdirectories into your document root directory.
Step 8:
Access the "/" URL of your web server with cookies enabled. If
no index.html is present, index.php3 will be displayed.
If you reload that page, the number shown must increment.
Access your database with the mysql command client and select
* from active_sessions. Check that there is a single session
record for your browser and see how the text in val
changes when you reload the page and select * from
active_sessions again. If this works, the session class is
functional with cookie mode.
Step 9:
Now access showoff.php3. Try to login as kris,
password test. Check active_sessions again. You now
should have a Example_Session entry (see the name
column) and a Example_User entry in your table. Both should
increment on reload.
Step 10:
Try again with cookies disabled. You should get a new session
(the cookie is lost) and you should be able to see your
session id as the get parameter part of your URL.