I'm getting the current php error can't find file

I’m getting the current error and I’m not sure how to get to the file.

20121107T194028: www.3geehousemedia.com/login/index.php
PHP Warning: include(./core/int.php): failed to open stream: No such file or directory in /hermes/bosweb/web078/b784/dom.3geehousemediacom/public_html/3GHM/login/index.php on line 2
PHP Warning: include(): Failed opening ‘./core/int.php’ for inclusion (include_path=‘.:/usr/local/lib/php-5.3.13/lib/php’) in /hermes/bosweb/web078/b784/dom.3geehousemediacom/public_html/3GHM/login/index.php on line 2

Here is the file structure:

So if I where to type it out in the browser it would look like the following:

The text inside of the index.php file:

include './core/int.php'; 
include '../includes/overall/header.php'; 
<p>Just a template.</p>
<?php include '../includes/overall/footer.php'; ?>

The text inside the int.php file:


require '../database/connect.php';

I think I might have fixed the issue inside of the int.php file I needed another ‘.’

nope still getting the error

i think you should remove the . in the

include './core/int.php';

so there will be like this one

include 'core/int.php';

but you must check directory and included file permission.

According to the file structure you’ve outlined, it should read:

include '[COLOR="#FF0000"]..[/COLOR]/core/int.php';

with two dots. But a more reliable way to link to an include—which doesn’t depend on where the files are in relation to each other—is this:

<?php include $_SERVER["DOCUMENT_ROOT"] . "/core/int.php"; ?>

… assuming that the /core/ folder is inside your root folder. If not, the path needs to be modified.

Whenever I get a “file not found error” I use the results from getcwd() and then adjust the relative path of the missing file:

 echo getcwd();  die;
 include './core/int.php'; # adjust path in accordance with the above results.

Start your script with the set_include_path() function => see php manual

Saves you a lot of headaches…

Thanks all
ralph.m - you were right I added the extra dot a I think that got it going. I’m no longer getting that error.
I tried the second option and was still stuck. I would have to start it from the sites root folder correct? Will it work even if the file calling for it is not in the root folder it’s self?

After making the changes I’m now getting this:

20121109T102317: 3geehousemedia.com/login/index.php
PHP Warning: session_start(): open(/var/php_sessions/sess_7c16b0ff14a4b451578b52ed5220ffc9, O_RDWR) failed: No such file or directory (2) in /hermes/bosweb/web078/b784/dom.3geehousemediacom/public_html/3GHM/core/int.php on line 2

This is the code:


require '../../../database/connect.php';
require '../../../function/users.php';

Not sure why that is an error is am I missing so information for the session to start?

Yes it’s fixed
ralph.m - thanks for that code “<?php include $_SERVER[“DOCUMENT_ROOT”] . “/core/int.php”; ?>” It helped!

Glad you’ve sorted it.

Yes, links like that work no matter what page there are in, anywhere in the site, which makes them a lot easier to use. :slight_smile:

$_SERVER[“DOCUMENT_ROOT”] is very useful sometimes. I will write it in my notebook.

20121120T183502: media.com/login/login.php
PHP Warning: session_start(): open(/var/php_sessions/sess_9060220c72b6226265ccfd207f2f42a4, O_RDWR) failed: No such file or directory (2) in /hermes/bosweb/web078/b784/dom.mediacom/public_html/3GHM/core/init.php on line 1

<?php session_start();

require $_SERVER["DOCUMENT_ROOT"] . "/core/database/connect.php";
require $_SERVER["DOCUMENT_ROOT"] . "/core/function/general.php";
require $_SERVER["DOCUMENT_ROOT"] . "/core/function/users.php";

$errors = array();

Is it not storing the session?