How to get a PHP file to be included across files in different directories?

Posted By: dotCOMreport Q and A

Comments 1 Comments | Views 61 views


Currently I have created some php based webpages and uploaded them to my web hosting server.It has a PHP 5.1.6
installed.With this I am able to include files only that are in the same directory(they work well using require() fn).If not an error message displaying some “no such file” in directory appears in the page.I would like to use them to be included in different direcetories.What should I do?


Posted In » Techno Geek Stuff Q & A
1 Comments

Tweet This Post

Share This Article With Friends:

Subscribe To Our RSS Feed
Digg It
Digg It
Bookmark On Delicious
Stumbleupon
Share On FaceBook

One Response to “How to get a PHP file to be included across files in different directories?”

  1. Rate
    Comment:
    Vote -1 Vote +1



    moeishaa

    create the directories and include the names when using the require() function.

    example :

    your index.php is in the root directory
    /index.php
    and you have a directory with your other php files in
    /lib/other.php

    so in index.php you will have

    require(“lib/other.php”);

Don't be just another DOT in the crowd. Sign up for a:
FREE Gravatar!
Be seen not just heard.

Leave a Reply