Jump to content

Pathway Issues AGAIN


OAFC_Rob

Recommended Posts

Okay I posted the other day got some answers, but still have pathway issues.

 

I am getting the following error:

 

Warning: require_once(/innovationation1/commonResources/includes/headerArea.php) [function.require-once]: failed to open stream: No such file or directory in C:\xampp\htdocs\innovationation1\newsPages\newsArticles.php on line 2

 

Fatal error: require_once() [function.require]: Failed opening required '/innovationation1/commonResources/includes/headerArea.php' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\innovationation1\newsPages\newsArticles.php on line 2

 

It is basically not finding the correct pathway, when I go into a sub-directory with a URL like this;

 

http://localhost/innovationation1/newsPages/newsArticles.php

 

This is my current require_once statement that is load the dbConnection class. I have tried removing the first bit "/innovationation1", as well as a number of other things are suggestions how to fix this?

 

<?php require_once '/innovationation1/commonResources/dbConnection/dbConnection.php'; ?>

Link to comment
https://forums.phpfreaks.com/topic/239542-pathway-issues-again/
Share on other sites

A leading / on a file system path refers to the root of the current hard disk.

 

You can use $_SERVER['DOCUMENT_ROOT'] to get the file system path to your document root folder, then concatenate the rest of the path to your file to that value to arrive at an absolute file system path.

The pathway in the terms of when it's stored on my computer is: C:xampp/htdocs/innovationation1/commonResources/dbConnection/dbConnection.php

 

I was using $_SERVER["DCOUMENT_ROOT"], but this was presenting issues with <a href=""> </a> links and someone advised me not to use them for normal links so I took them out of the site completely. So was that correct? Or does is it different in the terms of require_once?

 

The dbConnection.php require_once is used within headerArea.php which should be the same pathway location thorughout the site, and it works fine on a the top level ie no sub folders, but once we get into them the issues start happening.

The pathway in the terms of when it's stored on my computer is: C:xampp/htdocs/innovationation1/commonResources/dbConnection/dbConnection.php

 

I was using $_SERVER["DCOUMENT_ROOT"], but this was presenting issues with <a href=""> </a> links and someone advised me not to use them for normal links so I took them out of the site completely. So was that correct? Or does is it different in the terms of require_once?

 

The dbConnection.php require_once is used within headerArea.php which should be the same pathway location thorughout the site, and it works fine on a the top level ie no sub folders, but once we get into them the issues start happening.

links have absolutely nothing to do with file system paths, using $_SERVER['DOCUMENT_ROOT'] as PFM said should be sufficient

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.