Thread: Path-ralated problem while setting up a local postgresql website

Path-ralated problem while setting up a local postgresql website

From
Adrian Maier
Date:
Hello,

I am unable to run a local copy of the PostgreSQL website. The errors I'm
getting are:

[Wed Jan 11 02:24:45 2006] [error] [client 192.168.0.2] PHP Warning:
main(./global/settings.php): failed to open stream: No such file or
directory in /home/am/pgweb/portal/system/handler.php on line 8

[Wed Jan 11 02:24:45 2006] [error] [client 192.168.0.2] PHP Fatal
error:  main(): Failed opening required './global/settings.php'
(include_path='.:/usr/pkg/lib/php/') in
/home/am/pgweb/portal/system/handler.php on line 8


It seems to be unable to include the files based on a relative path:


I modified in handler.php the line :

    require_once './global/settings.php';
to
    require_once '/home/am/pgweb/portal/global/settings.php';

The error disappears, but it complains about the next require_once.

This is probably a configuration issue.
Any ideas about what can be done to fix the problem?
(it is very ugly to modify all the php files to use full paths ... )


Cheers,
Adrian Maier

Re: Path-ralated problem while setting up a local postgresql website

From
"Magnus Hagander"
Date:
> I modified in handler.php the line :
>
>     require_once './global/settings.php'; to
>     require_once '/home/am/pgweb/portal/global/settings.php';
>
> The error disappears, but it complains about the next require_once.
>
> This is probably a configuration issue.
> Any ideas about what can be done to fix the problem?
> (it is very ugly to modify all the php files to use full paths ... )

In the .htaccess file in the root (portal) directory, I have:
php_value include_path "/var/www/pg-pear/lib:."

Do you have that, or similar? Note the single-dot path at the end after
the colon, it needs to be there.
And if it's there, are you sure it's being processed (the htaccess
itself, but also this line in particular)? Also worth double-checking.

//Magnus

Re: Path-ralated problem while setting up a local postgresql website

From
Adrian Maier
Date:
>
> In the .htaccess file in the root (portal) directory, I have:
> php_value include_path "/var/www/pg-pear/lib:."
>
> Do you have that, or similar? Note the single-dot path at the end after
> the colon, it needs to be there.
> And if it's there, are you sure it's being processed (the htaccess
> itself, but also this line in particular)? Also worth double-checking.

Hello,

In .htaccess i have :
    php_value include_path "/usr/pkg/lib/php/:."
The setting is surely processed because the error message displays
the include_path .


Anyway, I have read the user comments for php's  include
and found a solution:
The problem is solved by adding at the beginning of handler.php :
         chdir(realpath(dirname(__FILE__)));


Thanks for the reply,
Adrian Maier

Re: Path-ralated problem while setting up a local postgresql website

From
Adrian Maier
Date:
On 1/11/06, Adrian Maier <adrian.maier@gmail.com> wrote:
>
> Anyway, I have read the user comments for php's  include
> and found a solution:
> The problem is solved by adding at the beginning of handler.php :
>          chdir(realpath(dirname(__FILE__)));

Hello again guys,

After finding the solution described above, i stumbled across another problem:

Apparently randomly some pages of the website fail to load, generating the
following errors:


[Sat Jan 14 23:40:09 2006] [error] [client 82.76.xxx.xx] PHP Notice:
Constant MAX_OPTIONS already defined in
/home/am/pgweb/portal/system/global/settings.php on line 21, referer:
http://pgsql.newsoftcontrol.ro:8888/
[Sat Jan 14 23:40:09 2006] [error] [client 82.76.xxx.xx1] PHP Notice:
Constant MIRROR_CELLS already defined in
/home/am/pgweb/portal/system/global/settings.php on line 24, referer:
http://pgsql.newsoftcontrol.ro:8888/
[Sat Jan 14 23:40:09 2006] [error] [client 82.76.xxx.xx] PHP Notice:
Constant DEBUG already defined in
/home/am/pgweb/portal/system/global/settings.php on line 27, referer:
http://pgsql.newsoftcontrol.ro:8888/
[Sat Jan 14 23:40:09 2006] [error] [client 82.76.xxx.xx] PHP Fatal
error:  Cannot redeclare database_connect() (previously declared in
/home/am/pgweb/portal/system/global/functions.database.php:13) in
/home/am/pgweb/portal/system/global/functions.database.php on line 13,
referer: http://pgsql.newsoftcontrol.ro:8888/


Sometimes,  if i click "refresh"  several times the page finally gets loaded.
What could be done to avoid this problem ?


Best wishes,
Adrian Maier