Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "J.O. Aho" Newsgroups: comp.lang.php Subject: Re: Errors Related to Same Path Through Real and Symbolic Link References Date: Sun, 22 Jul 2012 08:30:17 +0200 Lines: 53 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net 9Ja6/XO9Ac4+IvybR9wlMQJuSX5CatTbRqI89a+oDcgBuvrBRx6Jhc7MoPIpm0bP0t Cancel-Lock: sha1:D2TABD3jd2Kc0ITkwGZDmK+YtNQ= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120613 Thunderbird/13.0 In-Reply-To: Xref: csiph.com comp.lang.php:6638 On 22/07/12 05:53, SMH wrote: > 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. The obvious solution is to see that you include the file just once. Another work around is to use c/c++ like define checks: or you could do for each function: if(!function_exists('first_function_of_yours')) { function first_function_of_yours() { // your code here } } and you have to see if values are defined before you define those (if you use global values). If you really want to do it the right way, just see to just include the file once, no matter if it's the original file or a symlink. -- //Aho