PHP opens openssl method

不言
Release: 2023-03-24 07:08:01
Original
7387 people have browsed it

The content of this article is about the method of opening openssl in PHP. It has certain reference value. Now I share it with everyone. Friends in need can refer to it.

When debugging the program today, I was prompted to enable openssl. , it turns out that in most cases openssl is not turned on. To enable it, you need to make simple settings

php method to turn on openssl. In most cases, openssl is not turned on. To enable it, you need to make simple settings. Settings

How to open under windows:

#1: First check whether extension=php_openssl.dll in php.ini exists. If it exists, remove the previous comment. ';', if this line does not exist, add extension=php_openssl.dll.
2: Let’s talk about the php folder: php_openssl.dll, ssleay32.dll, libeay32.dll 3 files are copied to the WINDOWS\system32\ folder.
3: Restart apache or iis (iisreset /restart)

At this point, the openssl function is enabled.

How to open it under Linux:

I am using the cloud host of Jinshang Data, PHP version: 5.2.14
The following plan is based on my host Take an example to explain adding openssl module support to PHP.
Some answers on the Internet say to recompile PHP, add configure parameters, and increase openssl support. Here is a method that does not require recompiling.
It is best if the PHP installation package file exists on the server. If it has been deleted, download the PHP installation file with the same version as the version displayed on the phpinfo page. Here is php-5.2.14.tar.gz
It is recommended to go to Sohu Mirror Download, NetEase mirror not found. The address is: http://mirrors.sohu.com/php/
Use the ssh tool to connect to the host.


Copy codeThe code is as follows:


# Download to the /var/www/php5 directory
cd /var/www/php5
wget http://mirrors.sohu.com/php/php-5.2.14.tar.gz
# Unzip
tar zxvf php-5.2.14.tar.gz
# Enter PHP's openssl extension module directory
cd php-5.2.14/ext/openssl/
/var/www/php5/bin/phpize # Here is your own phpize path, if you can't find it Arrive, use whereis phpize to find
#. After execution, an error is found that config.m4 cannot be found. config0.m4 is config.m4. Directly rename
mv config0.m4 config.m4
/var/www/php5/bin/phpize
./configure --with-openssl --with-php-config=/var/www/ php5/bin/php-config
make
make install
# After the installation is completed, a directory of .so files (openssl.so) will be returned. Copy the openssl.so file in this directory to the extension_dir you specified in php.ini (find: extension_dir = in the php.ini file). My directory here is var/www/php5/lib/php/extensions
# Edit the php.ini file and add
extension=openssl.so
# at the end of the file to restart Apache
/usr/local/apache2/bin/apachectl restart

Okay, openssl support is now successfully added.

Related recommendations:

openssl extension to implement public key encryption function

php does not compile and install openssl extension implementation

The above is the detailed content of PHP opens openssl method. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!