Porting FreePBX to Mac OS X - problems with gettext

I’ve been working on porting FreePBX to run natively on OS X. I have a build script which installs FreePBX successfully and modifies all the permissions so that you can run it with correct user accounts (i.e., not as root). All seems to work except for gettext functions. Whenever I come across one of the gettext functions within a php page I get “function not found” error messages such as this:

"Fatal error: Call to undefined function textdomain() in 
/freepbx/admin/functions.inc.php on line 865"

I have checked that gettext is installed and enabled within php (running php -v or info.php clearly shows that it is) and if I write a test php page at root in my webserver with gettext functions in it then that page works fine.

Has anyone got any knowledge of the implementation of gettext within FreePBX got any suggestions as to where I should look next?

So yes, an OSX port of FreePBX could nearly be with you!


it should all be standard php???

Philippe, yes it should all be standard php but somehow gettext isn’t working within functions.inc.php. If I add php to any of the main .php files (such as config.php) then it works fine but the same commands called from within functions.inc.php. I’ve just renamed functions.inc.php to functions.php and then grepped everything in webroot and in ASTVARLIBDIR (effectively module_admin and retrieve.conf) and it all now works. Clearly we have a problem with this particular file name because it works fine as functions.inc.php. It can’t be a general OS issue because a quick search shows that I have 106 files ending “.inc.php” and they can’t all not work… I’ll press ahead as it is because it now seems to be working but there are lots of files in i18n folders that reference functions.inc.php and I can’t change them all…

Any suggestions as to how to properly fix this issue without renaming every call to functions.inc.php are warmly welcomes.

I think that the one remaining issue is the asterisk stop/start routine (needs launchd) which I need to code and then its into test mode for a couple of weeks before we swap out our CentOS FreePBX box for the Mac! We will run that as a live box for several more weeks (swapping it back if it all goes wrong) and if its still live at the end - I’ll share the build script! If anyone else wants to test it then let me know.

I am having the same problem, did you get this working?

Regrettably no. I was nearly there and then 10.6 was looming on the horizon so I thought I would leave it for a short while and then give it another go. Sadly other issues have taken over and I haven’t had time to crack it. I’ll get back to it at some stage… If you want a deploy script for deploying asterisk and freepbx on OS X then let me know… Just remember that freepbx doesn’t actually work but everything else does!

please send me anything you have at ken at ksac dot com. Also, the one post seems that you got this message to go away, or not?
Thanks so much, and sorry I posted all of those. I was logged in remotely and that happened somehow.

I think this may be because retrieve_conf is called from functions.inc.php, and in turn ends up loading functions.inc.php.
So your copying the functions to a different and renaming in retrieve_conf does make it work.
i dont seem to have THAT problem anywhere else. Still working through other problems, have fixed a lot, but still have at least one big oe to go.

I am very interested to find out if this has been sorted. I really want to run this on OSX 10.6. Are there any other gotchas?

Can you send me the script? I am interested in getting it to work.