Page 2 of 2 FirstFirst 12
Results 11 to 20 of 20

Thread: LAMP issue

  1. #11
    Join Date
    Sep 2006
    Beans
    7,337
    Distro
    Lubuntu Development Release

    php issue

    What was the exact error message?

    Edit: oops, too slow.

  2. #12
    Join Date
    Nov 2012
    Beans
    8

    Re: php issue

    Code:
    [Wed Nov 07 14:41:48 2012] [error] [client 127.0.0.1] PHP Warning:  include(): Failed opening '/include/bottom.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/index.php on line 134
    [Wed Nov 07 14:41:48 2012] [error] [client 127.0.0.1] File does not exist: /var/www/favicon.ico
    [Wed Nov 07 14:41:48 2012] [error] [client 127.0.0.1] PHP Warning:  include(/include/top.php): failed to open stream: No such file or directory in /var/www/index.php on line 7
    [Wed Nov 07 14:41:48 2012] [error] [client 127.0.0.1] PHP Warning:  include(): Failed opening '/include/top.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/index.php on line 7
    [Wed Nov 07 14:41:48 2012] [error] [client 127.0.0.1] PHP Warning:  include(/include/bottom.php): failed to open stream: No such file or directory in /var/www/index.php on line 134
    [Wed Nov 07 14:41:48 2012] [error] [client 127.0.0.1] PHP Warning:  include(): Failed opening '/include/bottom.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/index.php on line 134
    [Wed Nov 07 14:41:48 2012] [error] [client 127.0.0.1] File does not exist: /var/www/favicon.ico
    [Wed Nov 07 14:41:49 2012] [error] [client 127.0.0.1] PHP Warning:  include(/include/top.php): failed to open stream: No such file or directory in /var/www/index.php on line 7
    Last edited by CharlesA; November 7th, 2012 at 08:53 PM. Reason: code tags

  3. #13
    Join Date
    Nov 2012
    Beans
    8

    Re: php issue

    thank you charles for the edit

  4. #14
    Join Date
    Oct 2009
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: php issue

    Bah, I thought I hit submit, but I guess not.

    Anyway, are you using the full path to the php files, or the relative path?

    I checked one of my php files and I had this:

    Code:
    <?php
    # Enter relative path to site's root directory
    $rootpath='./';
    include_once ($rootpath."templates/header.php");
    include_once ($rootpath."templates/nav.php");
    ?>
    Come to #ubuntuforums! We have cookies! | Basic Ubuntu Security Guide

    Tomorrow's an illusion and yesterday's a dream, today is a solution...

  5. #15
    Join Date
    Nov 2012
    Beans
    8

    Re: php issue

    the php page bottom.php is like this in the index.php page

    include '/include/bottom.php';

    exactly like that so I'm not sure why it wont call it if its in the same directory (/var/www/include)

  6. #16
    Join Date
    Sep 2006
    Beans
    7,337
    Distro
    Lubuntu Development Release

    Re: php issue

    Quote Originally Posted by jeger003 View Post
    include '/include/bottom.php';
    PHP seems to want to have full UNIX paths, not anything with the web server. Two work-arounds exist.

    One is to give the full path.

    Code:
    include '/var/www/include/bottom.php';
    The other is to use a relative path.

    Code:
    include './include/bottom.php';
    I expect that there is a third way, the way that is actually correct, but these are the two obivous options.

  7. #17
    Join Date
    Sep 2006
    Beans
    7,337
    Distro
    Lubuntu Development Release

    php issue

    It might be due to an inconsistency or defect in PHP itself:
    http://php.net/manual/en/function.include.php#94392

    Here's yet another work-around:
    http://roshanbh.com.np/2008/01/absol...on-in-php.html

  8. #18
    Join Date
    Oct 2009
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: php issue

    Quote Originally Posted by Lars Noodén View Post
    It might be due to an inconsistency or defect in PHP itself:
    http://php.net/manual/en/function.include.php#94392

    Here's yet another work-around:
    http://roshanbh.com.np/2008/01/absol...on-in-php.html
    Thanks for the explanation. I have always used the relative path on my pages.
    Come to #ubuntuforums! We have cookies! | Basic Ubuntu Security Guide

    Tomorrow's an illusion and yesterday's a dream, today is a solution...

  9. #19
    Join Date
    Nov 2006
    Location
    Belgium
    Beans
    3,008
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: php issue

    Quote Originally Posted by Lars Noodén View Post
    I expect that there is a third way, the way that is actually correct, but these are the two obivous options.
    I suspect the way to go is set an include_path, pointing to one or more directories where you collect your includes (that then can be referenced by bare filename in your code). And use includes (with relative or absolute path) as fallback, for special cases.

    http://www.php.net/manual/en/ini.cor...i.include-path

  10. #20
    Join Date
    Nov 2012
    Beans
    8

    Re: php issue

    thank you guys!!! it works great!!!

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

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