PhpMyAdmin Fatal error: call undefined __ () function

The server works with RHEL 7 and PHP 5.4.16. When I try to open / phpMyAdmin in my browser, I am presented with an error:

Fatal error: Call to undefined function __() in /usr/share/phpMyAdmin/libraries/core.lib.php on line 242

Call Stack
#   Time    Memory  Function    Location
1   0.0008  348000  {main}( )   ../index.php:0
2   0.0018  503144  require_once( '/usr/share/phpMyAdmin/libraries/common.inc.php' )    ../index.php:12
3   0.0252  4224464 PMA_Config->__construct( )  ../common.inc.php:304
4   0.0252  4224712 PMA_Config->load( ) ../Config.class.php:100
5   0.0265  4309888 PMA_Config->checkConfigSource( )    ../Config.class.php:849
6   0.0265  4311088 PMA_fatalError( )   ../Config.class.php:1169

      

I believe that I have installed all the required libraries and that apache has the appropriate permissions for the session.save_path directory, which were problems the previous times this question was asked. See: Calling undefined __ () function - phpMyAdmin

Can anyone give me a hint based on this call stack? Here are the functions from the lines referenced by the stack trace, with the corresponding line written in the left margin:

core.lib.php

on line 242:

   /**
   * displays the given error message on phpMyAdmin error page in foreign language,
   * ends script execution and closes session
   *
   * loads language file if not loaded already
   *
   * @param string       $error_message  the error message or named error message
   * @param string|array $message_args   arguments applied to $error_message
   * @param boolean      $delete_session whether to delete session cookie
   *
   * @return void
   */
   function PMA_fatalError(
       $error_message, $message_args = null, $delete_session = true
   ) {
   /* Use format string if applicable */
   if (is_string($message_args)) {
       $error_message = sprintf($error_message, $message_args);
   } elseif (is_array($message_args)) {
       $error_message = vsprintf($error_message, $message_args);
   }

   if ($GLOBALS['is_ajax_request']) {
       $response = PMA_Response::getInstance();
       $response->isSuccess(false);
       $response->addJSON('message', PMA_Message::error($error_message));
   } else {
       $error_message = strtr($error_message, array('<br />' => '[br]'));

       /* Load gettext for fatal errors */
       if (!function_exists('__')) {
           // It is possible that PMA_fatalError() is called before including
           // vendor_config.php which defines GETTEXT_INC. See bug #4557
           if (defined(GETTEXT_INC)) {
               include_once GETTEXT_INC;
           } else {
               include_once './libraries/php-gettext/gettext.inc';
           }
       }

       // these variables are used in the included file libraries/error.inc.php
242    $error_header = __('Error');
       $lang = $GLOBALS['available_languages'][$GLOBALS['lang']][1];
       $dir = $GLOBALS['text_dir'];

       // on fatal errors it cannot hurt to always delete the current session
       if ($delete_session
           && isset($GLOBALS['session_name'])
           && isset($_COOKIE[$GLOBALS['session_name']])
       ) {
           $GLOBALS['PMA_Config']->removeCookie($GLOBALS['session_name']);
       }

       // Displays the error message
       include './libraries/error.inc.php';
    }
    if (! defined('TESTSUITE')) {
       exit;
   }
   }

      

common.inc.php

on line 304:

304  $GLOBALS['PMA_Config'] = new PMA_Config(CONFIG_FILE);
     if (!defined('PMA_MINIMUM_COMMON')) {
         $GLOBALS['PMA_Config']->checkPmaAbsoluteUri();
     }

      

Config.class.php

on line 100:

    /**
    * constructor
    *
    * @param string $source source to read config from
    */
   function __construct($source = null)
   {
       $this->settings = array();

       // functions need to refresh in case of config file changed goes in
       // PMA_Config::load()
100    $this->load($source);

       // other settings, independent from config file, comes in
       $this->checkSystem();

       $this->isHttps();

       $this->base_settings = $this->settings;
   }

      

Config.class.php

on line 849:

    /**
    * loads configuration from $source, usually the config file
    * should be called on object creation
    *
    * @param string $source config file
    *
    * @return bool
    */
   function load($source = null)
   {
       $this->loadDefaults();

       if (null !== $source) {
           $this->setSource($source);
       }

       /**
        * We check and set the font size at this point, to make the font size
        * selector work also for users without a config.inc.php
        */
       $this->checkFontsize();

       if (! $this->checkConfigSource()) {
849       return false;
       }

      

Config.class.php

on line 1169:

     /**
     * check config source
     *
     * @return boolean whether source is valid or not
     */
    function checkConfigSource()
    {
        if (! $this->getSource()) {
            // no configuration file set at all
            return false;
        }

        if (! file_exists($this->getSource())) {
            $this->source_mtime = 0;
            return false;
        }

        if (! is_readable($this->getSource())) {
            // manually check if file is readable
            // might be bug #3059806 Supporting running from CIFS/Samba shares

            $contents = false;
            $handle = @fopen($this->getSource(), 'r');
            if ($handle !== false) {
                $contents = @fread($handle, 1); // reading 1 byte is enough to test
                @fclose($handle);
            }
            if ($contents === false) {
                $this->source_mtime = 0;
                PMA_fatalError(
                    sprintf(
                        function_exists('__')
                        ? __('Existing configuration file (%s) is not readable.')
                        : 'Existing configuration file (%s) is not readable.',
                        $this->getSource()
                    )
1169            );
                return false;
            }
        }

        return true;
    }

      

+3


source to share


5 answers


The problem was incorrect directory permissions /etc/phpMyAdmin

. The apache web server user had the appropriate directory permissions session.save_path

but apache was unable to read from my config.inc.php file. Changing the owner of / etc / phpMyAdmin for the apache user and changing the permissions to 755 solved the problem.

Looking at the function checkConfigSource()

in Config.class.php

, I thought that if the problem was with access to the config file, I would get an error 'Existing configuration file (%s) is not readable.'

instead. Call to undefined function __()

Does anyone know why this wasn't the case?



It was a pretty simple problem / solution, but unless someone suggests otherwise, I think I'll leave it as this exact problem / solution is not covered in other error discussions Fatal error: Call to undefined function __() in /usr/share/phpMyAdmin/libraries/core.lib.php

when trying to run phpMyAdmin after installation.

+9


source


Had the same error message from phpMyAdmin :: FastCGI posted to stderr: "PHP message: PHP Fatal error: Call to undefined __ () function in /usr/share/phpMyAdmin/libraries/core.lib.php on line 245" when reading the upstream response header, client:



Solution that worked on my Fedora 22 x86_64 server using nginx: change owner and group id from root: apache in / var / lib / php / session
 to root: nginx
using command sudo chown -Rfv root:nginx /var/lib/php/session

.

+2


source


If phpmyadmin was working fine and then suddenly stops working for no reason with a fancy and useless error message, you might want to try deleting your php sessions.

rm -rf /var/lib/php/sessions/*

      

The exact location can be very OS and version dependent, and this will delete all active sessions, not just yours, but it can fix some "abruptly terminated working" problems where you haven't changed anything and it worked fine before.

0


source


This was a different problem for me. I have given 777 permissions for phpMyAdmin forlder. When I changed it to 755 it worked fine.

Hope this helps someone.

0


source


"Connection was reset" error
File: /usr/share/phpmyadmin/libraries/common.inc.php

Search:

$GLOBALS['PMA_Config'] = new PMA_Config(CONFIG_FILE);<br>

      

replaced by:

$GLOBALS['PMA_Config'] = new PMA_Config();

      

-2


source







All Articles