HELP WITH INCLUDES

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
edwa5823
Forum Newbie
Posts: 2
Joined: Wed Oct 22, 2003 1:08 pm

HELP WITH INCLUDES

Post by edwa5823 »

I am new to PHP, and am trying to use a script that I've found on the net.. Bascially all I have to do it upload a directory and then use a php include to execute the .php file in the directory. My problem is that every time I run this I get the following error:

Warning: main(http://www.agmillerstudios.com/digitalp ... menter.php): failed to open stream: No such file or directory in /home/agmiller/public_html/digitalprintreview/review_list.php on line 78

Warning: main(): Failed opening 'www.agmillerstudios.com/digitalprintrev ... menter.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/agmiller/public_html/digitalprintreview/review_list.php on line 78


The rest of my page loads correctly, but wherever this program is suppossed to be included at the text shows that error.. Am I doing something wrong?

The program is suppossed to allow people to make comments on articles that I will be posting on my sight.

Thanks for any and all help!

Edwards
User avatar
Kriek
Forum Contributor
Posts: 238
Joined: Wed May 29, 2002 3:46 am
Location: Florida
Contact:

Post by Kriek »

Replace your original include() function call with the following.

Code: Select all

<?php
    $file = realpath('commenter.php');
    if(file_exists($file)) &#123;
        include_once($file) or die('cannot include ' . $file);
    &#125; else &#123;
        echo $file . ' does not exist';
    &#125;
?>
edwa5823
Forum Newbie
Posts: 2
Joined: Wed Oct 22, 2003 1:08 pm

Post by edwa5823 »

I'll tell you what, there are some very intelligent programmers on forums like this =) Thanks a ton for the help thus far, but unfortunatly I need to ask another question now.

That cured all of my errors, but the script still didnt' run, instead my screan now reads just one line..

/home/agmiller/public_html/digitalprintreview/commenter.php does not exist

Oddly enough the snippet you gave me did find the file in that directory, but then is reporting that said file isn't in that directory =) Any quick fixes for that? Or is it more likely that my problem is embedded in the php script I downloaded?

Thanks again for all the help!!

Edwards
Post Reply