Enable OpenSSL in PHP: Quick Guide
To run OpenSSL functions in PHP, the OpenSSL extension needs to be enabled in the PHP configuration. You can check if the OpenSSL extension is enabled by following these steps.
- Create a PHP file and add the following code to it:
<?php
phpinfo();
?>
- Accessing the PHP file in a browser displays detailed PHP information.
- Search for the section on OpenSSL extension in the information. If you find relevant information, it means OpenSSL is enabled, and you can call OpenSSL functions in PHP. If not found, you need to enable the OpenSSL extension.
Enabling the OpenSSL extension depends on your PHP environment. Typically, you can enable the OpenSSL extension by modifying the php.ini file. Locate the following line in the php.ini file and make sure there is no comment symbol (;) in front of it.
extension=openssl
Save the php.ini file and restart your web server, then you will be able to use OpenSSL functions in PHP. You can find detailed information and usage examples of OpenSSL functions in the official PHP documentation.