How to enable openssl in php

Source: Internet
Author: User

Openssl is disabled in php in most cases. To enable openssl, perform simple settings.

How to enable it in windows:

1: first check whether the extension = php_openssl.dll exists in php. ini. If yes, remove the comment ';'. If no such line exists, add extension = php_openssl.dll.
2. Copy the php_openssl.dll, ssleay32.dll, and libeay32.dll files in the php folder to the WINDOWS \ system32 \ folder.
3: restart apache or iis (iisreset/restart)

Now, openssl is enabled.

In Linux:

I am using the cloud host of jinshang data. PHP version: 5.2.14
The following solution uses my host as an example to explain how to add openssl module support for PHP.
Some answers on the Internet are to re-compile PHP, add the configure parameter, and add openssl support. Here is a method that does not need to be re-compiled.
If there is a PHP installation package file on the server, it is best to, if it has been deleted, go to download and phpinfo page shows the version of the same PHP installation file, I here is the php-5.2.14.tar.gz
We recommend that you download the image from Sohu. The Netease image is not found. Address: http://mirrors.sohu.com/php/
Connect to the host using ssh tools.

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
# Decompress
Tar zxvf php-5.2.14.tar.gz
# Enter the PHP openssl extension Module Directory
Cd php-5.2.14/ext/openssl/
/Var/www/php5/bin/phpize # Here is your own phpize path. If you cannot find it, use whereis phpize to find it.
# If an error is found after execution, config. m4 cannot be found. config0.m4 is config. m4. Rename directly
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 complete, a directory of the. so file (openssl. so) will be returned. Openssl. so file copy to you in php. under extension_dir specified in ini (in php. in the INI file, find: extension_dir =). The directory here is var/www/php5/lib/php/extensions.
# Edit the php. ini file and add it at the end of the file
Extension = openssl. so
# Restart Apache.
/Usr/local/apache2/bin/apachectl restart

Now, openssl support is successfully added.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.