Submit Your Article Forum Rules

Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: php error

  1. #1

    php error

    Hi all

    I am getting error in the php logs, when I call for the index.php that is made up of 3 inc's this is the error that I get.

    [13-May-2004 14:53:29] PHP Warning: main(C:/apache2/htdocs/inc/header1.php): failed to open stream: No such file or directory in C:\apache2\htdocs\giftdealsgalore\index.php on line 2

    [13-May-2004 14:53:29] PHP Warning: main(): Failed opening 'C:/apache2/htdocs/inc/header1.php' for inclusion (include_path='.;c:\apache2\php;c:\apache2\php\sma rty;c:\apache2\php\pear;c:\apache2\php\pear\pear') in C:\apache2\htdocs\giftdealsgalore\index.php on line 2

    It's not that I don't understand that the inc dir. needs to be in the dir. of giftdealgalore it is according to the file structure at the command promt.

    It appears to me that php looked for the inc here 'C:/apache2/htdocs/inc/header1.php' when it should have looked here
    'C:/apache2/htdocs/giftdealsgalore/inc/header1.php'
    everything works fine on the remote host this is on localhost.

    any ideas

    Mike
    New SiteWhy Me Guy

  2. #2
    WebProWorld MVP
    Join Date
    May 2004
    Posts
    1,229
    What is the code you are using to call the files?

  3. #3
    Thanks Jestep

    This is the code, and this has given me a idea that maybe calling for the code locally may be different than callin it remotelly I may not have local site set up right yet still very confusing. Think I will change what is below

    <?php
    include $_SERVER['DOCUMENT_ROOT']."/inc/header1.php";

    include $_SERVER['DOCUMENT_ROOT']."/inc/leftcol.php";

    include $_SERVER['DOCUMENT_ROOT']."/inc/rightcol.php";
    ?></div>
    </div>
    <div align="center">


    [img]/giftsgalore_1aaa.jpg[/img]</p>


    </p>


    </p>
    </div>
    </div>
    </body>
    </html>

    to

    <?php
    include $_SERVER['DOCUMENT_ROOT']."/giftdealsgalore/inc/header1.php";

    include $_SERVER['DOCUMENT_ROOT']."/giftdealsgalore/inc/leftcol.php";

    include $_SERVER['DOCUMENT_ROOT']."/giftdealsgalore/inc/rightcol.php";
    ?></div>
    </div>
    <div align="center">


    [img]/giftsgalore_1aaa.jpg[/img]</p>


    </p>


    </p>
    </div>
    </div>
    </body>
    </html>


    Do you think maybe that is it

    Mike
    New SiteWhy Me Guy

  4. #4
    I changed it and that didn't work

    Stuumped
    New SiteWhy Me Guy

  5. #5
    WebProWorld MVP
    Join Date
    May 2004
    Posts
    1,229
    Try
    include "./giftdealsgalore/inc/header1.php";

  6. #6
    I'll try it

    Mike
    New SiteWhy Me Guy

  7. #7
    WebProWorld MVP ronniethedodger's Avatar
    Join Date
    Aug 2003
    Posts
    1,402
    Try something like this:

    Code:
    <?php 
    
    $app_root_path = './';
    
    include($app_root_path . 'inc/header1.php');
    include($app_root_path . 'inc/leftcol.php');
    include($app_root_path . 'inc/rightcol.php');
    ?>

  8. #8
    Hi Jestep

    include "./giftdealsgalore/inc/header1.php"; Well that did work. Thanks

    Hi Ron

    I think I will try your way too a little later.

    There still must be something wrong though, because I thought that I should have the same file structure for the remote and testing server.

    Mike
    New SiteWhy Me Guy

  9. #9
    WebProWorld MVP ronniethedodger's Avatar
    Join Date
    Aug 2003
    Posts
    1,402
    Quote Originally Posted by wmabear54
    There still must be something wrong though, because I thought that I should have the same file structure for the remote and testing server.
    The way I read your code is that it appeared that even though the file structure might be the same, your directory for /giftdealsgalore/ is one directory up from the root on your local server.

    This is why I included the $app_root_path = './'; in my example to establish the current working directory to use as a reference point. No matter where you move the code now, it will always be based on the reference point. In other words...it will work in root/ and root/giftdealsgalore/ too.

  10. #10
    WebProWorld MVP
    Join Date
    May 2004
    Posts
    1,229
    No matter where you move the code now, it will always be based on the reference point
    I agree, this is why I always use this format in includes, I dont have to change the code no matter where the page happens to be.

Page 1 of 2 12 LastLast

Similar Threads

  1. Unspecified error (ASP error)
    By Ghannami in forum Web Programming Discussion Forum
    Replies: 4
    Last Post: 11-06-2006, 01:51 AM
  2. Runtime Error - Line 1 - Error Syntex Error
    By charms987 in forum Graphics & Design Discussion Forum
    Replies: 6
    Last Post: 07-29-2005, 11:56 AM
  3. Error: Syntax Error in IE
    By web-content-king in forum Web Programming Discussion Forum
    Replies: 3
    Last Post: 03-20-2005, 01:42 AM
  4. The "You Made an Error" error
    By ADAM Web Design in forum WebProWorld: Guidelines/Announcements/Suggestions
    Replies: 1
    Last Post: 07-23-2004, 03:52 AM
  5. ado error
    By binaryking in forum Database Discussion Forum
    Replies: 3
    Last Post: 04-12-2004, 05:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •