By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,633 Members | 1,670 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,633 IT Pros & Developers. It's quick & easy.

error says can't see include file, yet executes some code on include file

P: n/a
PI
Hi guys, I need some urgent help here please:
I am using an include_once() command to include a file that sits a
level above the file view.php. when the code is run, I have an error
as follows:

Warning: include_once(../common.php) [function.include-once]: failed
to open stream: No such file or directory in C:\Program Files\..
\view.php on line 2

Warning: include_once() [function.include]: Failed opening '../
common.php' for inclusion (include_path='.;C:\Program Files\xampp\php
\pear\') in C:\Program Files\...\view.php on line 2

The include command is simply: include_once(../common.php) - the '../'
before the 'common.php' to indicate a level above the current file
level. Is this right? I could not find a resource to confirm this.

The strange thing is that while the error seems to imply that the
calling file, view.php cannot 'see' the common.php file, other
functions called from the 'common.php' file executes correctly and on
the same calling file/page (view.php).

Appears to the a double take - quite confusing - a PHP newbie and I'd
appreciate your prompt response, thanks

Feb 2 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
PI wrote:
Hi guys, I need some urgent help here please:
I am using an include_once() command to include a file that sits a
level above the file view.php. when the code is run, I have an error
as follows:

Warning: include_once(../common.php) [function.include-once]: failed
to open stream: No such file or directory in C:\Program Files\..
\view.php on line 2

Warning: include_once() [function.include]: Failed opening '../
common.php' for inclusion (include_path='.;C:\Program Files\xampp\php
\pear\') in C:\Program Files\...\view.php on line 2

The include command is simply: include_once(../common.php) - the '../'
before the 'common.php' to indicate a level above the current file
level. Is this right? I could not find a resource to confirm this.

The strange thing is that while the error seems to imply that the
calling file, view.php cannot 'see' the common.php file, other
functions called from the 'common.php' file executes correctly and on
the same calling file/page (view.php).

Appears to the a double take - quite confusing - a PHP newbie and I'd
appreciate your prompt response, thanks
Among other things - since it's a string, you need quote marks around
the filename - i.e.

include_once('../common.php'); // double quotes also work

Is this a web page or a cli program?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Feb 3 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.