Testing your install of PHPlib
These instructions apply to PHPLIB running with CGI PHP. Most of
them is valid for mod_php as well, though. This section
offers an incremental approach to find installation problems,
should the above installation process fail.
We do have a support mailing list available under the address
phplib-users@lists.sourceforge.net. To subscribe to the
list, send a message with subscribe as the subject to the
address phplib-users-reguests@lists.sourceforge.net.
Checking that the web server is up and running
Make sure your web server is up and serving the virtual host you
just set up. To do this, construct a small file test1.html
in your DocumentRoot and access test1.html through your
web server.
Checking that the web server is executing CGI programs
Make sure your web server is up and does run CGI. Check the
current directory, the UID/GID it is running programs under and
have a look at the environment variables. Install the following shell
script (for most cases cutting and pasting)
#! /bin/sh --
echo "Content-Type: text/plain"
echo
id
echo
pwd
echo
env | sort
echo
in your cgi directory under the name of
cgi-test/ and in
your document root under the name of
cgi-test.cgi. Make it
executable. Try to access
/cgi/cgi-test?par1=one&par2=two and
cgi-test.cgi?par1=one&par2=two and check the
output.
What UID/GID are you running under, what is the output
of pwd and what environment variables are set? What does
QUERY_STRING look like? What does the PATH
variable look like, what does the LD_LIBRARY_PATH variable look like and are
all libraries needed by PHP accessible to PHP running in the CGI environment
(Check by running the Unix ldd command on PHP).
In particular, if you built Oracle support into PHP and linked
libclntsh dynamically: Can it be loaded from the CGI environment? If
not, PHP will not come up later in the next step.
Checking that the PHP interpreter is running (Assuming CGI PHP)
Copy your PHP binary into the cgi binary directory (which should
NOT be below DocumentRoot!) and make it executable. Copy
php3.ini or php.ini into the same directory. In DocumentRoot, create a
test2.php3 and put <?php phpinfo() ?> into it.
Are you running Apache? Add
Action php3-script /cgi/php
AddHandler php3-script .php3 .php
DirectoryIndex index.php3 index.php index.html index.htm
FancyIndexing on
to your
httpd.conf. This will map all requests to files ending in
.php3, php to the php-script handler and define
/cgi/php as the URL handling php-script requests
internally.
Open test2.php3 in your browser and see that it is being executed.
Make changes to your php.ini(preferable some color
definitions) and reload. Are they reflected in the output of
phpinfo()? If not, your php.ini is not being found
and your are having a problem. Recompile with proper settings.
Check the output of phpinfo() carefully! Is your PHP
version current? Are your database interfaces present in the output
of phpinfo()? If not, recompile again.
Can you access test2.php3 under the URL
/cgi/php/test2.php3 as well? If so, you did not compile
your PHP interpreter with --enable-force-cgi-redirect.
PHPLIB will not work with this interpreter. Recompile with the
switch being set.
Checking that the PHP interpreter is running (Assuming mod_php)
Assuming your server is already correctly setup
(don't forget to activate the PHP lines in httpd.conf!),
enter the following file and save it as test2.php3
under your DocumentRoot.
If you access this using a web browser now, it should spit out
much info about PHP, Apache and its environment.
Checking PHPlib inclusion
Does you PHP include PHPLIB properly? Check your
php.ini file. It must include the following settings:
include_path = pathname to directory with all the .inc files
auto_prepend_file = path to prepend.php3
track_vars = On
If PHPlib is included properly by your setup, the following page
will execute without errors:
<?php
$db = new DB_Example;
print "It works without error messages.<br>\n";
?>
Checking database connectivity
PHPLIB installation requires that you adapt local.inc
properly. Particularly, the provided class DB_Example must be
customized for your database connection. Test that your
web server can access the database with the following page:
<?php
include("table.inc"); // requires include_path to be functioning
$db = new DB_Example;
$db->query("select * from auth_user");
$t = new Table;
$t->heading = "on";
$t->show_result($db);
?>
When executing properly, this page will show you the user entry
for
kris, password
test, permissions
admin from
the
auth_user table. If this does not happen, your
DB_Example definition in
local.inc is broken.
Checking that sessions work
Access the page index.php3 that has been provided
with the distribution. This page will try to set a cookie in
your browser. Allow that cookie to be set.
The page will display a headline with a counter. Reload that
page. The counter must increment. If not, either your browser
cannot deal properly with cookies or PHPlib cannot properly read
or write the table active_sessions in your database. Check
that the cookie is being set by viewing the output of
phpinfo(). Check your database permissions with your
database command line interface.
Checking that Authentication works
Try loading showoff.php3 that has been provided
with the distribution. This page will require a login. Login as
kris, using a password of test. If the login is
successful, you will see the per-session counter and a per-user
counter again. Reload that page: The counters must increment.
If you can't login, you probably have a problem with cookies.
Check again that your browser accepts and sends session cookies.
Another problem may be access to the auth_user table. You
must be able to SELECT on that table and there must be at
an entry for the user you are trying to login.