SitePoint Sponsor

User Tag List

Results 1 to 14 of 14
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2011
    Posts
    78
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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:
    -3ghm
    -login
    index.php
    -core
    int.php

    So if I where to type it out in the browser it would look like the following:
    website.com/login/index.php
    And
    website.com/core/int.php

    The text inside of the index.php file:
    PHP Code:
    <?php 
    include './core/int.php'
    include 
    '../includes/overall/header.php'
    ?>
    <h1>Home</h1>
    <p>Just a template.</p>
    <?php include '../includes/overall/footer.php'?>
    The text inside the int.php file:
    PHP Code:
    <?php
    session_start
    ();
    error_reporting(0);

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

  2. #2
    SitePoint Enthusiast
    Join Date
    Jan 2011
    Posts
    78
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think I might have fixed the issue inside of the int.php file I needed another '.'

  3. #3
    SitePoint Enthusiast
    Join Date
    Jan 2011
    Posts
    78
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nope still getting the error

  4. #4
    SitePoint Enthusiast mildfoam's Avatar
    Join Date
    May 2010
    Location
    Australia.
    Posts
    56
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    i think you should remove the `.` in the

    PHP Code:
    include './core/int.php'
    so there will be like this one

    PHP Code:
    include 'core/int.php'
    but you must check directory and included file permission.
    Object Oriented Programming Fans Boy ?

  5. #5
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,297
    Mentioned
    460 Post(s)
    Tagged
    8 Thread(s)
    According to the file structure you've outlined, it should read:

    Code:
    <?php 
    include '../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:

    Code:
    <?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.

  6. #6
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,881
    Mentioned
    74 Post(s)
    Tagged
    6 Thread(s)
    Quote Originally Posted by erebus_83 View Post
    nope still getting the error
    Whenever I get a "file not found error" I use the results from getcwd() and then adjust the relative path of the missing file:
    PHP Code:

     
    echo getcwd();  die;
     include 
    './core/int.php'# adjust path in accordance with the above results. 
    Learn how to be ready for The New Move to Discourse

    How to make Make Money Now with a *NEW* look

    Be sure to congratulate Wolfshade on earning Member of the Month for August 2014

  7. #7
    SitePoint Evangelist pompopom's Avatar
    Join Date
    Feb 2004
    Location
    Huldenberg (Belgium)
    Posts
    426
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Start your script with the set_include_path() function => see php manual

    Saves you a lot of headaches...
    The Path of excess leeds to the tower of wisdom (W. Blake)

  8. #8
    SitePoint Enthusiast
    Join Date
    Jan 2011
    Posts
    78
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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?

  9. #9
    SitePoint Enthusiast
    Join Date
    Jan 2011
    Posts
    78
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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:
    PHP Code:
    <?php
    session_start
    ();
    error_reporting(0);

    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?

  10. #10
    SitePoint Enthusiast
    Join Date
    Jan 2011
    Posts
    78
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes it's fixed
    ralph.m - thanks for that code "<?php include $_SERVER["DOCUMENT_ROOT"] . "/core/int.php"; ?>" It helped!

  11. #11
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,297
    Mentioned
    460 Post(s)
    Tagged
    8 Thread(s)
    Glad you've sorted it.

    Quote Originally Posted by erebus_83 View Post
    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?
    Yes, links like that work no matter what page there are in, anywhere in the site, which makes them a lot easier to use.

  12. #12
    Non-Member
    Join Date
    Jun 2007
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $_SERVER["DOCUMENT_ROOT"] is very useful sometimes. I will write it in my notebook.

  13. #13
    SitePoint Enthusiast
    Join Date
    Jan 2011
    Posts
    78
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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 Code:
    <?php session_start();
    error_reporting(0);

    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();
    ?>

  14. #14
    SitePoint Enthusiast
    Join Date
    Jan 2011
    Posts
    78
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is it not storing the session?


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
  •