Receiving - Warning: Invalid argument supplied for foreach() in /var/www/html/admin/functions.inc.php on line 83

Line 83
foreach ($amp_conf_defaults as $key=>$arr) {

FreePBX 2.4
running CE Asterisk 1.4.18-2 RPM by [email protected] built by root @ trixbuild-2.5 on a i686 running Linux on 2008-02-15 01:21:56 UTC

This shows up in the ARI webpage. How do I fix this? Thank you.

Has anyone ever resolved this issue??

I ask as I have posted on the trixbox forums as well, and even filed a bug report, but so far no love. At the same time, I know I am not the only one having this issue, quite a few have posted with the same problem. Seems like when we did the freepbx and yum updates, something went wrong.

I would love to resolve this and get ARI working again, but at the moment the ARI interface is pretty much useless.

For more details and chat on this, you can also see the trix forums threads at:

http://www.trixbox.org/forums/trixbox-forums/open-discussion/receiving-warning-invalid-argument-supplied-foreach-var-www-ht

-and-

http://www.trixbox.org/forums/trixbox-forums/open-discussion/trixbox-2-6-0-5-errors-ari-any-suggestions

If anyone knows how to fix this, I would sure love to know…

Thanks…

well you know that trixbox 2.6 is not a real stable product at this moment, right? 2.6.0.0 has HUGE install problems because it had a series of bad installation scripts, didn’t install a parge part of the base system to make it work, etc. 2.6.0.2 also had issues and was not usable. 2.6.0.5 is still our as people are posting complaints and I’ve not seenany real solid posts saying it works perfectly. No you can’t upgrade from 2.6.0.x to 2.6.0.5 as there are thing missing and only a complete reinstall will even make it potentially usable.

Don’t take me for a trixbox hater. I have it and use it. Just not the 2.6 releases because of what I’ve said above.

Have you tried to install the latest FreePBX on top of what trixbox has provided (and updated to the very latest)? it might fix things that they might have broken without knowing…

This was a native 2.6.0.5 install, as I know that the 2.6.0.2 stuff was damaged beyond repair.

On a side note, sroderick on the tb forums posted the following suggestion that seems to have worked overall:


Add the following ABOVE line 23 in the file functions.inc.php

global $amp_conf_defaults;

You should then have:

global $amp_conf_defaults;
$amp_conf_defaults = array(


This did seem to clear up the error, but still I get a “404 File not found” error when I try and download a recorded message. Maybe someone here that is PHP knowledgable can tell me if the above should have been in the file, or if this is a bad idea and isn’t how it should be fixed…

As to overlaying FPBX on top of the existing install, nope didn’t try that, as everything else is working fine except ARI, and didn’t want to trash the system over that by accident…

-HL

I’m not a php guy but let me give some more info. I have that line in my files, it is called and works as it should in my 2.4 install. It is part of the routine parse_amportal_conf which takes a filename and parses that file up reading the variable and seetings from the file into memory for use. It is used by FreePBX to read the amportal.conf file.

So I’d be guessing that you have a bad line someplace in your amportal.conf file that is does not like and not the code that is failing as everybody in the world using FreePBX would be complaining about it not working if that was the case.

So it can be one of several issues.

Most common would be that the amportal.conf file has a value it in that the parser can not handle or like. That or a line it is attempting to read is damaged in the amportal.conf file. The lines the parser is expecting to see are listed almost directly above in the same file. From around line 23 (not sure of your EXACT version of FreePBX 2.4). you will see the array defined with all the known default values. top of that looks like:

$amp_conf_defaults = array(
‘AMPDBENGINE’ => array(‘std’ , ‘mysql’),
‘AMPDBNAME’ => array(‘std’ , ‘asterisk’),

So DO NOT make that change as I think it will cause you more harm then good. Review your amportal.conf file specially any place you might have made a edit for something that looks wrong.

It is also possible that 2.6.0.5 has a problem with the version of FreePBX and overlaying a good known copy from the FreePBX site is the best way to make sure that you don’t have any other issue.

FYI: I’m a tb user. Just not using 2.6 due to it’s very poor track record to date and no mp3 or faxing support which we use hundred of times a day.

I’ve taken the whole /var/www/html/recordings folder from a 2.2.12 install and over-wrote my /var/www/html/reocrdings folder in 2.6.0.5 install and completely eliminated any error messages in the ARI. Your results may vary…