📄 01-insttest.sgml
字号:
<!-- $Id: 01-insttest.sgml,v 1.1.1.1 2000/04/17 16:39:58 kk Exp $ --><sect1>Testing<p>These instructions apply to PHPLIB running with CGI PHP. Most ofthem is valid for mod_php as well, though. This sectionoffers an incremental approach to find installation problems,should the above installation process fail.We do have a support mailing list available under the address<tt/phplib@lists.netuse.de/. To subscribe to the list, send the command<tt/subscribe/ to the address <tt/phplib-request@lists.netuse.de/.<descrip><tag>Checking that the web server is up and running</tag>Make sure your web server is up and serving the virtual host youjust set up. To do this, construct a small file <tt/test1.html/in your DocumentRoot and access <tt/test1.html/ through yourweb server.<tag>Checking that the web server is executing CGI programs</tag>Make sure your web server is up and does run CGI. Check thecurrent directory, the UID/GID it is running programs under andhave a look at the environment variables. Install the shellscript<tscreen><code>#! /bin/sh -- echo "Content-Type: text/plain"echoidechopwdechoenv | sortecho</code></tscreen>in your cgi directory under the name of <tt/cgi-test/ and inyour document root under the name of <tt/cgi-test.cgi/. Make itexecutable. Try to access<tt>/cgi/cgi-test?par1=one&par2=two</tt> and<tt>/cgi-test.cgi?par1=one&par2=two</tt> and check theoutput. What UID/GID are you running under, what is the outputof <tt/pwd/ and what environment variables are set? What does<tt/QUERY_STRING/ look like? What does the <tt/PATH/variable look like, what does the<tt/LD_LIBRARY_PATH/ variable look like and areall libraries needed by PHP accessible to PHP running in the CGIenvironment (Check by running the Unix <tt/ldd/ command on PHP).In particular, if you built Oracle support into PHP and linked<tt/libclntsh/ dynamically: Can it be loaded from the CGI environment? Ifnot, PHP will not come up later in the next step.<tag>Checking that the PHP interpreter is running (Assuming CGIPHP)</tag>Copy your PHP binary into the cgi binary directory (which shouldNOT be below DocumentRoot!) and make it executable. Copy<tt/php3.ini/ into the same directory. In DocumentRoot, create a<tt/test2.php3/ and put <?php phpinfo() ?> into it.Are you running Apache? Add<tscreen><code>Action php3-script /cgi/phpAddHandler php3-script .php3DirectoryIndex index.php3 index.html index.htmFancyIndexing on</code></tscreen>to your config. This will map all requests to files ending in<tt/.php3/ to the <tt/php3-script/ handler and define<tt>/cgi/php</tt> as the URL handling <tt/php3-script/ requestsinternally.Request <tt>/test2.php3</tt> and see that it is being executed.Make changes to your <tt/php3.ini/ (preferable some colordefinitions) and reload. Are they reflected in the output of<tt/phpinfo()/? If not, your <tt/php3.ini/ is not being foundand your are having a problem. Recompile with proper settings.Check the output of <tt/phpinfo()/ carefully! Is your PHPversion current (We have tested and developed this release withPHP 3.0.12)? Are your database interfaces present in the outputof <tt/phpinfo()/? If not, recompile again.Can you access <tt>/test2.php3</tt> under the URL<tt>/cgi/php/test2.php3</tt> as well? If so, you did not compileyour PHP interpreter with <tt/--enable-force-cgi-redirect/.PHPLIB will not work with this interpreter. Recompile with theswitch being set.<tag>PHP interpreter (Assuming mod_php)</tag><p>Assuming your server is already correctly setup(don't forget to activate the PHP lines in <tt/srm.conf/!),enter the following file and save it as <tt/test2.php3/under your DocumentRoot.<tscreen><code><? phpinfo() ?></code></tscreen>If you access this using a web browser now, it should spit outmuch info about PHP, Apache and its environment.<tag>Checking PHPLIB inclusion</tag><p>Does you PHP include PHPLIB properly? Check your<tt/php3.ini/ file. It must include the following settings:<tscreen><code>include_path = pathname to directory with all the .inc filesauto_prepend_file = path to prepend.php3track_vars = On</code></tscreen>It should contain the following settings, too:<tscreen><code>magic_quotes_gpc = On</code></tscreen>If PHPLIB is included properly by your setup, the following pagewill execute without errors:<tscreen><code><?php$db = new DB_Example;print "It works without error messages.<br>\n"; ?></code></tscreen><tag>Checking database connectivity</tag><p>PHPLIB installation requires that you adapt <tt/local.inc/properly. Particularly, the provided class <tt/DB_Example/ must becustomized for your database connection. Test that yourweb server can access the database with the following page:<tscreen><code><?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);?></code></tscreen>When executing properly, this page will show you the user entryfor <tt/kris/, password <tt/test/, permissions <tt/admin/ fromthe <tt/auth_user/ table. If this does not happen, your<tt/DB_Example/ definition in <tt/local.inc/ is broken.<tag>Checking that sessions work</tag><p>Access the page <tt>/index.php3</tt> that has been providedwith the distribution. This page will try to set a cookie inyour browser. Allow that cookie to be set.The page will display a headline with a counter. Reload thatpage. The counter must increment. If not, either your browsercannot deal properly with cookies or PHPLIB cannot properly reador write the table <tt/active_sessions/ in your database. Checkthat the cookie is being set by viewing the output of<tt/phpinfo()/ (the fourth table will report the cookie andother per-call data). Check your database permissions with yourdatabase command line interface.<tag>Checking that Authentication works</tag><p>Try loading <tt>/showoff.php3</tt> that has been providedwith the distribution. This page will require a login. Login as<tt/kris/, using a password of <tt/test/. If the login issuccessful, you will see the per-session counter and a per-usercounter 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 <tt/auth_user/ table. Youmust be able to <tt/SELECT/ on that table and there must be atan entry for the user you are trying to login.</descrip>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -