![](https://secure.gravatar.com/avatar/4fad748f042c73a9d01d1ff340dbced4.jpg?s=120&d=mm&r=g)
May I ask you what is the purpose to include the config file more than once? (I'm really curious as in my practice I never had the urge to do something like this)
On 2016-02-23 23:42, Tom Laermans wrote:
BTW: We are purposefully including the config file multiple times, and require_once is not an option for this functionality
Adding a require_once() / include_once() into your config.php with that custom function is a good way.
Tom
On 23/02/2016 22:09, Adam Armstrong wrote:
includes/functions.inc.php would seem to be a sensible place.
A config file is certainly not the right place to define code, and whinging at other people when it causes things to break is not helpful.
adam.
On 23/02/2016 21:08:15, Nagy Attila tylla_at_memetic.org@tylla.hu wrote:
OK. Then what's the recommended place of custom_rewrite_location() function?
On 2016-02-23 22:02, Adam Armstrong wrote:
Do not declare functions in config.php
adam.
On 23/02/2016 21:02:04, Nagy Attila tylla_at_memetic.org@tylla.hu wrote:
Not at all. If that were the case than the error would persist even after I used require_once() for the same unchanged file. And I can reproduce the error if I simply change the require_once() function call to a simple require().
Btw. the declaration is there only once. It starts on line 87 and the ending bracket of the function is on line 102.
So the question remains, shouldn't require_once/include_once be used in all the places where referencing config.php?
On 2016-02-23 19:34, Joseph Zancocchio wrote:
It seems your config.php file was somehow modified during the
upgrade
procedure, such that the custom function you defined in there is
being
redeclared 15 lines later.
It may be as simple as removing the second declaration of custom_rewrite_location() starting on line 102, though I suspect
you
may have a few other issues in the config file.
If you have a backup of the config.php file from before the
upgrade,
I'd first try replacing the current one with that backup. Failing that, you will need to manually go through the config file to
fix any
other issues introduced during the upgrade. If you can't figure out what else, if anything, is messed up, you can share your config.php here, with any sensitive info edited out...
On 02/23/2016 01:17 PM, Nagy Attila wrote: > Hi all, > > We are using a customized location rewrite function to split
the SNMP
> location of devices into a human readable and a machine > understandable format. > We are using the community edition, and on updating to the recent > version we were faced with thIS error message: > > PHP Fatal error: Cannot redeclare custom_rewrite_location() > (previously declared in /opt/observium/config.php:87) in > /opt/observium/config.php on line 102 > > This is a common error when a php file is included/required
more than
> once, so I made a workaround by renaming config.php to > config.user.php and using require_once() in the original
config.php
> to load these directives (it needs absolute path otherways it
cannot
> find the file). > > Shouldn't require_once/include_once be used in all the places
where
> referencing config.php? > > Br, > Tylla, > > _______________________________________________ > observium mailing list > observium@observium.org > http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium