Fatal erro/Uncaught Error: Call to undefined function Gibbon\gettext()

dear admin,

when I install Gibbon. I m getting the following error, pls. help me to solve the issue.


Fatal error: Uncaught Error: Call to undefined function Gibbon\gettext() in /Library/WebServer/Documents/core/src/Gibbon/Locale.php:249 Stack trace: #0 /Library/WebServer/Documents/core/functions.php(113): Gibbon\Locale->translate('Gibbon Installe...', Array, Array) #1 /Library/WebServer/Documents/core/installer/install.php(71): __('Gibbon Installe...') #2 {main} thrown in /Library/WebServer/Documents/core/src/Gibbon/Locale.php on line 249


Note:
my server details: Apache/2.4.34 (Unix)
PHP 7.3.4 (cli) (built: Apr 19 2019 00:20:56) ( NTS )
mysql Ver 14.14 Distrib 5.7.25, for macos10.14 (x86_64)

Thanks
Toby

Comments

  • Hi Toby,

    Gibbon uses gettext() to perform translated string replacements, but in some Apache/PHP installs it is not enabled by default. The best bet is to do some online research to look at how to install GetText on your platform.

    The gettext function used by Gibbon is _(), which we've wrapped in __().

    Let us know how you get on.

    Thanks.

    Ross
    toby
  • Thanks Ross, the problem solved when I change my php.ini. But now I can't open index.php, it's blank.
  • Hi Toby,

    You are most welcome. Often a blank PHP page is a sign that there is an error. Can you check your PHP error logs to see what is going on?

    Thanks,

    Ross
  • Hi Toby and Gibbon
    We are having similar problem, running PHP 7, mySQL 5.6 on a shared(virtual) hosting, got this error before even I can see the first screen

    Internal Server Error
    PHP Fatal error: Uncaught Error: Call to undefined function Gibbon\gettext() in /gibbon/src/Gibbon/Locale.php:249
    Stack trace:
    #0 /gibbon/functions.php(113): Gibbon\Locale->translate('Gibbon Installe...', Array, Array)
    #1 /gibbon/installer/install.php(71): __('Gibbon Installe...')
    #2 {main}
    thrown in /gibbon/src/Gibbon/Locale.php on line 249

    Since its a shared server, we don't really have permission to edit the php.ini, but able to edit the htaccess file. Would you please help by sharing info on how to solve this error? thanks
  • Hi Gary, I don't believe you can solve this one using .htaccess, however, if your shared host uses cPanel, they may have enabled a feature that allows you to enable PHP extensions (of which gettext is one). My host has this feature, but gettext is not in the list...however, I believe this is variable by host:



    At any rate, I think your host's support team ought to be able to help.

    Good luck, and let us know how you go!
  • Thanks for the prompt reply, but unfortunately our host does not use cPanel ... I will contact them and see if any workaround, otherwise sadly cannot use it until we have our own server.
    admin
  • Hi Gary,

    Hopefully your hosting provider can enable this extension for you. Until then, if you don't need language translation you could edit the src/Gibbon/Locale.php file and update lines 248-250 in the translate method to the following:
            if (function_exists('gettext')) {
                $text = empty($domain) ?
                    gettext($text) :
                    dgettext($domain, $text);
            }
    The translateN method likely needs updated with a similar conditional.

    These changes would be overwritten the next time you update, but they should allow you to proceed for now with using the system without gettext installed.
    admingaryc
  • Hi Sandra

    Thank you very much for offering help. No, I cannot customize these settings on a shared hosting, however, I found another provider which has a dedicate (virtual, likely) server package at affordable cost, so I am trying it now on this new platform. Right now going through the installation and configuration of the Linux, LAMP, SSH, FTP etc, but will also keep your suggestion in mind in case I failed to set up my own Ubuntu server (also it is a very good reference for those who stuck with a shared server)

    Regards,
    GC
Sign In or Register to comment.