Pulling My Hair Out Trying To Get PHP includes to Work!
Firstly just want to say thanks in advance.
I've just started converting a more or less static site into a php driven site. I haven't previously
used php to any great length and I'm seriously having problems setting up includes. I'm working
on localhost at the moment.
My directory/project structure is as the following:
If at all possible, what I'm trying to do is set the path to the includes via htaccess and then be
able to use that path on any page, in any directory.
I've currently got this in my htaccess file in the root directory:
The implementation below then works a charm when called from files within the root directory.
php_value include_path "php"
<?php require_once("some-include.php"); ?>
It fails however when includes called in the same manner with files in subdirectories. In order to
<?php include_once("some-include.php"); ?>
get it to work I've had to create a separate .htaccess file for each directory and place the following:
How can I set the path globally in my main htaccess or php.ini and be able to just implement the
php_value include_path "../php"
includes without having to use relative paths?
Any suggestions are greatly appreciated at this point.