php's method of opening openssl

  • 2021-06-28 11:25:37
  • OfStack

php's method of turning on openssl, which in most cases is not turned on, requires the following simple settings to enable

Open method under windows:

1: First check in php.ini;extension=php_Whether openssl.dll exists, if it does, remove the previous comment';',If this line does not exist, add extension=php_openssl.dll.
2: Talk about php_under the php folderopenssl.dll, ssleay32.dll, libeay32.dll 3 files are copied to the WINDOWSsystem32folder.
3: Restart apache or iis (iisreset/restart)

The openssl function is now on.

Open method under Linux:

I'm using the cloud host for Jinshang Data, PHP version: 5.2.14
The following scenario illustrates adding openssl module support for PHP using my host as an example.
Some of the answers on the Internet say that to recompile PHP, add the configure parameter and add support for openssl.Here is a method that does not require recompiling.
If there is an PHP installation package file on the server, and if it has been deleted, download an PHP installation file like version 1 on the phpinfo page. Here is php-5.2.14.tar.gz
Recommended to download Sohu mirror, NetEase mirror not found.Address: http://mirrors.sohu.com/php/
Connect to the host using the ssh tool.


#  Download to /var/www/php5 Catalog 
cd /var/www/php5
wget http://mirrors.sohu.com/php/php-5.2.14.tar.gz
#  decompression 
tar zxvf php-5.2.14.tar.gz
#  Get into PHP Of openssl Extension Directory 
cd php-5.2.14/ext/openssl/
/var/www/php5/bin/phpize #  Here for your own phpize Path, if not found, use whereis phpize lookup 
#  Errors found after execution   Can't find config.m4  , config0.m4 Namely config.m4 .Direct 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
#  When the installation is complete, it returns 1 individual .so Files ( openssl.so ) directory.In this directory openssl.so  Copy files to you at php.ini  Specified in  extension_dir  Down (in php.ini Find in file: extension_dir = ) My directory here is  var/www/php5/lib/php/extensions
#  edit php.ini File, add at the end of the file 
extension=openssl.so
#  restart Apache that will do 
/usr/local/apache2/bin/apachectl restart

Okay, now you have successfully added openssl support.


Related articles: