Including a PHP file that can be used with multiple sites

Posted by Roland on Server Fault See other posts from Server Fault or by Roland
Published on 2009-10-12T15:20:27Z Indexed on 2012/03/25 11:33 UTC
Read the original article Hit count: 248

Filed under:
|
|
|

I have a web server that we use, apache, centos5, php

I have a file called 'include.php' that I need to include in multiple sites.

Eg. I have a site called testsite.co.za, now in the index.php i want to include the include.php file, the include.php is not in the root of testsite.co.za,

Now i created another folder includes in the web root directory which contains include.php

my code looks as follows in testsite.co.za/index.php

require_once '../includes/include.php';

if i run testsite.co.za it can't detect include.php. Is there a certain server setting I need to change in order to include this file?

My directory structureof

-/var/www/html
  -testsite.co.za
      -index.php   
  -includes
      -include.php

Hope this makes sence

© Server Fault or respective owner

Related posts about php

Related posts about centos