UCP error division by zero

Hi community,

After importing the configuration from an Elastix 2.5 through the migration tool, UCP web page does no load correctly.
It shows:

Hubo un error tratando de cargar el UCP:
Division by zero

Any ideas?



Is this the only thing you see on the screen or do you have a stack trace on the screen?

Something like what was posted here:

Good luck and have a nice day!


We only see that. No trace available

Hello, We have same issue. New install of SNG7-FPBX-64bit-1710-1 today. Added System Builder Starter Bundle & Endpoint manager. Ran all module and OS updates. Completed ok. Dashboard shows no critical errors.

The UCP button would show the UCP login page.

Then ran the FreePBX Distro Conversion Tool, with the source device being a operational Elastix 2.5 installation. Completed ok. Handy tool.

The UCP button now generates a page with just the message: “There was an error trying to load UCP: Division by zero

Tried uninstalling and reinstalling UCP via the Update Modules page. Ran: Yum Update. There was nothing that needed updating. Rebooted. Same UCP error


It seems like this is a bug specific to the conversion of an old server to a current one so it would probably be a good idea to open a ticket.

Thank said, the error handling is not the usual one we get with the PHP stuff so I assume it’s Javascript.

Do you get any Javascript error on the page?

Good luck and have a nice day!


Hi Nick, thanks for the quick advice. No errors I can see. When the UCP webpage loads, it only has a light blue box on top of page with:“There was an error trying to load UCP: Division by zero” To get things moving I might try backing up and then deleting the users created by the import tool. Thanks.

OK, I looked a little at the code…

Take the following with a grain of salt because I am far from a PHP guru, I used my general programming knowledge to try to have a general idea of how things are working…

The error message you are getting is the result of calling a method/function that gets a list of active modules…

Somehow at one point it tries to divide by zero…

Those active modules it looks for must define a certain method/function.

It looks like it checks quite a few modules but if I am not mistaken the only ones outside of UCP who have that method/function are Contact Manager and Xmpp.

Contact Manager I am not sure you should mess with it but unless you are using it you could most likely remove or reinstall Xmpp to see if it is somehow causing a problem…

Good luck and have a nice day!


We’ve uninstalled XMPP and the result is the same


Thanks for looking Nick. We also uninstalled XMPP - no change. tried to uninstall contact manager, but it prompts to first disable the ‘restapps module’ first - which I can’t find. As an uninformed long shot experiment we backed up and then deleted all extensions and users - no change.

Would be worth trying to instead install 10.13.66-64bit, run the conversion tool, and then update to SNG7-FPBX-64bit-1710-1. Or perhaps easier just manually configure a fresh SNG7-FPBX-64bit-1710-1 install from scratch (we have about 20 extensions). The conversion tool seemed too cool, easy & super quick to not be a catch :slight_smile:

So it looks like it’s in UCP itself… :unamused:

If I had this problem, which I unfortunately don’t (otherwise I would be able to help further), I would temporarily slightly modify the source of the module…

(This would make the Dashboard unhappy and complain about the module being altered until the module is reinstalled over itself…)

Currently the Division by zero" message you are seeing is returned by a call to a method/function called getMessage(). I would replace this with a call to getTraceAsString() and hope it returns something meaningful…

(This is supposed to show a stack trace of sorts…)

This would give us an idea of what it tries to do which results in a division by zero.

If one of you is willing to try that I could try guiding you… I won’t be able to help much until tonight though as I don’t have access to my system right now.

For now I could only help you find the right line to modify instead of telling you which line to modify…

I would recommend against this as the distro upgrade “script” is still beta and you would be opening a new can of worms…

You might end up with a working setup, a very broken one more likely something in between.

I was one of the testers of the first script that was publicly made available and while my system was broken in many ways I did end up with a working setup in the end…

(I had to track down each problem I encountered and was able to fix them with the help of the FreePBX devs.)

The current script fixes a lot of the problems the script I had had but sometimes break things in new and creative ways :wink: so I would not suggest using this as a possible workaround around your current problem.

@sysdg, did you migrate to FreePBX 13 or FreePBX 14?

The migration tool both of you used was initially meant to convert to FreePBX 13 and it is possible it is unable to handle some of the new stuff in FreePBX 14…

Good luck and have a nice day!


Hi Nick,. I have fairly basic IT/linux knowledge, so if your willing I’m more than happy to make the change you suggest under your guidance, post back the result, and get this fixed for other users too. Cheers.


At line 108 of /var/www/html/admin/modules/ucp/htdocs/index.php

you should see something that looks like this

echo "<html><head><title>"._("UCP")."</title></head><body style='background-color: rgb(211, 234, 255);'><div
style='border-radius: 5px;border: 1px solid black;text-align: center;padding: 5px;width: 90%;margin: auto;left: 0px;right:
0px;background-color: rgba(53, 77, 255, 0.18);'>"._('There was an error trying to load UCP').":

replace $e->getMessage() with $e->getTraceAsString()

After this, it should looke something like this

echo "<html><head><title>"._("UCP")."</title></head><body style='background-color: rgb(211, 234, 255);'><div
style='border-radius: 5px;border: 1px solid black;text-align: center;padding: 5px;width: 90%;margin: auto;left: 0px;right:
0px;background-color: rgba(53, 77, 255, 0.18);'>"._('There was an error trying to load UCP').":

I think that should provide enough information to track down the source of that division by zero…

As I said earlier, I far from a PHP guru but I am no stranger to programming (that’s, mostly, my bread and butter…) so I think adding this should point us in the right direction…

I will try replying as soon as I can tomorrow but I have a formation all day and we are supposed to get pretty bad weather so I don’t know when I will be able to…

By the way, I noticed when I was looking at this tonight that there are actually more modules involved in all this. I had not taken into account the fact that some modules inherited the method/function that code looks for.

(Everything under /var/www/html/admin/modules/ucp/htdocs/modules I believe…)

Good luck and have a nice day!


Ni Nick. That produced ~4MB of text on the UCP web page in about 30s. I copied what it had at that point to a text file


Dear Marbled,
thanks for your help.
We migrated to FreePBX 13. We will also test the modifications that you suggest


I am currently on my mobile phone so it’s difficult to parse but are you guys using Fax Pro and if not can you remove it?

From the little I could see on my phone it looks like it is crashing there…

Have a nice day!


Hello. We were using Fax on Elastix, but hardly ever used these days, easy to live without. I can’t see FaxPro anywhere obvious how do we uninstall it?

Admin, Module Admin.

Thanks. A search for FAX on that page only returns;

Fax Configuration
Fax Configuration Professional.

Trying to uninstall Fax Configuration Professional prompts to uninstall Faxpro first. I can’t see Fax Pro.


It’s Fax Configuration Professional

You can also remove it by doing

fwconsole ma remove faxpro

Good luck and have a nice day!


NIck & Lorne, Thanks very much for your advice. That worked! UCP button now brings up the UCP login page,

sysdg - Hope Nick’s fix works for you too.

Have a good weekend


1 Like