Home >Backend Development >PHP Problem >How to install openssl extension in php
How to install openssl extension in php: first find the curl extension directory in the PHP installation package; then rename the config0.m4 file; then run phpize; finally compile and install, and set the PHP configuration file php.ini. Can.
Recommended: "PHP Video Tutorial"
About openssl
OpenSSL is a Secure Socket Layer cryptographic library that includes major cryptographic algorithms, common key and certificate encapsulation management functions, and SSL protocols, and provides a rich set of applications for testing or other purposes.
Installing openssl extension
linux system article
1.CentOS system
php installation package directory:/data/php5. 6.14/
PHP installation path: /usr/local/php/
(The specific path settings in the following steps can be set according to your actual situation.)
Find the curl extension directory in the PHP installation package
cd /data/php5.6.14/ext/openssl/
Rename the config0.m4 file
mv config0.m4 config.m4
Run phpize
/usr/local/php/bin/phpize
Compile and install:
./configure --with-openssl --with-php-config=/usr/local/php/bin/php-config make && make install
This At that time, openssl.so has been generated in the /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/ directory
Set the PHP configuration file php.ini, add the following One line
extension=openssl.so
Finally restart the service and use phpinfo() to check whether the PHP-openssl extension is installed successfully.
2.Ubuntu system
Execute the following command:
sudo apt-get install openssl sudo apt-get install libcurl4-openssl-dev sudo apt-get install libssl-dev
Finally restart the service.
Windows System Chapter
1: First check whether extension=php_openssl.dll in php.ini exists. If it exists, remove the preceding comment character ';'. If this line does not exist, Then add extension=php_openssl.dll.
2: Let’s talk about the three files in the php folder: php_openssl.dll, ssleay32.dll, libeay32.dll and copy them to the WINDOWS\system32\ folder.
Note: If there is no php_openssl.dll, go to the Internet to download one. There are many php_openssl downloads. Find the php_openssl under your corresponding PHP version.
3: Restart the service
The above is the detailed content of How to install openssl extension in php. For more information, please follow other related articles on the PHP Chinese website!