FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Errors Related to Same Path Through Real and Symbolic Link References
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Errors Related to Same Path Through Real and Symbolic Link References [message #178710] Sun, 22 July 2012 03:53 Go to previous message
SMH is currently offline  SMH
Messages: 3
Registered: July 2012
Karma:
Junior Member
I am using "require_once" to include a PHP file that defines constants and
commonly used functions. It is in a main script and also in support scripts
that are themselves included in the main script. The main script is in a
"development" directory, and that directory contains a symbolic link to
included files. I am getting a FATAL ERROR (function in included file is
re-declared) because there is a reference to an included script through a
real path and one through a symbolically linked path.

Here is more detail:

The included file is named "globalsLib.php." In it are defined constants
and common functions. Important in this post is that there is a function
__autoload() defined on line 39.

This file "globalsLib.php" is located in the directory
"Z:\service.web.Root\PHPClasses" (yes, the system is Windows [7])

I also have a directory "Z:\Development". It contains a subdirectory
"PHPClasses" which is symbolically linked to "Z:\service.web.Root
\PHPClasses". and so the "Z:\Development\PHPClasses" points to that as the
real directory.

Inside "Z:\Development" is a script "index.php" which contains as follows:

line 5: require_once('globalsLib.php');
line 19: include 'SySInfo.php';

Inside the "SysInfo.php" file on line 11 is require_once('globalsLib.php');

Here is the PHP output when requesting "http://localhost/development/"
(which reads the script "Z:\Development\index.php"

Notice: Constant PATH_SEPARATOR already
defined in Z:\service.web.Root\PHPClasses\globalsLib.php
on line 26

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

All of this is clearly caused by PHP correctly not knowing what that a
symbolic link is pointing to the same directory.

I am almost certainly violating at least ONE, and probably a DOZEN Best
Practice rules in using PHP. Either you know the name of a book or two on
PHP or general programming that I absolutely MUST read, or you have a set of
rules you have developed yourself.

I would appreciate your advice.
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Solution Manuals & Test Banks
Next Topic: Using PHP and JAVA applets together
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Nov 25 21:16:26 GMT 2024

Total time taken to generate the page: 0.04104 seconds