Tutorial on configuring OpenSSL in Linux LEMP environment


Today, I’d like to share with you the process of solving the problem of opening OpenSSL function under the environment of source package compilation and installation LEMP. A few days ago, when visiting the page, I suddenly reported an error and asked to turn on the OpenSSL function. What should I do? I first thought of Yum installation, but it still hasn’t been solved after installation. Because the environment of LEMP is compiled and installed by the source package, I also need to compile and install OpenSSL.

After unremitting efforts, we finally found a solution and really succeeded. Let’s share it with you!

First, make sure that the LEMP environment is compiled and installed by the source package, and know where the PHP installation directory is.

Secondly, you can compile and install OpenSSL and OpenSSL devel through Yum source or source package.

Then, enter the directory extracted from PHP. My directory here is php-5.4.24. In the PHP directory, there will be an ext extension directory. Enter it, find and enter the OpenSSL directory. At this time, our directory is: / root / php-5.4.24/ext/openssl

There will be the following files in this directory, as shown in the figure:
2015614175416883.png (516×56)

Then, execute the / usr / local / PHP5 / bin / phpize command (ensure that M4 and Autoconf tools are installed before execution, otherwise an error will be reported).

Note: here is my phpize path, which is executed according to my own installation path; If it cannot be found, use whereis phpize to find it. If an error occurs during execution, config. Cannot be found M4 file, then put config0. 0 under the directory M4 rename config M4, because config0 M4 is config M4 template.

If the command is successfully executed, multiple configure files will automatically appear under the directory. At this time, you only need to compile and install. The process is as follows:


Copy code

The code is as follows:

# ./configure –with-openssl –with-php-config=/usr/local/php5/bin/php-config
# make && make install

Wait patiently. After the installation is completed, one more OpenSSL will appear under the current modules directory So file; Then in PHP Add the following line at the end of the INI configuration file:


Copy code

The code is as follows:


Then, restart nginx service and PHP FPM, and it’s OK!

So far, the OpenSSL function has been successfully solved in the source code compilation and installation LNMP environment!

Recommended Today

What is the economic model construction node of adaoracle oracle

Through the feed price and API on the connection chain, adamorcorporation can access any type of API interface, realize more fair and just data acquisition and service ecology, provide reliable data for DAPP, and build a more reliable, convenient and lower cost Oracle service platform. With its leading technical level, adamorcorporation has overcome the problems […]