0

im using ubuntu 16.04 LTS development branch. I have recently installed mysql, apache2 and phpmyadmin. When i enter localhost/phpmyadmin in address bar in firefox it simply show nothing while chrome gives 500 server error. When i see apache error.log it say

[Fri Jan 29 16:39:11.833839 2016] [:error] [pid 2795] [client 127.0.0.1:58438] PHP Fatal error:  require(): Failed opening required '/usr/share/php//Crypt/Random.php' (include_path='.') in /usr/share/phpmyadmin/libraries/session.inc.php on line 16

But Random.php exist in same location which error tells failed opening Im Using

  • ubuntu 16.04 development branch
  • mysql Ver 14.14 Distrib 5.6.28,
  • Apache/2.4.18 (Ubuntu)
  • PHP 5.6.17-3ubuntu1 (cli)

* please ignore grammar mistakes.

3 Answers 3

1

It looks like the Random.php from the phpseclib has changed. I did a fast fix with changing:

$_SESSION[' PMA_token '] = bin2hex(phpseclib\Crypt\Random::string(16));

on line 116 and 135 with

$_SESSION[' PMA_token '] = bin2hex(crypt_random_string(16));

in the file /usr/share/phpmyadmin/libraries/session.inc.php

This should fix it for now until the phpmyadmin devs come with a solution.

Edit 30-01-2016: The PMA devs fixed this. No need for changing the file manually.

0

user185719's answer helped me only partially, because the reported error persisted: session.inc.php was not able to include Random.php. Calling file_exists() on the Random.php always returnes false, while there are no permission issues, no safe_mode, so I don't really understand why this does not work as expected. I had to do the following workaround to get phpmyadmin work (at least for now, until guys at phpmyadmin fix the problem):

  • copy the following content of the file /usr/share/php/Crypt/Random.php into /usr/share/phpmyadmin/libraries/session.inc.php

    define('CRYPT_RANDOM_IS_WINDOWS', strtoupper(substr(PHP_OS, 0, 3)) === 'WIN');
    
    function crypt_random_string($length) {
        if (CRYPT_RANDOM_IS_WINDOWS) {
            ....
        }
    }
    

After copying the code above, user185719's answer should fix the issue. My system:

Linux Mint 17.3 Rosa
PHP 5.6.17-3
Apache 2.4.18
PhpMyadmin 4.5.4-1

4
  • You tested this on mint? can you back up the fact this will also work on Ubuntu? They are not the same.
    – Mark Kirby
    Jan 30, 2016 at 12:45
  • Yes, this was tested on Mint only. I have not tested on ubuntu. Jan 30, 2016 at 13:20
  • That is OK, just good to let people know, that comment should do fine, it may save some complaints and issuers down the line if it does not work on Ubuntu :)
    – Mark Kirby
    Jan 30, 2016 at 13:22
  • The issue has been fixed in new package. Jan 30, 2016 at 17:06
0

For some reason, phpmyadmin is not able to read Crypt/Random.php file, if placed in /usr/share/php folder. Moreover, I have tried also /usr/local/share/php5 with the same result. Finally I have copied whole Crypt folder from /usr/share/php into /usr/share/phpmyadmin/libraries/

cp -r /usr/share/php/Crypt /usr/share/phpmyadmin/libraries/

and modified /usr/share/phpmyadmin/libraries/session.inc.php to include Crypt/Random.php from there.

#require PHPSECLIB_INC_DIR . '/Crypt/Random.php';
require ("/usr/share/phpmyadmin/libraries/Crypt/Random.php");

It worked, then I have got second error, described by jancoow. His fix helped me also to solve it (two places - line 117 and 136 in my case - creating session and destroying it).

So finally the question remains - why those files cannot be accessed from /usr/share/php or /usr/local/share/php5 folders? No need to add, that all access rights are OK.

My setup is

  • Kubuntu 16.04 development

  • phpmyadmin 4.5.4.-1

  • apache2-bin 2.4.18-1ubuntu

  • libapache2-mod-php5 5.6.16+dfsg-1ubuntu1

You must log in to answer this question.