How to fix "ailed to open stream: No such file or directory" error?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • udaras
    New Member
    • Jan 2011
    • 2

    #1

    How to fix "ailed to open stream: No such file or directory" error?

    hi all,
    i'm doing a project using php & now i'm stuck with an error which is difficult to resolve by myself.

    i have a file named "welcome.ph p" inside a folder called "PROJECT" in "C:\AppServ\WWW \"
    & inside that "PROJECT", i'm having a sub-folder called "rpts", which contains some php files using for reports. (i used "PHP Report Maker 4" software to create those reports)

    problem is;
    when i click on the button "view reports" in the "welcome.ph p" page (main page); i want to display the "index.php" file which is inside the "rpts" folder.

    i used the following code; but it's giving errors

    Code:
    if(isset($_POST['btnrpt']))
    	{
    	include('..\rpts\index.php');
    	}
    [errors]:
    Warning: include(..\rpts \index.php) [function.includ e]: failed to open stream: No such file or directory in C:\AppServ\www\ PROJECT\welcome .php on line 51

    Warning: include() [function.includ e]: Failed opening '..\rpts\index. php' for inclusion (include_path=' .;C:\php5\pear' ) in C:\AppServ\www\ PROJECT\welcome .php on line 51


    if anyone can find the error; pls help me

    thnx in advance
    Last edited by Stewart Ross; Jan 30 '11, 08:56 AM. Reason: Retitled from 'Pls help on my php project'
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    Well, if your directory structure is like this C:\AppServ\WWW\ PROJECT\rpts, and your welcome.php is in the PROJECT directory, you can access index.php in rpts like so:
    Code:
    include 'rpts/index.php';
    In your code, you use ../ in your relative path, which says 'go to the directory above the current directory, and look for the rpts folder there.'

    Comment

    • udaras
      New Member
      • Jan 2011
      • 2

      #3
      thank u for ur reply
      i hv edited my coing as u given
      Code:
      include 'rpts/index.php';
      but now it says

      The webpage cannot be found
      HTTP 404
      Most likely causes:
      •There might be a typing error in the address.
      •If you clicked on a link, it may be out of date.

      What you can try:
      Retype the address.

      Go back to the previous page.

      Go to and look for the information you want.

      More information


      Do u hv any idea regarding the PHP REPORT MAKER 4 software? i'm not sure whether i'm trying to access the correct file to view reports (index.php)

      pls help me to rectify that matter

      thanks

      Comment

      Working...