Home >Backend Development >PHP Problem >php7 compilation and installation error
Error and solution
PHP, as a space and server programming language, has been an important choice for website developers in recent years. Most hosts have pre-installed the PHP environment, but for server administrators, they also You may face some situations where you need to compile and install PHP yourself. However, during this process, due to various reasons, the compilation and installation of PHP is not always smooth, which requires us to troubleshoot and solve the problem. This article will teach you how to solve a common PHP compilation and installation error.
Problem description:
When installing PHP7.x, running the make command, the following error will appear during compilation:
configure: error: cannot find OpenSSL's libraries
make: * [ext/openssl/openssl.lo] Error 1
Cause analysis:
This error message means that OpenSSL is missing during the PHP configuration process library file, so there was a problem during compilation.
OpenSSL is an open source Secure Sockets Layer encryption technology responsible for encrypting Internet communications. The root cause of this problem is that the OpenSSL library is not installed or is installed but not configured correctly.
Solution:
1. Download OpenSSL
Download the library corresponding to the PHP version you installed from the official website of OpenSSL (http://www.openssl. org/source/). We need to download the source code of OpenSSL so that we can configure it accordingly when compiling.
2. Install OpenSSL
Compile and install the source code of the OpenSSL library (the following commands are the installation process for CentOS systems, please check for other systems by yourself):
Note : The above openssl path must be the same as the path used later when compiling php.
3. Configure OpenSSL
In the PHP source code folder, find the configure file (located at root@localhost:/usr/local/src/php-7.0.13$) and add The following command:
--with-openssl-dir=/usr/local/openssl
Before modification:
./configure
After modification:
./configure --with-openssl-dir=/usr/local/openssl
4. Compile and install PHP
After configuring OpenSSL, return to the php source Code directory, execute the following command to compile and install PHP:
5. Check the operation of PHP
After the installation is complete, check whether the PHP environment is installed successfully.
If the PHP version number information appears, it means that PHP7 has been successfully installed:
PHP 7.0.13 (cli) (built: Dec 8 2016 09:45:58) ( NTS )
Copyright © 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright © 1998-2016 Zend Technologies
Conclusion:
Through the above process, we can successfully install PHP and solve the compilation and installation errors caused by missing OpenSSL library files. Of course, the commands required for compilation may be slightly different for different systems, but this is also one of the solutions to common compilation errors caused by missing OpenSSL. I hope it will be helpful to beginners and readers in need.
The above is the detailed content of php7 compilation and installation error. For more information, please follow other related articles on the PHP Chinese website!