Newbie: Trouble w/ O'Reilly example

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

  1. #1

    Default Newbie: Trouble w/ O'Reilly example

    I am trying to work with example code from "Programming PHP" chapter
    8. The example is the "Business Listing" application. All the files
    are in the same directory. When I open "admin.php" in my browser from
    [url]http://127.0.0.1/~myusername/admin.php[/url], I get the following message:

    Fatal error: Failed opening required 'db_login.php'
    (include_path='.:/usr/lib/php') in /Users/brianl/Sites/admin.php on
    line 4

    I even tried putting the db_login.php in /usr/lib/php, but no luck. I
    thought that PHP started looking for included files in the current
    directory, anyway.

    Here's the beginning of "admin.php" :

    <html>
    <head>
    <?php
    require_once('db_login.inc');

    ?>

    It seems pretty straightforward...I don't get it.

    Can anyone help?
    Thanks,
    Brian
    Brian Lovely Guest

  2. Similar Questions and Discussions

    1. actionscript newbie trouble
      hi there, i'm trying to trigger a colour change in an movie clip as i drag it over another on, sounds simple but its driving me mad, any help would...
    2. Newbie Trouble with Settings
      I recently upgraded to Flash MX and am having trouble setting it so that when you are drawing a rectangle or oval or anything actually you can see...
    3. Newbie Having Trouble with Tutorial Book
      I found a new book for starting out to learn PHP/MySQL Web App programming. I've begun exercises toward that end. So far I've opened MySQL--I'm...
    4. Newbie having trouble with SpecTcl, TkListbox and TkScrollbar
      I'm trying to learn Tk and SpecTcl. I created this layout with the SpecTcl tool and then hand modified the commands in it. Everything works...
    5. Newbie: Having trouble compiling Apache 2.0.46 on Solaris 8
      I am sure that I don't have my environment setup properly so your help is greatly appreciated. How should I configure my environment? What...
  3. #2

    Default Re: Newbie: Trouble w/ O'Reilly example

    "Brian Lovely" a écrit le 20/11/2003 :
    > Fatal error: Failed opening required 'db_login.php'
    > (include_path='.:/usr/lib/php') in /Users/brianl/Sites/admin.php on
    > line 4
    [..]
    >
    > <html>
    > <head>
    > <?php
    > require_once('db_login.inc');
    >
    > ?>
    >
    > It seems pretty straightforward...I don't get it.
    Choose between db_login.inc or db_login.php...


    Jedi121 Guest

  4. #3

    Default Re: Newbie: Trouble w/ O'Reilly example

    Brian Lovely wrote:
    > I am trying to work with example code from "Programming PHP" chapter
    > 8. The example is the "Business Listing" application. All the files
    > are in the same directory. When I open "admin.php" in my browser from
    > [url]http://127.0.0.1/~myusername/admin.php[/url], I get the following message:
    >
    > Fatal error: Failed opening required 'db_login.php'
    > (include_path='.:/usr/lib/php') in /Users/brianl/Sites/admin.php on
    > line 4
    >
    > I even tried putting the db_login.php in /usr/lib/php, but no luck. I
    > thought that PHP started looking for included files in the current
    > directory, anyway.
    >
    > Here's the beginning of "admin.php" :
    >
    > <html>
    > <head>
    > <?php
    > require_once('db_login.inc');
    >
    > ?>
    >
    > It seems pretty straightforward...I don't get it.
    >
    > Can anyone help?
    > Thanks,
    > Brian
    Hey,
    For it to be parsed as PHP it needs to have that PHP extension. Try naming
    it "db_login.inc.php". Also, sticking it in /usr/lib/php won't do anything
    from what I can tell. Stick it in the same directory as "admin.php" (which
    should be under your webroot somewhere or in user public_html) If you move
    it anywhere separate from "admin.php", you would want a folder somewhere
    called "includes" and all your .inc.php files in there.


    -Eric Kincl
    Eric Kincl Guest

  5. #4

    Default Re: Newbie: Trouble w/ O'Reilly example

    Jedi121 wrote:
    > "Brian Lovely" a écrit le 20/11/2003 :
    >> Fatal error: Failed opening required 'db_login.php'
    >> (include_path='.:/usr/lib/php') in /Users/brianl/Sites/admin.php on
    >> line 4
    > [..]
    >>
    >> <html>
    >> <head>
    >> <?php
    >> require_once('db_login.inc');
    >>
    >> ?>
    >>
    >> It seems pretty straightforward...I don't get it.
    >
    > Choose between db_login.inc or db_login.php...
    Listen to him, ignore what I just said... I didn't pay close attention.
    (Does PHP parse .inc files?!?)


    -Eric Kincl
    Eric Kincl Guest

  6. #5

    Default Re: Newbie: Trouble w/ O'Reilly example

    "Eric Kincl" a écrit le 20/11/2003 :
    > Hey,
    > For it to be parsed as PHP it needs to have that PHP extension. Try naming
    > it "db_login.inc.php".
    Wrong! Not necessary in an include statement.


    Jedi121 Guest

  7. #6

    Default Re: Newbie: Trouble w/ O'Reilly example

    Jedi121 wrote:
    > "Eric Kincl" a écrit le 20/11/2003 :
    >> Hey,
    >> For it to be parsed as PHP it needs to have that PHP extension. Try
    >> naming it "db_login.inc.php".
    >
    > Wrong! Not necessary in an include statement.
    Thanks for correcting me... I never knew that before. I thought I had tried
    it without the .php extension and it not working... apparently I didn't.
    Now I don't have to stick the stupid .php there! Thanks!


    -Eric Kincl
    Eric Kincl Guest

  8. #7

    Default Re: Newbie: Trouble w/ O'Reilly example

    > > Choose between db_login.inc or db_login.php...
    >
    > Listen to him, ignore what I just said... I didn't pay close attention.
    > (Does PHP parse .inc files?!?)
    >
    >
    > -Eric Kincl
    ***SORRY***
    The .inc suffix is the result of my trying different things to make
    this work. Initially, it was all .php While cutting and pasting to
    create my original post I was not careful enough and got bits of two
    different versions.

    To reiterate, the require_once() argument was db_login.php, and the
    file I was moving around in order to get it recognized was indeed
    db_login.php

    I apologize for the confusion.
    This is driving me nuts, BTW, I don't understand why PHP doesn't just
    find the darn file.
    --Brian
    Brian Lovely Guest

Posting Permissions

  • You may not post new threads
  • You may 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