Wednesday, March 23, 2011

Troubleshooting PHP Login connection

I have encountered a problem that I have not come accross yet when setting up a log in page using php.

The page has a error message that relates to line 1 ( require_once('../Connections/Login.php)

that states

[function.require-once]: failed to open stream: No such file or directory Fatal Error: require_once() [function.require]: failed opening required ... (include_path='.:/usr/share/pear-php5')

I know it is probably really simple and stupid, but I'm really struggling to self-troubleshoot and would really value some help please?

Thank you

From stackoverflow
  • Where is your "Connections/Login.php" relative to the currrent php file.

    php will look for the file relative to the current file, or, in one of the directories specified in the "include_path" php.ini setting.

  • The error just means php can't find the Login.php file. Assuming the page you are calling is index.php you should have a director structure like

    -Dir1 
    |-index.php
    -Connections 
    |-Login.php
    
  • Thank you for your help.

    This is where I have been so confused. I also thought the same, that it just couldn't find the file; however the structure is just as you have said:

    htdocs/comparison.php (the log in page) htdocs/Connections/connComparisonLogin.php

    Sorry this is going to confuse you, I simplified the actual script in my original question, here is the actual error message:

    Warning: require_once(../Connections/connComparisonLogin.php) [function.require-once]: failed to open stream: No such file or directory in /home/fhlinux135/s/suzukigenuine.com/user/htdocs/comparison.php on line 1

    Fatal error: require_once() [function.require]: Failed opening required '../Connections/connComparisonLogin.php' (include_path='.:/usr/share/pear-php5') in /home/fhlinux135/s/suzukigenuine.com/user/htdocs/comparison.php on line 1

    Have I done it all wrong?

    Thank you

    Crescent Fresh : Remove "../" from your require() line.
  • I think your require statement should be:

    require_once 'Connections/connComparisonLogin.php';
    
  • Why are you going up a directory in your require statement? Remove the "../" from the beginning of your require_once path.

  • Thank you everyone

0 comments:

Post a Comment