MLWJ
02-03-2001, 03:26 PM
I downloaded this poll script written in PHP, and when I try to include it in my page, it gives me an error:
Fatal error: Failed opening required '/poll/poll_header.php' (include_path='.:/usr/local/lib/php') in /home/MLWJ/public_html/main.php on line 1
These are the two lines that I use to include the poll (these lines were shown in the readme file of the script):
<?php require ("/poll/poll_header.php"); ?>
The line above is put at the VERY top of the webpage, even before the <html> tag.
<?php require ("/poll/poll.php"); ?>
The line above is put where I want the poll to appear.
As you may have noticed, I call the files in the directory "/poll"
Well... that is what I think is causing the problem. The reason I suspect this is because I put the file that I'm trying to include the poll in, and changed the path of the two lines above from that to this:
<?php require ("poll_header.php"); ?>
and
<?php require ("poll.php"); ?>
After I changed those, I ran the file from the "/poll" directory and it worked perfectly. But the problem is that I really don't want to run my main page from the "/poll" directory and I really don't want to run my poll files from my main directory. I'd rather keep them as they are in their own separate directories and call the poll from its directory, but I don't know why it isn't working! I am a total newbie when it comes to PHP, and I only followed the directions the readme file of the poll gave me. It is just really weird that PHP doesn't seem to be able to call things in different directories. I hope this isn't true, considering it is a newer language. Is this problem due to me being a newbie, the script's problem with handling stuff, or HostRocket's version of PHP or something that has a bug. I personally have no clue. Any help would be GREATLY appreciated! Thanks in advance for your help.
Fatal error: Failed opening required '/poll/poll_header.php' (include_path='.:/usr/local/lib/php') in /home/MLWJ/public_html/main.php on line 1
These are the two lines that I use to include the poll (these lines were shown in the readme file of the script):
<?php require ("/poll/poll_header.php"); ?>
The line above is put at the VERY top of the webpage, even before the <html> tag.
<?php require ("/poll/poll.php"); ?>
The line above is put where I want the poll to appear.
As you may have noticed, I call the files in the directory "/poll"
Well... that is what I think is causing the problem. The reason I suspect this is because I put the file that I'm trying to include the poll in, and changed the path of the two lines above from that to this:
<?php require ("poll_header.php"); ?>
and
<?php require ("poll.php"); ?>
After I changed those, I ran the file from the "/poll" directory and it worked perfectly. But the problem is that I really don't want to run my main page from the "/poll" directory and I really don't want to run my poll files from my main directory. I'd rather keep them as they are in their own separate directories and call the poll from its directory, but I don't know why it isn't working! I am a total newbie when it comes to PHP, and I only followed the directions the readme file of the poll gave me. It is just really weird that PHP doesn't seem to be able to call things in different directories. I hope this isn't true, considering it is a newer language. Is this problem due to me being a newbie, the script's problem with handling stuff, or HostRocket's version of PHP or something that has a bug. I personally have no clue. Any help would be GREATLY appreciated! Thanks in advance for your help.