php - What error messaging could I insert into this script to find out the problem -


i'm reading book called php 5 advanced techniques larry ullman.

in chapter 4, introduces pear. after long struggle managed pear working mamp , installed auth , mdb2 package required authentication code. however, when run it, i'm getting server errror

the website encountered error while retrieving http://localhost:8888/phpvqp2_scripts/ch04/login.php. may down maintenance or configured incorrectly. here suggestions: reload web page later. 

is there kind of debugging can insert code figure out problem is? i'm bit of newbie detailed instructions helpful.

<?php # script 4.3 - login.php  /*  page uses pear auth control access.  *  assumes database called "auth",  *  accessible mysql user of "root@localhost"   *  password of "root".  *  table definition:      create table auth (     username varchar(50) default '' not null,     password varchar(32) default '' not null,     primary key (username),     key (password)     )  *  md5() used encrypt passwords.  */  // need pear class: require_once ('auth.php');  // function showing login form: function show_login_form() {      echo '<form method="post" action="login.php"> <p>username <input type="text" name="username" /></p> <p>password <input type="password" name="password" /></p> <input type="submit" value="login" /> </form><br /> ';  } // end of show_login_form() function.  // connect database:  $options = array('dsn' => 'mysql://root:root@localhost/auth');  // create auth object: $auth = new auth('db', $options, 'show_login_form');  // add new user: $auth->adduser('me', 'mypass');  ?><!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en"         "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head>     <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />     <title>restricted page</title> </head> <body> <?php  // start authorization: $auth->start();  // confirm authorization: if ($auth->checkauth()) {      echo '<p>you logged in , can read this. how cool that?</p>';  } else { // unauthorized.      echo '<p>you must logged in access page.</p>';  }  ?> </body> </html> 

enable display_errors in php.ini actual error message.

if still doesn't work, enable log_errors script's errors sent file or syslog.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -