Phpmyadmin: /localhost/phpmyadmin showing PHP code instead of login page

Created on 11 Apr 2016  路  43Comments  路  Source: phpmyadmin/phpmyadmin

Steps to reproduce

Try to access the /localhost/phpmyadmin

Expected behaviour

Display logon screen

Actual behaviour

RAW PHP code gets displayed. Here are the first few lines:
/* vim: set expandtab sw=4 ts=4 sts=4: _/
/_*

  • Main loader script
    *
  • @package PhpMyAdmin
    */

/**

  • Gets some core libraries and displays a top message if required
    */
    require_once 'libraries/common.inc.php';

/**

  • display Git revision if requested
    */
    require_once 'libraries/display_git_revision.lib.php';
    require_once 'libraries/Template.class.php';

/**

  • pass variables to child pages
    */
    $drops = array(
    'lang',
    'server',
    'collation_connection',
    'db',
    'table'
    );
    foreach ($drops as $each_drop) {
    if (array_key_exists($each_drop, $_GET)) {
    unset($_GET[$each_drop]);
    }
    }
    unset($drops, $each_drop);

Please note that both apache, mysql and PHP are running ok on this same environment. This behavior appears to be happening after last apt updates got applied one week ago. Prior to that the phpmyadmin app was working okay. I already tryed uninstalling the whole LAMP stack and phpmyadmin from the scratch, but with the same results.

phpMyAdmin version: 4.5.14 from Canonical Distribution Packages

Client configuration

Browser: Google Chrome, Mozilla Firefox

**Operating system: Ubuntu Desktop 16.04 LTS

question

Most helpful comment

I was facing the same issue on Ubuntu16.04
then It solved

$ sudo apt install libapache2-mod-php7.0
...
...
Creating config file /etc/php/7.0/apache2/php.ini with new version
Module mpm_event disabled.
Enabling module mpm_prefork.
apache2_switch_mpm Switch to prefork
apache2_invoke: Enable module php7.0

This is my all installed list depending on php and mysql and apache

sudo apt install php7.0
sudo apt install php7.0-cgi
sudo apt install php7.0-gd
sudo apt install php7.0-mysql
sudo apt install mysql-server
sudo apt install phpmyadmin
sudo apt install libapache2-mod-php7.0

All 43 comments

Enable interpreting PHP in your webserver, if using Apache it's usually enough to install libapache2-mod-php5.

Thanks for the input. Unfortunately, this did not solve the issue. In fact, I don't have PHP5 but PHP7 installed so, when attemping to install the php5 related library, get the expected

"Package libapache2-mod-php5 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source.

E: Package 'libapache2-mod-php5' has no installation candidate
"

error.

Also tried:

"apt install libapache2-mod-php
Reading package lists... Done
Building dependency tree
Reading state information... Done
libapache2-mod-php is already the newest version (1:7.0+35ubuntu6).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded."

So, seems that this should be more likely related to the way PHP7 interacts with phpmyadmin. Below some addition information about my environment:
php -v
PHP 7.0.4-7ubuntu1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

apache2 -v
Server version: Apache/2.4.18 (Ubuntu)
Server built: 2016-04-05T21:18:31

mysql --version
mysql Ver 14.14 Distrib 5.7.11, for Linux (x86_64) using EditLine wrapper

Any additional help with this will be highly appreciated. Thanks,
Alex.

Maybe just PHP is not enabled in Apache? Try a2enconf php.

You can also try packages from our PPA which will be more up to date (I've just uploaded 4.6.0 there).

This seems to be a thought one... I installed from your latest ppa, and now I get:

The localhost page isn鈥檛 working

localhost is currently unable to handle this request.
500

also get an error when attempting to enable PHP as root (althought my indersatnding is that PHP is already enabled, as I get the well known PHP information page whent hitting /localhost/info.php):

a2enconf php
ERROR: Conf php does not exist!

Kinda becoming confused and a little bit frustrated with this already.... Thanks,
Alex

This is really rather how to enable PHP in Apache in Ubuntu. The problem is that I don't use Ubuntu and Apache, so I'm not really the right person to give advices :-). Try asking on some Ubuntu forum how to do that...

Hi, this thread is a bit old, but in case @av2406 hasn't solved the problem, I had the same problems. I'll explain what I had and what I did.

I have Ubuntu 16.04 installed. It comes with PHP 7 right out of the box. So I installed PHP7 and then I had a completely messed up environment. I had bits of PHP5 along PHP7. So, to start things with the right foot and not going crazy with the mess, I have purged everything about php. On Ubuntu, you can do it with

$ sudo apt-get purge php*

Don't forget to purge phpmyadmin. I had mysql-server installed, but I didn't purge it, I just left it there. Then, here's what I did.

  1. Reinstalled php7 (with apt-get install, not using any PPA, just the package Ubuntu 16.04 gives me)
  2. Installed libapache2-mod-php7.0
  3. Installed phpmyadmin using the PPA @nijel provided the link to.
  4. After that, I started having a 500 error. So I opened apache's error log and found out it was trying to access a certain lib called php-gettext. There I had my $ apt-get install php-gettext getting that for me.
  5. Success.

Just one small extra something: @nijel mentioned some messages ago that you should run a2enconf php and you said that you got a ERROR: Conf php does not exist!. You're using PHP7, thus that command changed to a2enconf php7.0-fpm.

Hope that helps someone.

The phpmyadmin package in PPA depends on php-gettext, that's strange that it didn't get installed automatically.

As for the PHP5/7 mixture, this should be fixed in next release of the Debian package, I will remove support for PHP5 there as this is what has caused this mess....

Clock work. Just installed the missing php-gettext library and got it working againg. Thany you both for the help. Regards, AV/

Does the phpmyadmin package has php-gettext dependency for you?

Well, apparently not, given that it started working once I manually intalled the php-gettext library. Regards...

That's really strange as I see it on all packages on https://launchpad.net/~nijel/+archive/ubuntu/phpmyadmin and http://packages.ubuntu.com/xenial/phpmyadmin says same...

Thank You Nijel and Luis, this post got me going.

Thanks Nijel installing the php-gettext library solved the issue

Great solution it fixed my problem, thanks to all

I finally understand it - the php7.0-common package provides php-gettext as well which has nothing to do with php-gettext package. This was fixed in Debian, but the Ubuntu ships broken package. See https://bugs.launchpad.net/debian/+source/php7.0/+bug/1569128 and https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=823815

@luismilanese thanks the magic stuff was a2enconf php7.0-fpm.

