I was working along until I came across an error.
Warning: require_once(../../Registration/register.php) [function.require-once]: failed to open stream: No such file or directory in /var/www/HTML Header Body Content And Footer/Body/body.php on line 6
Fatal error: require_once() [function.require]: Failed opening required '../../Registration/register.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/HTML Header Body Content And Footer/Body/body.php on line 6
I need to be able to use require_once to insert some code conditionally, but it's not working.
I'm having some trouble with require_once
Moderator: General Moderators
-
cpetercarter
- Forum Contributor
- Posts: 474
- Joined: Sat Jul 25, 2009 2:00 am
Re: I'm having some trouble with require_once
Probably you have not specified the correct path from your body.php file to your register.php file. Your code appears to be looking for /var/www/Registration/register.php. Is that correct?
Re: I'm having some trouble with require_once
require_once() seems to work for all the other coding I've done. I want require_once() to require the file Up one level/Up one level/Registration/register.php relative to body.php.
../../Registration/register.php should be working.
../../Registration/register.php should be working.
Re: I'm having some trouble with require_once
cpetercarter: Yes that is the correct path I'm looking for. require_once() doesn't seem to be working in body.php. The strange thing is that I'm able to link to other files like ../CSS Include, but when I try to require register.php it isn't working.
-
cpetercarter
- Forum Contributor
- Posts: 474
- Joined: Sat Jul 25, 2009 2:00 am
Re: I'm having some trouble with require_once
Have you checked capitalisation. "register.php" and "Register.php" are not the same, for example.
Re: I'm having some trouble with require_once
I fixed the problem myself. The problem was that I had required the file into another file, thus I was trying to crawl up the directory tree when it wasn't important to do so. A warning to you noobs out there, be careful when you try to require/include multiple files... it gets messy.
Re: I'm having some trouble with require_once
I fixed the problem myself. The problem was that I had required the file into another file, thus I was trying to crawl up the directory tree when it wasn't important to do so. A warning to you noobs out there, be careful when you try to require/include multiple files... it gets messy.