You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by AR <li...@tuxdoit.com> on 2006/10/05 21:10:52 UTC

[users@httpd] Really strange

Hi,

I have this line of code in PHP:
include_once('../config.inc.php');

I'm 100% sure that the file config.inc.php is a directory up.

config.inc.php is in /var/www/html
and the file that calls it is in
/var/www/html/classes

nevertheless, i'm getting the error:
"Warning: main(../config.inc): failed to open stream: No such file or
directory in /var/www/html/classes/dBInsert.php on line 10

Warning: main(): Failed opening '../config.inc' for inclusion
(include_path='.:/usr/share/pear') in /var/www/html/classes/dBInsert.php
on line 10"

Permissions and ownership are ok.

I even set:
include_once('/var/www/html/config.inc.php');
and nothing :(

I'm boggled!

Any help would be appreciated.

Best Regards,
Deckard

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Really strange

Posted by John Garvin <jg...@gmail.com>.
On 10/5/06, AR <li...@tuxdoit.com> wrote:
> Hi,
>
> I have this line of code in PHP:
> include_once('../config.inc.php');
>
> I'm 100% sure that the file config.inc.php is a directory up.
>
> config.inc.php is in /var/www/html
> and the file that calls it is in
> /var/www/html/classes
>
> nevertheless, i'm getting the error:
> "Warning: main(../config.inc): failed to open stream: No such file or
> directory in /var/www/html/classes/dBInsert.php on line 10
>

>From http://php.net/include :
"Files for including are first looked in include_path relative to the
current working directory and then in include_path relative to the
directory of current script. E.g. if your include_path is ., current
working directory is /www/, you included include/a.php and there is
include "b.php"  in that file, b.php is first looked in /www/  and
then in /www/include/. If filename begins with ./ or ../, it is looked
only in include_path relative to the current working directory."

So... *boggle* php's inlude_path is a list of directories that will be
searched *relative* to the current directory IF you include a file
beginning with ./ or ../ . If you include('filename') then it uses the
elements of include_path as absolute paths.

wow. That seems intuitive.
-- 
jpg

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Really strange

Posted by Saline Erik <es...@pen-tec.com>.
On Oct 5, 2006, at 12:10 PM, AR wrote:

> Hi,
>
> I have this line of code in PHP:
> include_once('../config.inc.php');
>
> I'm 100% sure that the file config.inc.php is a directory up.
>
> config.inc.php is in /var/www/html
> and the file that calls it is in
> /var/www/html/classes
>
> nevertheless, i'm getting the error:
> "Warning: main(../config.inc): failed to open stream: No such file or
> directory in /var/www/html/classes/dBInsert.php on line 10

It does not look like it has a problem with config.inc.php file, but  
a file called dBInsert.php

Does that file exist in /var/www/html/classes/ and with correct  
permissions?  What does line 10 say?

A php forum might have a quicker answer.



Erik


>
> Warning: main(): Failed opening '../config.inc' for inclusion
> (include_path='.:/usr/share/pear') in /var/www/html/classes/ 
> dBInsert.php
> on line 10"
>
> Permissions and ownership are ok.
>
> I even set:
> include_once('/var/www/html/config.inc.php');
> and nothing :(
>
> I'm boggled!
>
> Any help would be appreciated.
>
> Best Regards,
> Deckard
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server  
> Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org