Hello
I have still stucked with same prob.
` /* vim: set expandtab sw=4 ts=4 sts=4: _/
/_*
*

Also in terminal

sudo service apache2 restart * Restarting Apache httpd web server apache2 [Tue Aug 09 17:45:16.713278 2016] [alias:warn] [pid 6876:tid 140630885603200] AH00671: The Alias directive in /etc/phpmyadmin/apache.conf at line 3 will probably never match because it overlaps an earlier Alias. AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message

can anyone help me out from here to keep going with phpmyadmin?

I am using Php 7.0 & I had similar issue and I fixed it by typing

sudo apt-get install php7.0-mbstring

along with that some new packages were installed & some packages were upgraded. After finishing that I just refreshed the page bang phpmyadmin GUI :)

Hey all, just sharing my experience I too had the same issue with a new phpmyadmin installation.
My setup - PHP 7.0.8 and Apache/2.4.18

when I tried to access http://[IP]/phpmyadmin I was getting a php code displayed on the screen, but http://[IP]/phpmyadmin/index.php was working, strange. I added DirectoryIndex in /etc/apache2/apache2.conf and found working.
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
DirectoryIndex index.php
Require all granted
</Directory>

image
some case with me
it not work -__

I had the same problem. This solution work for me:
sudo dpkg-reconfigure phpmyadmin

not sure if this problem had been resolved. I have encounter the same problems and had followed all of the above but still did not work for me.
However, i came across an article sometime ago and it was mentioned that if you placed the phpmyadmin or any other php files in your personal "public_html" folder, you will have to first update the php7.0.conf in /etc/apache2/mods-enabled/ and comment out the last portion from ...'
then restart apache2 services. It should work......it works for me.

done most of but still facing the issue any solution?

/* vim: set expandtab sw=4 ts=4 sts=4: /
/
*

  • Main loader script
    *
  • @package PhpMyAdmin
    */

/**

  • Gets some core libraries and displays a top message if required
    */
    require_once 'libraries/common.inc.php';

/**

  • display Git revision if requested
    */
    require_once 'libraries/display_git_revision.lib.php';
    require_once 'libraries/Template.class.php';

/**

  • pass variables to child pages
    */
    $drops = array(
    'lang',
    'server',
    'collation_connection',
    'db',
    'table'
    );
    foreach ($drops as $each_drop) {
    if (array_key_exists($each_drop, $_GET)) {
    unset($_GET[$each_drop]);
    }
    }
    unset($drops, $each_drop);

/*

  • Black list of all scripts to which front-end must submit data.
  • Such scripts must not be loaded on home page.
    *
    */
    $target_blacklist = array (
    'import.php', 'export.php'
    );

// If we have a valid target, let's load that script instead
if (! empty($_REQUEST['target'])
&& is_string($_REQUEST['target'])
&& ! preg_match('/^index/', $_REQUEST['target'])
&& ! in_array($_REQUEST['target'], $target_blacklist)
&& in_array($_REQUEST['target'], $goto_whitelist)
) {
include $_REQUEST['target'];
exit;
}

if (isset($_REQUEST['ajax_request']) && ! empty($_REQUEST['access_time'])) {
exit;
}

// See FAQ 1.34
if (! empty($_REQUEST['db'])) {
$page = null;
if (! empty($_REQUEST['table'])) {
$page = PMA_Util::getScriptNameForOption(
$GLOBALS['cfg']['DefaultTabTable'], 'table'
);
} else {
$page = PMA_Util::getScriptNameForOption(
$GLOBALS['cfg']['DefaultTabDatabase'], 'database'
);
}
include $page;
exit;
}

/**

  • Check if it is an ajax request to reload the recent tables list.
    */
    require_once 'libraries/RecentFavoriteTable.class.php';
    if ($GLOBALS['is_ajax_request'] && ! empty($_REQUEST['recent_table'])) {
    $response = PMA_Response::getInstance();
    $response->addJSON(
    'list',
    PMA_RecentFavoriteTable::getInstance('recent')->getHtmlList()
    );
    exit;
    }

if ($GLOBALS['PMA_Config']->isGitRevision()) {
if (isset($_REQUEST['git_revision']) && $GLOBALS['is_ajax_request'] == true) {
PMA_printGitRevision();
exit;
}
echo '

';
}

// Handles some variables that may have been sent by the calling script
$GLOBALS['db'] = '';
$GLOBALS['table'] = '';
$show_query = '1';

// Any message to display?
if (! empty($message)) {
echo PMA_Util::getMessage($message);
unset($message);
}

$common_url_query = PMA_URL_getCommon();
$mysql_cur_user_and_host = '';

// when $server > 0, a server has been chosen so we can display
// all MySQL-related information
if ($server > 0) {
include 'libraries/server_common.inc.php';
include 'libraries/StorageEngine.class.php';

// Use the verbose name of the server instead of the hostname
// if a value is set
$server_info = '';
if (! empty($cfg['Server']['verbose'])) {
    $server_info .= htmlspecialchars($cfg['Server']['verbose']);
    if ($GLOBALS['cfg']['ShowServerInfo']) {
        $server_info .= ' (';
    }
}
if ($GLOBALS['cfg']['ShowServerInfo'] || empty($cfg['Server']['verbose'])) {
    $server_info .= $GLOBALS['dbi']->getHostInfo();
}
if (! empty($cfg['Server']['verbose']) && $GLOBALS['cfg']['ShowServerInfo']) {
    $server_info .= ')';
}
$mysql_cur_user_and_host = $GLOBALS['dbi']->fetchValue('SELECT USER();');

// should we add the port info here?
$short_server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
            ? $GLOBALS['cfg']['Server']['verbose']
            : $GLOBALS['cfg']['Server']['host']);

}

echo '

' . "\n";
// Anchor for favorite tables synchronization.
echo PMA_RecentFavoriteTable::getInstance('favorite')->getHtmlSyncFavoriteTables();
echo '
';
if ($server > 0 || count($cfg['Servers']) > 1
) {
if ($cfg['DBG']['demo']) {
echo '
';
echo '

' . __('phpMyAdmin Demo Server') . '

';
echo '

';
printf(
__(
'You are using the demo server. You can do anything here, but '
. 'please do not change root, debian-sys-maint and pma users. '
. 'More information is available at %s.'
),
'demo.phpmyadmin.net'
);
echo '

';
echo '
';
}
echo '
';
echo '

' . __('General settings') . '

';
echo '
    ';

    /**
     * Displays the MySQL servers choice form
     */
    if ($cfg['ServerDefault'] == 0
        || (! $cfg['NavigationDisplayServers']
        && (count($cfg['Servers']) > 1
        || ($server == 0 && count($cfg['Servers']) == 1)))
    ) {
        echo '<li id="li_select_server" class="no_bullets" >';
        include_once 'libraries/select_server.lib.php';
        echo PMA_Util::getImage('s_host.png') . " " . PMA_selectServer(true, true);
        echo '</li>';
    }
    
    /**
     * Displays the mysql server related links
     */
    if ($server > 0 && ! PMA_DRIZZLE) {
        include_once 'libraries/check_user_privileges.lib.php';
    
        // Logout for advanced authentication
        if ($cfg['Server']['auth_type'] != 'config') {
            if ($cfg['ShowChgPassword']) {
                $conditional_class = 'ajax';
                PMA_printListItem(
                    PMA_Util::getImage('s_passwd.png') . "&nbsp;" . __('Change password'),
                    'li_change_password',
                    'user_password.php' . $common_url_query,
                    null,
                    null,
                    'change_password_anchor',
                    "no_bullets",
                    $conditional_class
                );
            }
        } // end if
        echo '    <li id="li_select_mysql_collation" class="no_bullets" >';
        echo '        <form method="post" action="index.php">' . "\n"
           . PMA_URL_getHiddenInputs(null, null, 4, 'collation_connection')
           . '            <label for="select_collation_connection">' . "\n"
           . '                ' . PMA_Util::getImage('s_asci.png') . "&nbsp;"
                               . __('Server connection collation') . "\n"
           // put the doc link in the form so that it appears on the same line
           . PMA_Util::showMySQLDocu('Charset-connection')
           . ': ' .  "\n"
           . '            </label>' . "\n"
    
           . PMA_generateCharsetDropdownBox(
               PMA_CSDROPDOWN_COLLATION,
               'collation_connection',
               'select_collation_connection',
               $collation_connection,
               true,
               true
           )
           . '        </form>' . "\n"
           . '    </li>' . "\n";
    } // end of if ($server > 0 && !PMA_DRIZZLE)
    echo '</ul>';
    echo '</div>';
    

    }

    echo '

    ';
    echo '

    ' . __('Appearance settings') . '

    ';
    echo '
      ';

      // Displays language selection combo
      if (empty($cfg['Lang']) && count($GLOBALS['available_languages']) > 1) {
      echo '

    • ';
      include_once 'libraries/display_select_lang.lib.php';
      echo PMA_Util::getImage('s_lang.png') . " " . PMA_getLanguageSelectorHtml();
      echo '
    • ';
      }

      // ThemeManager if available

      if ($GLOBALS['cfg']['ThemeManager']) {
      echo '

    • ';
      echo PMA_Util::getImage('s_theme.png') . " "
      . $_SESSION['PMA_Theme_Manager']->getHtmlSelectBox();
      echo '
    • ';
      }
      echo '
    • ';
      echo PMA_Config::getFontsizeForm();
      echo '
    • ';

      echo '

    ';

    // User preferences

    if ($server > 0) {
    echo '

      ';
      PMA_printListItem(
      PMA_Util::getImage('b_tblops.png') . " " . __('More settings'),
      'li_user_preferences',
      'prefs_manage.php' . $common_url_query,
      null,
      null,
      null,
      "no_bullets"
      );
      echo '
    ';
    }

    echo '

    ';

    echo '

';
echo '
';

if ($server > 0 && $GLOBALS['cfg']['ShowServerInfo']) {

echo '<div class="group">';
echo '<h2>' . __('Database server') . '</h2>';
echo '<ul>' . "\n";
PMA_printListItem(
    __('Server:') . ' ' . $server_info,
    'li_server_info'
);
PMA_printListItem(
    __('Server type:') . ' ' . PMA_Util::getServerType(),
    'li_server_type'
);
PMA_printListItem(
    __('Server version:')
    . ' '
    . PMA_MYSQL_STR_VERSION . ' - ' . PMA_MYSQL_VERSION_COMMENT,
    'li_server_version'
);
PMA_printListItem(
    __('Protocol version:') . ' ' . $GLOBALS['dbi']->getProtoInfo(),
    'li_mysql_proto'
);
PMA_printListItem(
    __('User:') . ' ' . htmlspecialchars($mysql_cur_user_and_host),
    'li_user_info'
);

echo '    <li id="li_select_mysql_charset">';
echo '        ' . __('Server charset:') . ' '
   . '        <span lang="en" dir="ltr">';
if (! PMA_DRIZZLE) {
    echo '           '
        . $mysql_charsets_descriptions[$mysql_charset_map['utf-8']];
}
echo '           (' . $mysql_charset_map['utf-8'] . ')'
   . '        </span>'
   . '    </li>'
   . '  </ul>'
   . ' </div>';

}

if ($GLOBALS['cfg']['ShowServerInfo'] || $GLOBALS['cfg']['ShowPhpInfo']) {
echo '

';
echo '

' . __('Web server') . '

';
echo '
    ';
    if ($GLOBALS['cfg']['ShowServerInfo']) {
    PMA_printListItem($_SERVER['SERVER_SOFTWARE'], 'li_web_server_software');

        if ($server > 0) {
            $client_version_str = $GLOBALS['dbi']->getClientInfo();
            if (preg_match('#\d+\.\d+\.\d+#', $client_version_str)) {
                $client_version_str = 'libmysql - ' . $client_version_str;
            }
            PMA_printListItem(
                __('Database client version:') . ' ' . $client_version_str,
                'li_mysql_client_version'
            );
    
            $php_ext_string = __('PHP extension:') . ' ';
            if (PMA_DatabaseInterface::checkDbExtension('mysqli')) {
                $extension = 'mysqli';
            } else {
                $extension = 'mysql';
            }
            $php_ext_string  .= $extension . ' '
                . PMA_Util::showPHPDocu('book.' . $extension . '.php');
    
            PMA_printListItem(
                $php_ext_string,
                'li_used_php_extension'
            );
    
            $php_version_string = __('PHP version:') . ' ' . phpversion();
    
            PMA_printListItem(
                $php_version_string,
                'li_used_php_version'
            );
        }
    }
    
    if ($cfg['ShowPhpInfo']) {
        PMA_printListItem(
            __('Show PHP information'),
            'li_phpinfo',
            'phpinfo.php' . $common_url_query,
            null,
            '_blank'
        );
    }
    echo '  </ul>';
    echo ' </div>';
    

    }

    echo '

    ';
    echo '

    phpMyAdmin

    ';
    echo '
      ';
      $class = null;
      // We rely on CSP to allow access to http://www.phpmyadmin.net, but IE lacks
      // support here and does not allow request to http once using https.
      if ($GLOBALS['cfg']['VersionCheck']
      && (! $GLOBALS['PMA_Config']->get('is_https') || PMA_USR_BROWSER_AGENT != 'IE')
      ) {
      $class = 'jsversioncheck';
      }
      PMA_printListItem(
      __('Version information:') . ' ' . PMA_VERSION . '',
      'li_pma_version',
      null,
      null,
      null,
      null,
      $class
      );
      PMA_printListItem(
      __('Documentation'),
      'li_pma_docs',
      PMA_Util::getDocuLink('index'),
      null,
      '_blank'
      );
      PMA_printListItem(
      __('Wiki'),
      'li_pma_wiki',
      PMA_linkURL('http://wiki.phpmyadmin.net/'),
      null,
      '_blank'
      );

      // does not work if no target specified, don't know why
      PMA_printListItem(
      __('Official Homepage'),
      'li_pma_homepage',
      PMA_linkURL('http://www.phpMyAdmin.net/'),
      null,
      '_blank'
      );
      PMA_printListItem(
      __('Contribute'),
      'li_pma_contribute',
      PMA_linkURL('https://www.phpmyadmin.net/contribute/'),
      null,
      '_blank'
      );
      PMA_printListItem(
      __('Get support'),
      'li_pma_support',
      PMA_linkURL('https://www.phpmyadmin.net/support/'),
      null,
      '_blank'
      );
      PMA_printListItem(
      __('List of changes'),
      'li_pma_changes',
      'changelog.php' . PMA_URL_getCommon(),
      null,
      '_blank'
      );
      echo '

    ';
    echo '
    ';

    echo '

';

echo '

';

/**

  • Warning if using the default MySQL privileged account
    */
    if ($server != 0
    && $cfg['Server']['user'] == 'root'
    && $cfg['Server']['password'] == ''
    ) {
    trigger_error(
    __(
    'You are connected as \'root\' with no password, which'
    . ' corresponds to the default MySQL privileged account.'
    . ' Your MySQL server is running with this default, is open to'
    . ' intrusion, and you really should fix this security hole by'
    . ' setting a password for user \'root\'.'
    ),
    E_USER_WARNING
    );
    }

/**

  • As we try to handle charsets by ourself, mbstring overloads just
  • break it, see bug 1063821.
    */
    if (@extension_loaded('mbstring') && @ini_get('mbstring.func_overload') > 1) {
    trigger_error(
    __(
    'You have enabled mbstring.func_overload in your PHP '
    . 'configuration. This option is incompatible with phpMyAdmin '
    . 'and might cause some data to be corrupted!'
    ),
    E_USER_WARNING
    );
    }

/**

  • mbstring is used for handling multibytes inside parser, so it is good
  • to tell user something might be broken without it, see bug #1063149.
    */
    if (! @extension_loaded('mbstring')) {
    trigger_error(
    __(
    'The mbstring PHP extension was not found and you seem to be using'
    . ' a multibyte charset. Without the mbstring extension phpMyAdmin'
    . ' is unable to split strings correctly and it may result in'
    . ' unexpected results.'
    ),
    E_USER_WARNING
    );
    }

if ($cfg['LoginCookieValidityDisableWarning'] == false) {
/**
* Check whether session.gc_maxlifetime limits session validity.
*/
$gc_time = (int)@ini_get('session.gc_maxlifetime');
if ($gc_time < $GLOBALS['cfg']['LoginCookieValidity'] ) {
trigger_error(
__(
'Your PHP parameter [a@http://php.net/manual/en/session.' .
'configuration.php#ini.session.gc-maxlifetime@_blank]session.' .
'gc_maxlifetime[/a] is lower than cookie validity configured ' .
'in phpMyAdmin, because of this, your login might expire sooner ' .
'than configured in phpMyAdmin.'
),
E_USER_WARNING
);
}
}

/**

  • Check whether LoginCookieValidity is limited by LoginCookieStore.
    */
    if ($GLOBALS['cfg']['LoginCookieStore'] != 0
    && $GLOBALS['cfg']['LoginCookieStore'] < $GLOBALS['cfg']['LoginCookieValidity']
    ) {
    trigger_error(
    __(
    'Login cookie store is lower than cookie validity configured in ' .
    'phpMyAdmin, because of this, your login will expire sooner than ' .
    'configured in phpMyAdmin.'
    ),
    E_USER_WARNING
    );
    }

/**

  • Check if user does not have defined blowfish secret and it is being used.
    */
    if (! empty($_SESSION['encryption_key'])
    && empty($GLOBALS['cfg']['blowfish_secret'])
    ) {
    trigger_error(
    __(
    'The configuration file now needs a secret passphrase (blowfish_secret).'
    ),
    E_USER_WARNING
    );
    }

/**

  • Check for existence of config directory which should not exist in
  • production environment.
    */
    if (file_exists('config')) {
    trigger_error(
    __(
    'Directory [code]config[/code], which is used by the setup script, ' .
    'still exists in your phpMyAdmin directory. It is strongly ' .
    'recommended to remove it once phpMyAdmin has been configured. ' .
    'Otherwise the security of your server may be compromised by ' .
    'unauthorized people downloading your configuration.'
    ),
    E_USER_WARNING
    );
    }

if ($server > 0) {
$cfgRelation = PMA_getRelationsParam();
if (! $cfgRelation['allworks']
&& $cfg['PmaNoRelation_DisableWarning'] == false
) {
$msg_text = __(
'The phpMyAdmin configuration storage is not completely '
. 'configured, some extended features have been deactivated. '
. '%sFind out why%s. '
);
if ($cfg['ZeroConf'] == true) {
$msg_text .= '
      ' .
__(
'Or alternately go to \'Operations\' tab of any database '
. 'to set it up there.'
);
}
$msg = PMA_Message::notice($msg_text);
$msg->addParam(
'',
false
);
$msg->addParam('
', false);
/* Show error if user has configured something, notice elsewhere */
if (!empty($cfg['Servers'][$server]['pmadb'])) {
$msg->isError(true);
}
$msg->display();
} // end if
}

/**

  • Warning about different MySQL library and server version
  • (a difference on the third digit does not count).
  • If someday there is a constant that we can check about mysqlnd,
  • we can use it instead of strpos().
  • If no default server is set, $GLOBALS['dbi'] is not defined yet.
  • Drizzle can speak MySQL protocol, so don't warn about version mismatch for
  • Drizzle servers.
  • We also do not warn if MariaDB is detected, as it has its own version
  • numbering.
    /
    if (isset($GLOBALS['dbi'])
    && !PMA_DRIZZLE
    && $cfg['ServerLibraryDifference_DisableWarning'] == false
    ) {
    /
    * @var PMA_String $pmaString */
    $pmaString = $GLOBALS['PMA_String'];
$_client_info = $GLOBALS['dbi']->getClientInfo();
if ($server > 0
    && /*overload*/mb_strpos($_client_info, 'mysqlnd') === false
    && /*overload*/mb_strpos(PMA_MYSQL_STR_VERSION, 'MariaDB') === false
    && substr(PMA_MYSQL_CLIENT_API, 0, 3) != substr(
        PMA_MYSQL_INT_VERSION, 0, 3
    )
) {
    trigger_error(
        PMA_sanitize(
            sprintf(
                __(
                    'Your PHP MySQL library version %s differs from your ' .
                    'MySQL server version %s. This may cause unpredictable ' .
                    'behavior.'
                ),
                $_client_info,
                substr(
                    PMA_MYSQL_STR_VERSION,
                    0,
                    strpos(PMA_MYSQL_STR_VERSION . '-', '-')
                )
            )
        ),
        E_USER_NOTICE
    );
}
unset($_client_info);

}

/**

  • Warning about Suhosin only if its simulation mode is not enabled
    */
    if ($cfg['SuhosinDisableWarning'] == false
    && @ini_get('suhosin.request.max_value_length')
    && @ini_get('suhosin.simulation') == '0'
    ) {
    trigger_error(
    sprintf(
    __(
    'Server running with Suhosin. Please refer to %sdocumentation%s ' .
    'for possible issues.'
    ),
    '[doc@faq1-38]',
    '[/doc]'
    ),
    E_USER_WARNING
    );
    }

/**

  • Warning about incomplete translations.
    *
  • The data file is created while creating release by ./scripts/remove-incomplete-mo
    /
    if (file_exists('libraries/language_stats.inc.php')) {
    include 'libraries/language_stats.inc.php';
    /


    • This message is intentionally not translated, because we're

    • handling incomplete translations here and focus on english

    • speaking users.

      */

      if (isset($GLOBALS['language_stats'][$lang])

      && $GLOBALS['language_stats'][$lang] < $cfg['TranslationWarningThreshold']

      ) {

      trigger_error(

      'You are using an incomplete translation, please help to make it '

      . 'better by [a@https://www.phpmyadmin.net/translate/'

      . '@_blank]contributing[/a].',

      E_USER_NOTICE

      );

      }

      }

/**

  • prints list item for main page
    *
  • @param string $name displayed text
  • @param string $listId id, used for css styles
  • @param string $url make item as link with $url as target
  • @param string $mysql_help_page display a link to MySQL's manual
  • @param string $target special target for $url
  • @param string $a_id id for the anchor,
  • used for jQuery to hook in functions
  • @param string $class class for the li element
  • @param string $a_class class for the anchor element
    *
  • @return void
    */
    function PMA_printListItem($name, $listId = null, $url = null,
    $mysql_help_page = null, $target = null, $a_id = null, $class = null,
    $a_class = null
    ) {
    echo PMA\Template::get('list/item')
    ->render(
    array(
    'content' => $name,
    'id' => $listId,
    'class' => $class,
    'url' => array(
    'href' => $url,
    'target' => $target,
    'id' => $a_id,
    'class' => $a_class,
    ),
    'mysql_help_page' => $mysql_help_page,
    )
    );
    }

I was facing the same issue on Ubuntu16.04
then It solved

$ sudo apt install libapache2-mod-php7.0
...
...
Creating config file /etc/php/7.0/apache2/php.ini with new version
Module mpm_event disabled.
Enabling module mpm_prefork.
apache2_switch_mpm Switch to prefork
apache2_invoke: Enable module php7.0

This is my all installed list depending on php and mysql and apache

sudo apt install php7.0
sudo apt install php7.0-cgi
sudo apt install php7.0-gd
sudo apt install php7.0-mysql
sudo apt install mysql-server
sudo apt install phpmyadmin
sudo apt install libapache2-mod-php7.0

I had the same problem on my Arch Linux system but found a simple solution: Enable compressed files.

  • Check the php.ini file at /etc/php/php.ini
  • Enable compressed files by uncommenting the lines that say:

    • ;extension=bz2.so

    • ;extension=zip.so

Solution found: archWiki/phpMyAdmin

/**

  • forms frameset
    *
  • @uses libraries/common.lib.php global fnctions
  • @uses libraries/relation.lib.php table relations
  • @uses $GLOBALS['strNoFrames']
  • @uses $GLOBALS['cfg']['QueryHistoryDB']
  • @uses $GLOBALS['cfg']['Server']['user']
  • @uses $GLOBALS['cfg']['DefaultTabServer'] as src for the mainframe
  • @uses $GLOBALS['cfg']['DefaultTabDatabase'] as src for the mainframe
  • @uses $GLOBALS['cfg']['NaviWidth'] for navi frame width
  • @uses $GLOBALS['collation_connection'] from $_REQUEST (grab_globals.lib.php)
  • or common.lib.php
  • @uses $GLOBALS['available_languages'] from common.lib.php (select_lang.lib.php)
  • @uses $GLOBALS['db']
  • @uses $GLOBALS['charset']
  • @uses $GLOBALS['lang']
  • @uses $GLOBALS['text_dir']
  • @uses $_ENV['HTTP_HOST']
  • @uses PMA_getRelationsParam()
  • @uses PMA_purgeHistory()
  • @uses PMA_generate_common_url()
  • @uses PMA_VERSION
  • @uses session_write_close()
  • @uses time()
  • @uses PMA_getenv()
  • @uses header() to send charset
    */

I ask to lock this issue and make new tracker for this issue.
These what help me:

  1. php showing source code in localhost
  2. Where is the Apache configuration located on Linux Mint?

Once I typed
service apache2 restart
(restarts the apache2 server), phpmyadmin was available.

Tried everything above with additional a2enmod php7.0
Followed by service apache2 restart
I was still getting the php code in my browser. Something struck me and I tried to open phpmyadmin on a private window and voila it was working. :D I am not exactly sure what worked for me.

@tzatter Solution worked for me!! THanks

Hi,
I know this is an old post, but I am having the same issue described above. I am attempting to install phpmyadmin on my Windows 10 computer. I have installed Apache2.4, PHP7, and have put the phpmyadmin files in the Apache htdocs folder. When I go to http://localhost/phpmyadmin all of the actual PHP code shows up instead of the actual login page. Any and all help is appreciated!
Thanks!

TL;DR
@SailTheUniverse Did you check php is working and configured as expected ?
Try a php hello world file first.

HI,
I just used this code for The HelloWorld.php file:


PHP Test


Hello World

'; ?>

Then the webpage just displayed this:
Hello World
'; ?>

Thanks,
Cooper

@SailTheUniverse You test file should be :

<html>
<title>PHP Test</title>
<?php
echo "Hello world";
?>
<br />
<?
echo "Hello world with shorttags";
?>
</html>

For me it looks like you did not configure apache to send php files to php cgi.

Hi,
So I changed to code in HelloWorld.php to what you said above, and it displayed a blank page.
How would I go about configuring Apache to send php files to php cgi?

Thanks,
Cooper

@SailTheUniverse Maybe in the logs you will find the error. Try : http://www.orbitale.io/2017/11/11/apache-and-php-fpm-in-windows.html (should help). Or install nginx instead :+1:

not sure if this problem had been resolved. I have encounter the same problems and had followed all of the above but still did not work for me.
However, i came across an article sometime ago and it was mentioned that if you placed the phpmyadmin or any other php files in your personal "public_html" folder, you will have to first update the php7.0.conf in /etc/apache2/mods-enabled/ and comment out the last portion from ...'
then restart apache2 services. It should work......it works for me.

work for me thanks.
mint 19

I was facing the same issue on Ubuntu16.04
then It solved

$ sudo apt install libapache2-mod-php7.0
...
...
Creating config file /etc/php/7.0/apache2/php.ini with new version
Module mpm_event disabled.
Enabling module mpm_prefork.
apache2_switch_mpm Switch to prefork
apache2_invoke: Enable module php7.0

This is my all installed list depending on php and mysql and apache

sudo apt install php7.0
sudo apt install php7.0-cgi
sudo apt install php7.0-gd
sudo apt install php7.0-mysql
sudo apt install mysql-server
sudo apt install phpmyadmin
sudo apt install libapache2-mod-php7.0

Work for me after installing all that dependencies.

im use PHP 7.2.12-1+ubuntu16.04.1+deb.sury.org+1 (cli)

if complete, enabled the
a2enmod proxy_fcgi setenvif
and
a2enconf php7.2-fpm
after that, restart your apache
service apache2 restart
everything is gonna be OKAY!

_Apache / phpmyadmin - Showing PHP code Issue fixed_

1. Opened php5.6 conf or php7.x conf

following command:

$ sudo vi /etc/apache2/mods-enabled/php5.6.conf

2. Commented following lines

<IfModule mod_userdir.c>
<Directory /home/*/public_html>
php_admin_flag engine Off
</Directory>
</IfModule>

3. Restarted the server

$ sudo service apache2 restart

4. Enjoy :)

Hi all - many thanks for all of the advice listed here already! I was having a similar error (my browser only displaying raw php) - in the end what worked for me was navigating to /etc/php/7.0/apache2 and editing the php.ini file:
sudo nano -c php.ini

I then found this section (jump to line 694!) and uncommented the appropriate line for unix (see in bold):
;;;;;;;;;;;;;;;;;;;;;;;;;
; Paths and Directories ;
;;;;;;;;;;;;;;;;;;;;;;;;;

; UNIX: "/path1:/path2"
include_path = ".:/usr/share/php"
;
; Windows: "\path1;\path2"
;include_path = ".;c:\php\includes"

Upon restarting my browser at localhost/phpmyadmin I was then able to view the proper GUI :).
For reference I am running Linux Mint 18.02 which is on 16.04.1-Ubuntu.

I was facing the same issue on Ubuntu16.04
then It solved

$ sudo apt install libapache2-mod-php7.0
...
...
Creating config file /etc/php/7.0/apache2/php.ini with new version
Module mpm_event disabled.
Enabling module mpm_prefork.
apache2_switch_mpm Switch to prefork
apache2_invoke: Enable module php7.0

This is my all installed list depending on php and mysql and apache

` sudo apt install php7.0 sudo apt install php7.0-cgi sudo apt install php7.0-gd sudo apt install php7.0-mysql sudo apt install mysql-server sudo apt install phpmyadmin sudo apt install libapache2-mod-php7.0

`This really works . A very helpfull content. My problem is solved by following your guide. God bless You

https://localhosts.mobi/phpmyadmin here you can find solutions about phpmayadmin installation and various problems.

Was this page helpful?
0 / 5 - 0 ratings