Ask a Question related to PHP Programming, Design and Development.

  1. #1

    Default PHP Includes

    Hello,

    I am installing coppermine photo gallery on my site. I think I am
    running into problems - I get the following error message after
    installation

    ---------
    Warning: main(include/config.inc.php): failed to open stream: No such
    file or directory in /home/science/www/gallery/include/init.inc.php on
    line 125

    Fatal error: main(): Failed opening required 'include/config.inc.php'
    (include_path='/home/science/inc:') in
    /home/science/www/gallery/include/init.inc.php on line 125
    ---------

    Now I think the problem is becuase in my .Htaccess file I specify that
    all includes live in /home/science/inc and the include files used by
    Coppermine do not live in that folder - they are in
    /home/science/www/gallery/include/. How can I continue to use my
    existing includes and get Coppermine configured correctly?

    And there is a good possibilty that I am completely wrong about the
    problem - but the file init.inc.php is in the correct folder and
    correctly CHMODed.

    Any help would be greatly appreciated

    Thanks,
    Tobias
    Tobias G Guest

  2. Similar Questions and Discussions

    1. cf includes
      Can someone please help me on this!? Contribute 3.11 claims to protect CF scripts and includes, but users can very easily select and delete the...
    2. includes
      when ever i use the insert include on a site page dreamweaver 8 display view goes funny and does not display the page correctly making it very...
    3. includes and ASP
      I am writing a mail order site using includes and nested includes for ASP code. I have no idea if this is rendered without error in all browsers....
    4. Includes Ugh...
      Because sometimes people want them to be relative to the calling page. That makes applications more portable to other servers / directory...
    5. XP includes ???????
      ah, ok, thanks
  3. #2

    Default PHP includes

    Is it necessary to have your file named *.php to use PHP code in it, such as
    for includes? Can't any extension be used?

    Thanks


    ConTactMe Guest

  4. #3

    Default Re: PHP includes

    ConTactMe wrote:
    > Is it necessary to have your file named *.php to use PHP code in it, such as
    > for includes? Can't any extension be used?
    >
    > Thanks
    >
    >
    Any extension can be used. I often use .inc myself.

    Joshua Ghiloni Guest

  5. #4

    Default Re: PHP includes

    On Sun, 14 Sep 2003 22:36:24 -0500, Joshua Ghiloni created an
    award-winning crop circle <bk3c48$fji$1@eeyore.INS.cwru.edu>, which, when
    translated into English, means this:
    > ConTactMe wrote:
    >> Is it necessary to have your file named *.php to use PHP code in it,
    >> such as for includes? Can't any extension be used?
    >>
    >> Thanks
    >>
    >>
    >>
    > Any extension can be used. I often use .inc myself.
    But it's safer to use .php because many web servers
    are configured not to process .inc files. If a browser
    requests the file, the server will send it in source
    code form.

    Gary Petersen Guest

  6. #5

    Default Re: PHP includes

    Gary Petersen wrote:
    > On Sun, 14 Sep 2003 22:36:24 -0500, Joshua Ghiloni created an
    > award-winning crop circle <bk3c48$fji$1@eeyore.INS.cwru.edu>, which, when
    > translated into English, means this:
    >
    >
    >>ConTactMe wrote:
    >>
    >>>Is it necessary to have your file named *.php to use PHP code in it,
    >>>such as for includes? Can't any extension be used?
    >>>
    >>>Thanks
    >>>
    >>>
    >>>
    >>
    >>Any extension can be used. I often use .inc myself.
    >
    >
    > But it's safer to use .php because many web servers
    > are configured not to process .inc files. If a browser
    > requests the file, the server will send it in source
    > code form.
    >
    .... Behaviour that you can prevent by using the server's authorization
    mechanism (ie : .htaccess for Apache).

    Using .php extensions prevents the server from displaying source code,
    but not from executing it, which may not be such a good idea.

    Bruno

    Bruno Desthuilliers Guest

  7. #6

    Default Re: PHP includes


    "Bruno Desthuilliers" <bdesth.nospam@removeme.free.fr> wrote in message
    news:3f65d459$0$20617$626a54ce@news.free.fr...
    > Gary Petersen wrote:
    > > On Sun, 14 Sep 2003 22:36:24 -0500, Joshua Ghiloni created an
    > > award-winning crop circle <bk3c48$fji$1@eeyore.INS.cwru.edu>, which,
    when
    > > translated into English, means this:
    > >
    > >
    > >>ConTactMe wrote:
    > >>
    > >>>Is it necessary to have your file named *.php to use PHP code in it,
    > >>>such as for includes? Can't any extension be used?
    > >>>
    > >>>Thanks
    > >>>
    > >>>
    > >>>
    > >>
    > >>Any extension can be used. I often use .inc myself.
    > >
    > >
    > > But it's safer to use .php because many web servers
    > > are configured not to process .inc files. If a browser
    > > requests the file, the server will send it in source
    > > code form.
    > >
    > ... Behaviour that you can prevent by using the server's authorization
    > mechanism (ie : .htaccess for Apache).
    >
    > Using .php extensions prevents the server from displaying source code,
    > but not from executing it, which may not be such a good idea.
    >
    > Bruno
    >
    I tend to use .inc files in cases where I control the httpd.conf file and
    can stop these files being displayed.

    In the case where you do not control the webserver, a method I have used is
    to call my files .ht_php_something

    the "dot" ht is generally not output via the webserver - ala .htaccess
    ..htpasswd

    Test it on the server you are using.

    The best method of course is to use whatever extension you like and not have
    the file in the web server path.

    Bob


    B\(\)_b Guest

  8. #7

    Default Re: PHP includes

    Thanks for all the great responses. I was more looking for the naming of the
    display file, such as "guestbook.php" vs. "guestbook.html", and was
    wondering if you can get the .html file to process PHP code as easily as the
    ..php file.


    "B()_b" <bREMOVEoMEb@norcom.net.au.remove.me> wrote in message
    news:1063708240.463309@challenger.norcom.net.au...
    >
    > "Bruno Desthuilliers" <bdesth.nospam@removeme.free.fr> wrote in message
    > news:3f65d459$0$20617$626a54ce@news.free.fr...
    > > Gary Petersen wrote:
    > > > On Sun, 14 Sep 2003 22:36:24 -0500, Joshua Ghiloni created an
    > > > award-winning crop circle <bk3c48$fji$1@eeyore.INS.cwru.edu>, which,
    > when
    > > > translated into English, means this:
    > > >
    > > >
    > > >>ConTactMe wrote:
    > > >>
    > > >>>Is it necessary to have your file named *.php to use PHP code in it,
    > > >>>such as for includes? Can't any extension be used?
    > > >>>
    > > >>>Thanks
    > > >>>
    > > >>>
    > > >>>
    > > >>
    > > >>Any extension can be used. I often use .inc myself.
    > > >
    > > >
    > > > But it's safer to use .php because many web servers
    > > > are configured not to process .inc files. If a browser
    > > > requests the file, the server will send it in source
    > > > code form.
    > > >
    > > ... Behaviour that you can prevent by using the server's authorization
    > > mechanism (ie : .htaccess for Apache).
    > >
    > > Using .php extensions prevents the server from displaying source code,
    > > but not from executing it, which may not be such a good idea.
    > >
    > > Bruno
    > >
    >
    > I tend to use .inc files in cases where I control the httpd.conf file and
    > can stop these files being displayed.
    >
    > In the case where you do not control the webserver, a method I have used
    is
    > to call my files .ht_php_something
    >
    > the "dot" ht is generally not output via the webserver - ala .htaccess
    > .htpasswd
    >
    > Test it on the server you are using.
    >
    > The best method of course is to use whatever extension you like and not
    have
    > the file in the web server path.
    >
    > Bob
    >
    >
    >

    ConTactMe Guest

  9. #8

    Default Re: php includes

    Moziah wrote:
    > Probably a simpe question with a simple answer. I have a page with a
    > menu and an include which contains the content of the page. Is it
    > possible to click a link on the menu and have the include bring up a
    > different file?
    You are cross-posting (sending the post seperately to multiple newsgroups).
    Don't do that. Replied in alt.comp.lang.php.


    JW



    Janwillem Borleffs Guest

  10. #9

    Default Re: php includes

    Janwillem Borleffs wrote:
    > Moziah wrote:
    >> Probably a simpe question with a simple answer. I have a page with a
    >> menu and an include which contains the content of the page. Is it
    >> possible to click a link on the menu and have the include bring up a
    >> different file?
    >
    > You are cross-posting (sending the post seperately to multiple
    > newsgroups). Don't do that. Replied in alt.comp.lang.php.
    >
    Sorry, wasn't meant for you. To answer your question, yes it's possible:

    When the menu contains a link like:

    main.php?main=navigation

    The code in main.php might look like this:

    <?

    $dir = "pages/";

    if (isset($_GET['main'])) {
    $filename = $dir.$_GET['main'].'php';
    if (file_exists($filename)) {
    include $filename;
    exit;
    }
    }

    include "{$dir}default.php";

    ?>


    HTH,
    JW



    Janwillem Borleffs Guest

  11. #10

    Default Re: php includes

    Janwillem Borleffs wrote:
    > Moziah wrote:
    >> Probably a simpe question with a simple answer. I have a page with a
    >> menu and an include which contains the content of the page. Is it
    >> possible to click a link on the menu and have the include bring up a
    >> different file?
    >
    > You are cross-posting (sending the post seperately to multiple
    > newsgroups). Don't do that. Replied in alt.comp.lang.php.
    Jan, you answered that to two separate posts. Actually, crossposting is OK;
    multiposting is not.

    Crossposting means that one message has two or more groups at the header,
    and it gets visible in both groups. Multiposting is posting separate
    messages, with same contents, on several groups.

    Berislav

    --
    If the Internet is a Marx Brothers movie, and Web, e-mail, and IRC are
    Groucho, Chico, and Harpo, then Usenet is Zeppo.


    Berislav Lopac Guest

  12. #11

    Default Re: php includes

    Berislav Lopac wrote:
    > Jan, you answered that to two separate posts. Actually, crossposting
    > is OK; multiposting is not.
    >
    I realized that as soon as I pressed the send button. Therefore, I
    appologized to the OP of this thread.


    JW



    Janwillem Borleffs Guest

  13. #12

    Default Re: php includes

    Moziah wrote:
    > Would I be right in saying that I would have to write that whoe batch
    > of code for every link in the menu?
    No, you only have to change the structure. You will need only 1 main.php,
    which can be used to include all existing files.

    And, of course, you will have to set up the navigation links.

    Security wise, it's recommended to validate each include file to see if it
    resides in a specific directory. Otherwise, people would be able to see
    files which they shouldn't.


    JW



    Janwillem Borleffs Guest

  14. #13

    Default Re: php includes

    > Moziah wrote:
    >> Would I be right in saying that I would have to write that whoe batch
    >> of code for every link in the menu?
    >
    > No, you only have to change the structure. You will need only 1
    > main.php, which can be used to include all existing files.
    >
    > And, of course, you will have to set up the navigation links.
    >
    > Security wise, it's recommended to validate each include file to see
    > if it resides in a specific directory. Otherwise, people would be able
    > to see files which they shouldn't.
    Here is the code for my page...

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

    <head>
    <title>Softek Designs - Helping your company reach the web</title>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <link href="base.css" rel="stylesheet" type="text/css">
    </head>

    <body>

    <div class="sectiont">
    <?php include ('content/misc/title.html'); ?>
    </div>

    <div class="content">
    <?php include ('content/central.html'); ?>
    </div>

    <div class="sectionl">
    <a href="index.php">Central</a>
    <a href="about.php">About</a>
    </div>

    </body>

    </html>

    What do I need to do to get the about section, stored in
    content/about.html, to be showed when the about link is clicked on?
    Moziah Guest

  15. #14

    Default Re: php includes

    Moziah wrote:
    > What do I need to do to get the about section, stored in
    > content/about.html, to be showed when the about link is clicked on?
    <div class="content">
    <?
    if (isset($_GET['page']) &&
    file_exists("content/{$_GET['page']}.html")) {
    include "content/{$_GET['page']}.html";
    } else {
    include 'content/central.html';
    }
    ?>
    </div>

    <div class="sectionl">
    <a href="index.php">Central</a>
    <a href="index.php?page=about">About</a>
    </div>


    JW



    Janwillem Borleffs Guest

  16. #15

    Default Re: php includes

    > Moziah wrote:
    >> What do I need to do to get the about section, stored in
    >> content/about.html, to be showed when the about link is clicked on?
    >
    > <div class="content">
    > <?
    > if (isset($_GET['page']) &&
    > file_exists("content/{$_GET['page']}.html")) {
    > include "content/{$_GET['page']}.html";
    > } else {
    > include 'content/central.html';
    > }
    > ?>
    > </div>
    >
    > <div class="sectionl">
    > <a href="index.php">Central</a>
    > <a href="index.php?page=about">About</a>
    > </div>
    >
    >
    > JW
    >
    >
    >
    >
    That's works great, much appreciated. Thank you!
    Moziah Guest

  17. #16

    Default PHP includes

    When I try and edit a page in contribute3 the PHP includes don?t show, they are fine via the browser view. Any ideas anyone please?
    Wicked43 Guest

  18. #17

    Default Re: PHP includes

    I feel your pain. I have yet to find a thread that ANSWERS this issue. I
    really wish someone form Adobe would address this question...

    Why doesn't Contribute display the content of the PHP includes in Edit mode?
    Especially when the includes contains the CSS link for the page your editing.
    It would be nice to see how the text you edit actually looks. If is isn't
    possible, at least just say so. I have yet to see any docs/threads that say it
    will work one way or the other. I guess if it doesn't work, i'll just have to
    find a different solution that using Contribute.

    Thanks for the rant...

    -Michael

    mjp420 Guest

  19. #18

    Default Re: PHP includes

    I just posted an answer to this same topic here

    [url]http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=55&catid=30[/url]
    3&threadid=1177131&enterthread=y

    We have a solution which may or may not be suitable for every user. Propbably
    why Adobe has not used it

    Feel free to contact me [email]gilberts@wou.edu[/email]

    woudesigner Guest

  20. #19

    Default Re: PHP includes

    I am in a similar position. I built the site using PHP to include the head
    (with the <html> tag, the <head> tag and its contents, and the opening <body>
    tag and the site wide banner), the top nav, and the footer. Very aggravating
    that Contribute doesn't render the page when editing the text, nor grab the css
    styles.

    willLanni Guest

  21. #20

    Default Re: PHP includes

    it's so nice information according to me every one should read it.
    anshika012 is offline Banned
    Join Date
    Nov 2010
    Location
    new delhi
    Posts
    4

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139