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 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

Place the following two lines at top of the script that includes the other scripts, it should point you in the right direction. :slight_smile:


<?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 :nono:

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:shifty:

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

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.

Hi

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

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.

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 require_once($_SERVER['DOCUMENT_ROOT'] . '/../connect/connection.php');  
include("../includes/functions.php"); ?>  

Does this root look right?

thanks for your help

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.

Perfect. It got rid of the problem for the other issue as well!

Thank you for your time with this. :slight_smile: