How to enable openssl in php

高洛峰
Release: 2023-03-04 14:18:02
Original
1589 people have browsed it

How to enable openssl in php. In most cases, openssl is not enabled. To enable it, you need to make simple settings.

How to enable it in windows:

1: First check php Does extension=php_openssl.dll exist in .ini? If it exists, remove the preceding comment character ';'. 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 uses my host as an example to explain how to add PHP to openssl module support.
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.

# 下载到/var/www/php5目录下
cd /var/www/php5
wget http://mirrors.sohu.com/php/php-5.2.14.tar.gz
# 解压
tar zxvf php-5.2.14.tar.gz
# 进入PHP的openssl扩展模块目录
cd php-5.2.14/ext/openssl/
/var/www/php5/bin/phpize # 这里为你自己的phpize路径,如果找不到,使用whereis phpize查找
# 执行后,发现错误 无法找到config.m4 ,config0.m4就是config.m4。直接重命名
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
# 安装完成后,会返回一个.so文件(openssl.so)的目录。在此目录下把openssl.so 文件拷贝到你在php.ini 中指定的 extension_dir 下(在php.ini文件中查找:extension_dir =),我这里的目录是 var/www/php5/lib/php/extensions
# 编辑php.ini文件,在文件最后添加
extension=openssl.so
# 重启Apache即可
/usr/local/apache2/bin/apachectl restart
Copy after login

Okay, openssl support is now successfully added.

For more articles related to how to open openssl in PHP, please pay attention to 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
Popular Tutorials
More>
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!