1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

PHP error - include_path='.;C:\php5\pear'

Discussion in 'PHP' started by webbusiness23, Oct 5, 2009.

  1. #1
    I'm working on a login script and i get these two errors after i try to insert the username / password in their appropriate fields:

    Warning: require_once(includes/config.inc.php) [function.require-once]: failed to open stream: No such file or directory in C:\wamp\www\link_manager\includes\login.inc.php on line 2
    
    Fatal error: require_once() [function.require]: Failed opening required 'includes/config.inc.php' (include_path='.;C:\php5\pear') in C:\wamp\www\link_manager\includes\login.inc.php on line 2
    PHP:

    On my includes\login.inc.php on line 2 i have this code:

    require_once("includes/config.inc.php");	//the configuration file
    PHP:

    Could you tell what is the problem with my code?
    Thanks!
     
    webbusiness23, Oct 5, 2009 IP
  2. AsHinE

    AsHinE Well-Known Member

    Messages:
    240
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    138
    #2
    1 possible solution:
    make your include path look like:
    
    include_path='.;C:\php5\pear;C:\wamp\www\link_manager'
    
    Code (markup):
    it is in php.ini

    2 possible solution:
    
    require_once("./config.inc.php");   
    
    PHP:
    as I can see your login.inc.php is in the same directory as config.inc.php.
     
    AsHinE, Oct 5, 2009 IP
  3. webbusiness23

    webbusiness23 Member

    Messages:
    153
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    26
    #3
    None of these solutions worked. Does anyone have any other suggestions?
     
    webbusiness23, Oct 5, 2009 IP
  4. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Are you sure you have correctly set your include path? You can also do this in code:

    
    $path = '/where/are/the/files/';
    set_include_path(get_include_path() . PATH_SEPARATOR . $path);
    
    PHP:
    If that doesn't work, just try an absolute include path instead of a relative include path in your require statements.

    Probably if you're loading the config from the includes/login.php you don't need to do require 'includes/login.php' but just require 'login.php'
     
    premiumscripts, Oct 5, 2009 IP
  5. webbusiness23

    webbusiness23 Member

    Messages:
    153
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    26
    #5
    I tried using the absolute path, and it didn't work.

    I also tried using your suggestion, but it also didn't work.

    Any other suggestions please?

     
    webbusiness23, Oct 5, 2009 IP
  6. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #6
    The absolute path should always work. Seems to me like you are not supplying the correct path.
     
    premiumscripts, Oct 5, 2009 IP
  7. webbusiness23

    webbusiness23 Member

    Messages:
    153
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    26
    #7
    I finally got it working with the help of AsHinE. (Thanks AsHine!).

    It was an issue generated by the path, as you said.
    The solution was:

    I added these lines of code in my config.inc.php file:

    define ("SITE_URL", "/link_manager/");		
    	define("SITE_PATH","C:\wamp\www\link_manager");
    	ini_set("include_path",SITE_PATH);
    PHP:

    Thank you for your help!
     
    webbusiness23, Oct 5, 2009 IP