SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Evangelist
    Join Date
    May 2007
    Location
    Kent in Uk
    Posts
    538
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    why is my page just showing blank?

    Hi
    I created a script so that when the visitor clicked the link on the index page the info would be downloaded from the mysql database aand placing itself in the page structure.

    When I click the link I get a blank page. It can be seen here and you need to click on "Meet the British shorthair"

    I think I may have the route to the connection page wrong

    my directory looks like the following: (the index page is in the httpdoc folder; the connect folder where the connection info is is above the httpdoc folder and the page where the link is going to is in a folder called articles in the httpdoc folder)

    /
    connect folder
    connection.php
    httpdoc folder
    articles
    bs.php
    includes
    functions.php


    index

    My code to connect to the relevant pages is as follows:

    PHP Code:
    <?php require_once($_SERVER['DOCUMENT_ROOT'] . '/../connect/connection.php'); 
    include(
    "../includes/functions.php");
    ?>
    Could I have got the route wrong here or is it likely to be something else?

    thanks for your time

  2. #2
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Place the following two lines at top of the script that includes the other scripts, it should point you in the right direction.

    PHP Code:
    <?php
    error_reporting
    (-1);
    ini_set('display_errors'true);
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  3. #3
    SitePoint Evangelist
    Join Date
    May 2007
    Location
    Kent in Uk
    Posts
    538
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AnthonySterling View Post
    Place the following two lines at top of the script that includes the other scripts, it should point you in the right direction.

    PHP Code:
    <?php
    error_reporting
    (-1);
    ini_set('display_errors'true);
    I like that! Im going to put that at the top of all my php scripts ...due to the amount of errors im making

    Thing is I dont understand what its trying to tell me:

    Warning: require_once(D:\inetpub\vhosts\louandelcats.co.uk\httpdocs/../connect/connection.php) [function.require-once]: failed to open stream: Permission denied in D:\inetpub\vhosts\louandelcats.co.uk\httpdocs\articles\bs.php on line 4

    Fatal error: require_once() [function.require]: Failed opening required 'D:\inetpub\vhosts\louandelcats.co.uk\httpdocs/../connect/connection.php' (include_path='.;./includes;./pear') in D:\inetpub\vhosts\louandelcats.co.uk\httpdocs\articles\bs.php on line 4

    thanks

  4. #4
    SitePoint Guru
    Join Date
    Aug 2009
    Posts
    669
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cass27 View Post
    I like that! Im going to put that at the top of all my php scripts ...due to the amount of errors im making
    IMO error reporting should always be active in all php scripts (unless they're includes in other scripts). Any site that relies on error messages being turned off to hide problems are IMO storing trouble for themselves.
    I'll do anything to avoid working on my own code

    Are you using: if (isset($_POST['submit'])) ?
    IE has a bug and does not always send the value.

  5. #5
    SitePoint Evangelist
    Join Date
    May 2007
    Location
    Kent in Uk
    Posts
    538
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by tangoforce View Post
    IMO error reporting should always be active in all php scripts (unless they're includes in other scripts). Any site that relies on error messages being turned off to hide problems are IMO storing trouble for themselves.
    Well, I'm certainly going to put it on mine from now on.

    but can anyone help me understnadin g the error message I am recieving?

    Warning: require_once(D:\inetpub\vhosts\louandelcats.co.uk\httpdocs/../connect/connection.php) [function.require-once]: failed to open stream: Permission denied in D:\inetpub\vhosts\louandelcats.co.uk\httpdocs\articles\bs.php on line 4

    Fatal error: require_once() [function.require]: Failed opening required 'D:\inetpub\vhosts\louandelcats.co.uk\httpdocs/../connect/connection.php' (include_path='.;./includes;./pear') in D:\inetpub\vhosts\louandelcats.co.uk\httpdocs\articles\bs.php on line 4

    Thanks for your time,

    Nick

  6. #6
    SitePoint Guru
    Join Date
    Aug 2009
    Posts
    669
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The first one says permission denied. Assuming this is windows it sounds like some other process has the file open and locked (sounds like an editor?). Either that or the file permission for the file is wrong and you need to right click and go into properties.

    The second one suggests it simply can't find the file. I know that sounds hard to believe when you know you've got the right path but its nearly always something stupidly trivial which you keep missing because of one letter being different or something similar.
    I'll do anything to avoid working on my own code

    Are you using: if (isset($_POST['submit'])) ?
    IE has a bug and does not always send the value.

  7. #7
    SitePoint Evangelist
    Join Date
    May 2007
    Location
    Kent in Uk
    Posts
    538
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi

    I am quite a novice at php. Can you clarify what you mean here?



    Quote Originally Posted by tangoforce View Post
    The first one says permission denied. Assuming this is windows it sounds like some other process has the file open and locked (sounds like an editor?). Either that or the file permission for the file is wrong and you need to right click and go into properties.
    I use dreamweaver to upload files. when I right click on it there is no properties but there is a facility that says set permissions. All of the boxes are empty. Three for read, three for write and three for execute. Which ones should I highlight. Problem is anyway when I do try and click all of them it wont let me set the permissions anyway.

    Quote Originally Posted by tangoforce View Post
    The second one suggests it simply can't find the file. I know that sounds hard to believe when you know you've got the right path but its nearly always something stupidly trivial which you keep missing because of one letter being different or something similar.
    Well. This brings me back to the question of the original thread. I am not sure if my routing is right. I struggle with this area. how the folders are in my directory:

    my directory looks like the following:

    /
    connect folder
    connection.php
    httpdoc folder
    articles
    bs.php
    includes
    functions.php
    index

    My code to connect to the relevant pages is as follows:

    PHP Code:
     <?php require_once($_SERVER['DOCUMENT_ROOT'] . '/../connect/connection.php');  
    include(
    "../includes/functions.php"); ?>
    Does this root look right?

    thanks for your help

  8. #8
    SitePoint Guru
    Join Date
    Aug 2009
    Posts
    669
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I need to clarify something. From those error messages you're on a windows server right?

    Trying to CHMOD permissions on a windows system will not work as Windows and linux have different permissions systems.

    One thing i noticed is that one of your file paths is starting /../ while the other is just ../ - like i said small little silly things. You shouldn't need the first / before the dots as it makes no sense to any file system so that would explain the permission denied issue.

    Also, in the first one with the /../ do not include the $_SERVER['DOCUMENT_ROOT']. This is because having a ../ in the filepath will also not make sense unless its at the start. Just use ../ at the beginning instead.
    I'll do anything to avoid working on my own code

    Are you using: if (isset($_POST['submit'])) ?
    IE has a bug and does not always send the value.

  9. #9
    SitePoint Evangelist
    Join Date
    May 2007
    Location
    Kent in Uk
    Posts
    538
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Perfect. It got rid of the problem for the other issue as well!

    Thank you for your time with this.


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
  •