Code:
<?php include("/inc/foobar.php"); ?>
I am trying to include one php file in another, using the above code. When I view the website, I get an error message, and the file is not included. The rest of the page appears fine.
My directory structure is like this:
Code:
public_html
+inc
|+foobar.php
+foo
|+index.php
+index.php
I currently have a workaround by specifying "inc/foobar.php" in index.php and "../inc/foobar.php" in foo/index.php.
I would like to get it to work with "/inc/foobar/php", or any other method which is consistent across my site.
I don't remember the exact error message, but it was something like: "Could not find '/inc/foobar.php' with include_path 'something or other'".
Can someone explain how to include a php file from my inc directory?