Search code examples
phpinclude

php Include - file in a folder


I'm using php include in the index file to include banner (graphic on my page).

The files are in the folders:

C:\Users\name\IBM\rationalsdp\workspace\RemSysTempFls\ERIC\www\apachedft\htdocs\fender400\gk\index.php 

RemSysTempFls\ERIC\www\apachedft\htdocs\fender400\banner.php

I am unable to include banner.php with the following:

include ('/fender400/banner.php');

and get the errors (the page still runs):

Warning: main(/fender400/banner.php): failed to open stream: No such file or directory in /www/apachedft/htdocs/fender400/gk/index.php on line 16

Warning: main(): Failed opening '/fender400/banner.php' for inclusion (include_path='.:/QOpenSys/php//lib/php') in /www/apachedft/htdocs/fender400/gk/index.php on line 16


Solution

  • Are you sure that the addresses of each of those files are correct?

    Try it without the initial slash and see what it tells you

    include ('fender400/banner.php');
    

    or try:

    include ('../../fender400/banner.php');