I am now mired in a confusion of include/require paths. This will be challenging perhaps for the experience PHP coder.
The question is: What is the best way to make sure I don't get PHP Notices, Warnings, or Errors related with redefinitions of constants or redeclarations of functions/other code when I have PHP files including other PHP files which may include others. NOTE CAREFULLY: in this instance: require_once() is not working, for reasons explained below:
Suppose I have a two REAL directories/folders which are called
Within the directory "Z:\service.web.Root" is the real subdirectory "PHPClasses" (full path is "Z:\service.web.Root\PHPClasses")
Within the "PHPClasses" I have the PHP file "globalsLib.php". This file is "require_once" in couple of separate PHP scripts (say my main script, and then support scripts). Within the "globalsLib.php" I have the useful function "__autoload" defined, useful in automatically finding PHP files having the name of the classes that are contained in them. Now say that the main script and one or more of the support scripts ALSO included in the main script all have require_once("globalsLib.php"). What is happening is an error now:
The error is:
Fatal error: Cannot redeclare __autoload() (previously declared in Z:\service.web.Root\PHPClasses\globalsLib.php:39) in Z:\Development\PHPClasses\globalsLib.php on line 41
There is ONLY ONE real globalsLib.php file, although it is pointed to by a real path and a symbolic path. Notice that even the line numbers are different, although they should be the same. Using my text editor (RJ Text Ed), I have opened the globalsLib.php file through the symbolic and real path, and the function is defined on the same line numbers.
Again the question is: what are best practices for eliminating this potential mismanagement?