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 whether extension=php_openssl.dll in php.ini Exists. 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_openssl.dll, ssleay32.dll, libeay32.dll 3 files in the php folder and copy them to the WINDOWSsystem32 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 openssl module support to PHP.
Some answers online say to recompile PHP, add configure parameters, and add 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 shown on the phpinfo page. Here is php-5.2.14.tar.gz
It is recommended to download it from Sohu mirror and NetEase mirror. could not find it. 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
Okay, openssl support is now successfully added.
For more articles related to how to enable openssl in PHP, please pay attention to the PHP Chinese website!