#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    22
    Rep Power
    0
    Firstly, I won't profess to know all that much about how computers really work, and to know all the technical words about what things are...here in England, IT isn't taught all that well, and I've just had to teach myself instead (I'm 18).
    OK. I'm trying to find out how PHP works so that I can try and make some dynamic pages, with more flexibility than using simple SSI tags.

    I design all my sites on my Win '98 machine, and have for about half a year been using Apache on it so that I can see how the pages look, and test server-side scripts such as PHP before uploading to the web server.

    I've downloaded the main PHP working scripts from DevShed (global.php3 etc) to see if I can get them to work, and see what everything does in them so that I can understand what's going on, and how I can use such code for my own sites.

    However...I think there must be some problem with my Apache or Win '98 configuration somewhere. In trying to run an index.php3 file with the following code:

    <?require( '/data/php/templates/devshed/category.php3');
    $categoryID=8;
    getCategory();
    ?>

    I get a message saying:

    Fatal error: Failed opening required '/data/php/templates/devshed/category.php3' in C:usretchtdocsdevshedindex.php3 on line 1

    In other words, it seems as though instead of trying to find the category.php3 file inside http://devshed/data/php/templates/de...category.php3, it's looking in C:usretchtdocsdevshedcategory.php3 - outside of the server files.

    Without knowing all the technical wordings to use hear, I hope you've understood what I'm trying to get at. If not, I'll try and explain it further.

    If you can help me here that really would be great. Also, if you can recommend a good book so that I can learn a little more about what I'm talking about, then that would be even better!

    Jake
    jakeg@lineone.net
  2. #2
  3. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    No, that's not what it means. The

    in C:usretchtdocsdevshedindex.php3 on line 1

    simply means that that is the file it was interpreting when the error occured.

    The key is in the first part of the error:

    Failed opening required '/data/php/templates/devshed/category.php3'

    You see, the require statement is a relative path, meaning that it is looking at the path relative to the directory of the script that is being interpretted. That directory, as mentioned above, is

    c:usretchtdocsdevshed

    so by saying require('/data/php/templates/devshed/category.php3'); you are telling php that the category.php3 file resides in c:usretchtdocsdevsheddataphptemplatesdevshed which probably isn't correct. I imagine that that path is based on an include path defined in php.ini. Basically what I'd do is find where category resides and change the path in the require statement accordingly.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    22
    Rep Power
    0
    Thanks. I just wanted a clarification on that really - and I've figured out why it's not working now: it's because I'm using forward slashes rather than backslashes on my Win machine. By changing the slashes I got the required file to be found. Is there anyway to remedy this, i.e. get it to recognise the forward slash, as it does with other programs such as Perl or pretty much anything else?

    Jake
  6. #4
  7. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    I believe there is a control in php.ini. Don't recall what it is at the moment.

Similar Threads

  1. set up mail server in win xp
    By SystemOfADown in forum Mail Server Help
    Replies: 2
    Last Post: May 6th, 2004, 10:28 AM
  2. Getting Apache + DNS working
    By osensei in forum Apache Development
    Replies: 1
    Last Post: February 4th, 2004, 04:56 PM
  3. PHP & Windows 2003
    By jonnymccullagh in forum PHP Development
    Replies: 2
    Last Post: January 20th, 2004, 11:23 AM

IMN logo majestic logo threadwatch logo seochat tools logo