Implementation of php without compiling and installing openssl extension

  • 2021-09-12 00:43:09
  • OfStack

When using the RSA algorithm in php, you need to call the openssl_get_publickey method, but you need to compile the openssl extension for php at the same time, otherwise you will be prompted with the following error:


Call to undefined function openssl_get_publickey() 

Since php has been installed, how to install openss without compiling. The operation steps in this way are as follows:

Enter the source code path of php


cd /php-5.6.19/ext/openssl 

Compile with phpize


cp config0.m4 config.m4 

phpize

The configure file is generated so that you can install it using the make command

Special note: It is necessary to set the environment variables of php installation path.

Performing an make installation


./configure --with-php-config=/usr/local/cp-php-5.6.19/bin/php-config --with-openssl 

Special note: openssl needs to be installed first

php. ini Add Extension Configuration Extensions for openssl


extension=openssl.so 

Verify whether the increase is successful


php -m 

You can see all the extensions of php


Related articles: