Greetings all. New user. So glad to participate in a group with no badges (I don't need no stink'n ...)
I'm building a page and have a requisite number of 'requires' at the beginning of the php code. The paths to the required files are all absolute except for the base global def file. For example.
My home development environment is a standard xampp port with php 5.6.24. The apache2 document root is C:\xampp\htdocs.
The website files are under this, in a "distribution" directory, so the path to the main index file would be:
http://localhost/mninfo/index.php
In index.php the required files are defined with a full path, as in require '/xampp/htdocs/mninfo/js/common.js'.
Inside index.php, one of the required files itself has a required file. That will be fixed later. But it generated this question.
Here is the flow/structure
/xampp/htdocs/mninfo/index.php
require '/xampp/htdocs/mninfo/includes/thisfile.php
... and inside thisfile.php
/xampp/htdocs/mninfo/includes/thifile.php
require '../oldstuff.php'
The require fails. The error says:
[Wed Feb 01 21:57:04.761838 2017] [:error] [pid 5580:tid 1652] [client 127.0.0.1:55060] PHP Fatal error: require_once(): Failed opening required '../oldstuff.php' (include_path='C:\\xampp\\php\\PEAR') in C:\\xampp\\htdocs\\mninfo\\includes\\thisfile.php on line 12
I don't understand why. php says any relative file path will use current directory as the base reference. dotdot should point to the directory above 'includes'
If the relative path is removed (file name only). It works.
If the complete path is included, it works.
Thanks for any help.