Re: How to redirect after a valid login

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



on 2004/03/15 15:39, Larry Sandwick at lgs@xxxxxxxxxxx made the following
allegation:

> Here is the error I get when I use the include below:
> 
> include "MainMenu.php";
> 
> Fatal error: Cannot redeclare class db in
> /tmp/disk/home/webmaster/Files/WWW/pearDB/DB.php on line 211

As someone else mentioned, inside the MainMenu.php file, use include_once
instead of just include.  That is probably your problem.

I'll add the following additional comment for people searching for solutions
in the archive:

There is complication, however, if you are trying to use a local version of
the DB or PEAR class (Maybe all PEAR classes in general).  If you are doing
that, you'll need to make sure that your local directories are at the
beginning of the include_path.

For example, let's say I do something like this:

include_once './new-version/DB.php';

Within the DB.php associated files in the DB directory, there are calls to
'include_once DB.php'.  Those includes will use the includes path, which by
default is something like '/usr/lib/php/', not the place you included your
file from.  As far as PHP is concerned, those are different files.  Thus,
PHP first loads your DB.php and then the system version, resulting in the
error you mention above.

To get around that, I do something like this:

$file_system_location = dirname(__FILE__);

$current_includes_path = ini_get('include_path');

$new_include_path =
    $file_system_location . '/includes:' .
    $current_includes_path;

ini_set('include_path',$new_include_path);

Hope that helps.

Sincerely,

Paul Burney
<http://paulburney.com/>

<?php
    while ($self != "asleep") {
        $sheep_count++;
    }
?>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux