PDOException: PHP was built without openssl extension, can't send password encrypted

After running Yii2 v. (advanced template) on xampp 7.2.9 (PHP v. 7.2.9) for months, suddenly, yesterday, I got the following error message:

SQLSTATE[HY000] [1045] Access denied for user ‘admin-lel’@‘localhost’ (using password: YES)
↳Caused by: PDOException
SQLSTATE[HY000] [1045] Access denied for user ‘admin-lel’@‘localhost’ (using password: YES)
in D:\xampp\htdocs\public_html\vendor\yiisoft\yii2\db\Connection.php at line 687
↳Caused by: PDOException
PDO::__construct(): PHP was built without openssl extension, can’t send password encrypted
in D:\xampp\htdocs\public_html\vendor\yiisoft\yii2\db\Connection.php at line 687

I wasn’t doing anything remotely related to security. Just modifying some css files, actually. Not only did this suddenly start out of the blue, but it only appears to affect Yii2. Composer, for instance, works just fine despite the fact that there are numerous postings on the Web about such problems with it.

in php.ini openssl and php_openssl is enabled, and phpinfo() shows openssl fully enabled and functioning with no problems.

I’ve tried everything that I can think of, and nothing seems to remedy the problem. At this point, I’m completely stymied. I can’t do any development work at all.

If anybody can give me any suggestions, they will be most appreciated. At this point, if anyone can tell me how to completely disable security in Yiii2, that would, at least, be a temporary solution.

It should be safe to assume that something changed, even if you don’t know what. Perhaps the system was upgraded/updated? Can you think of anything that changed? Is it your own server, or does someone else maintain it?

What’s the connection string of that database connection? Also, how are you running the phpinfo()? There’s separate php.ini settings for CLI and web. And finally, how are you running PHP (FPM, Apache module, etc)?

1 Like

Yes, I’ve been trying to figure out what could have changed myself. Just can’t come up with anything. Here’s my answers to your questions:

  • The server is my own, a localhost, running on the D: drive of my Windows 10 Pro machine. I maintain the server and have total control over it.
  • I am running phpinfo in a file that just has phpinfo(); between opening and closing php tags.
  • It’s an XAMPP installation, so PHP is being run as an Apache v. 2.4.34 module.
  • The connection string of the database connection hasn’t changed. It looks like this:
    ‘db’ => [
    ‘class’ => ‘yii\db\Connection’,
    ‘dsn’ => ‘mysql:host=localhost;dbname=memehope;port=3308’,
    ‘username’ => ‘admin-lel’,
    ‘password’ => ‘xxxxxx’,
    ‘charset’ => ‘utf8’,

Don’t be alarmed by the non-standard MySQL port. I’ve got MariaDB running on 3306, and I need to have this Web site running with MySQL because that’s it’s ultimate destination. Besides that, It’s worked quite well like that for over two years.

Thinking back to what could have changed. It is a Windows machine which means that Windows downloads and installs updates in the background. There were ten updates installed yesterday, including three security updates for Office. That shouldn’t affect Apache/PHP, but with things getting ever more intertwined, who knows? If it is, indeed, a Windows update causing this, brace yourself because it will effect a lot of people.

I take it this means that you are accessing this file through the web browser, so it executes under Apache just like the rest of your site?

That’s correct.

It would be easier to throw suggestions back and forth if you were on the IRC. There’s so any questions, so few answers.

This is a really peculiar problem. Still not resolved, even though we found a workaround.

  • Verified PHP has openssl enabled, it does.
  • Created a minimal code snippet that reproduces the problem, just one line creating a PDO instance with the same DSN as the Yii application uses.
  • Verified the problem happens in the minimal code snippet too, it does.
  • Noticed that when using the root user for authentication to the database, it works fine, but when using the “regular” user for the app we get the error.
  • Tried the same in the Yii app, and root works there too, but not regular user, so the minimal test case and the Yii app show the same symptoms, which is good.
  • Tried changing/resetting the password for the regular user, verified it’s permissions tothe database, and also created a completely new user with permissions to the database, but none of these made it work, still getting the original error when not using the root user for authentication.

At this point we concluded that running a memtest on the system was a good idea, just in case.