PhpLiteAdmin can't find OpenSSL

Issue #371 resolved
Videogamer555 created an issue

I downloaded the Windows Binary of the latest version of PHP from here https://windows.php.net/downloads/releases/php-7.3.0-Win32-VC15-x86.zip

I also downloaded the Windows Binary of the latest version of OpenSSL from here https://bintray.com/vszakats/generic/download_file?file_path=openssl-1.1.1a-win32-mingw.zip

I downloaded an older version of Mongoose web server (free for all uses, not limited to being free only for non-commercial use like the newest version of Mongoose is) from here https://web.archive.org/web/20130911041335/https://mongoose.googlecode.com/files/mongoose-4.1.exe and yes, this web server is compatible with PHP, OpenSSL, and SQLite.

My setup has mongoose.exe, php-cgi.exe, php7ts.dll, openssl.exe, libssl-1_1.dll, libcrypto-1_1.dll, and sqlite3.dll all in the same folder, to make sure they can all "see" each other. This avoids the need for any complicated config files or ini files, to tell them where to find each other. It's the absolute simplest possible setup.

However, whenever I access phpliteadmin.php, I get the errror:

#!

Fatal error: Uncaught Error: Call to undefined function openssl_random_pseudo_bytes() in C:\Users\MYNAME\Desktop\WebServer with PHP and SQL\website\phpliteadmin\phpliteadmin.php:455 Stack trace: #0 {main} thrown in C:\Users\MYNAME\Desktop\WebServer with PHP and SQL\website\phpliteadmin\phpliteadmin.php on line 455

Then I looked at the actual PHP code that the error message mentioned:

#!php

$_SESSION['token'] = bin2hex(openssl_random_pseudo_bytes(32))

Here it is in context (the chunk of code in which the error is happening:

#!php

// don't mess with this - required for the login session
ini_set('session.cookie_httponly', '1');
session_start();
// generate CSRF token 
if (empty($_SESSION['token']))
{
    if (function_exists('mcrypt_create_iv'))
    {
        $_SESSION['token'] = bin2hex(mcrypt_create_iv(32, MCRYPT_DEV_URANDOM));
    } else {
        $_SESSION['token'] = bin2hex(openssl_random_pseudo_bytes(32));
    }
}
$token = $_SESSION['token'];
$token_html = '<input type="hidden" name="token" value="'.$token.'" />';

I have marked the priority as BLOCKER, because with this error, the PhpLiteAdmin control panel won't even load in my browser. Therefore it prevents PhpLiteAdmin from ever even starting up. Not sure if other people have reported this same problem, but for me it is an absolute blocker.

Comments (7)

  1. phpLiteAdmin repo owner

    I think this problem should not occur with the latest Development version. However, your problem is that you have not enabled the openssl php-extension. To do so, edit your php.ini (mostly in the folder where PHP is) and find this line:

    ;extension=openssl
    

    (may also end with .dll) Remove the semicolon at the beginning of the line and save the file. Then restart your webserver, in case you are running PHP as a webserver-module, or PHP-FPM, if you use that. If you are unsure, just reboot the system ;)

  2. Log in to comment