Call to undefined function Illuminate\Encryption\openssl_decrypt()

Call to undefined function Illuminate\Encryption\openssl_decrypt()

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

Call to undefined function Illuminate\Encryption\openssl_decrypt()

When you encounter a FatalThrowableError stating that Illuminate\Encryption\openssl_decrypt() is undefined, it usually signals a mismatch between your PHP runtime and the OpenSSL extension. This specific error often appears after restarting a development environment like XAMPP on Windows, particularly if the application was functioning correctly just moments before shutdown. The fact that Encrypter.php is a standard Laravel file you haven't touched confirms this isn't a code logic error but rather an environmental configuration issue.

The core of the problem lies in how PHP loads extensions versus how web servers or local runtimes initialize them. In the provided source material, the user notes that extension=php_openssl.dll is turned on. However, simply having the line in the configuration file does not guarantee the extension is loaded when Laravel attempts to use it.

On Windows systems, especially within XAMPP, the order of operations during startup can be fragile. If PHP starts before the OpenSSL DLL is successfully registered in memory, any subsequent call to openssl_* functions will trigger a "undefined function" error. This is distinct from a Linux environment where you might simply run php -m | grep openssl. On Windows, the physical loading of .dll files depends on specific paths and initialization flags that XAMPP handles differently depending on its version or update cycle.

Consider the scenario where you edit your php.ini file to uncomment extension=php_openssl.dll. If you make this change while XAMPP is running, the current PHP process will not pick up the new configuration until it restarts. However, a simple click on the "Start All" button in XAMPP Control Panel should theoretically reload the modules. The persistence of the error suggests one of two possibilities: either the OpenSSL DLL file is missing from the expected directory, or the php.ini active for your specific Laravel application (which might be different from the global XAMPP php.ini) is not actually loading that line.

To resolve this, you must verify which PHP binary is executing your code. You can do this by creating a phpinfo() file in your public folder or checking the output of php -i | grep openssl. If OpenSSL does not appear in the loaded modules list, the extension is definitely not active despite the configuration line.

The most common pitfall on Windows with XAMPP involves the path to the OpenSSL DLL. The php.ini file often contains a line like:
extension="C:/xampp/php/external/openssl.dll" (or similar). If this path points to a directory that doesn't exist, or if the filename inside the quotes differs from the actual .dll file present in your ext folder, PHP will fail silently to load the extension until you restart Apache and MySQL completely.

Sometimes, the issue arises from a dependency conflict. OpenSSL requires certain runtime libraries (VC runtime) to be installed on the OS level. If your system is missing the Visual C++ Redistributable that matches the compiler version used to build PHP and OpenSSL in XAMPP, the DLL might exist but fail to load due to missing dependencies.

Another potential cause involves Laravel's cache configuration. Laravel stores encryption keys in config/services.php. While this doesn't directly cause the "undefined function" error, it's worth noting that if you recently regenerated your application key or updated PHP versions without regenerating the key properly, you might face subsequent integrity issues once the extension is fixed.

If you are switching between different XAMPP versions or updating PHP via package managers like Chocolatey or Scoop alongside XAMPP, you might end up with a hybrid setup where php.ini references a DLL from one version but the executable runs another. Ensure that the extension=php_openssl.dll directive is commented out if you are unsure which configuration file is active, then uncomment it and restart all services cleanly.

Once the extension loads correctly, Laravel's encryption service will resume normal operation, allowing openssl_decrypt to function as intended without throwing a fatal exception.

Our network