PHP包含在ubuntu服务器上运行的灯泡中

I have installed LAMP in ubuntu server. and its working good.. i have a php application which has a folder structure the root folder has

  • index.php
  • {Database}
    • localhost.php
  • {Modules}
    • module1.php
    • module2.php
    • module3.php
    • {MODULE3}
      • submod1.php
      • submod2.php

based on _GET the modules are included in index.php by

include('Modules/module2.php');

which works out perfectly well.. but in the module1.php when i try to include localhost.php by

include('/Database/localhost.php');

it doesn't work out. why is that it's not working..

NOTE:the same code works perfectly in WAMP in my windows 7.

You have a slash in front of "Database"

include('/Database/localhost.php');

the slash before /Database/ shouldn't be there because php tries to find the file from / (root folder).

Usually it's better to have a defined starting path point like:

define('DS', '/'); //Directory separator Unix
define('BASE_PATH', dirname(__FILE__).DS);

And then to use it as a base for all other included files.