php7 compilation and installation error

PHPz
Release: 2023-05-06 21:44:07
Original
1609 people have browsed it

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):

cd /usr /local/src

wget https://www.openssl.org/source/openssl-1.0.2t.tar.gz

tar zxvf openssl-1.0.2t.tar.gz

cd openssl-1.0.2t

./config --prefix=/usr/local/openssl --shared

make && make install

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:

cd /usr/local/src/php-7.0.13

./configure --prefix=/usr/local/ php7 --with-config-file-path=/usr/local/php7/etc --enable-fpm -with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv --with-freetype- dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --with- fpm-user=www --with-fpm-group=www --with-pcre-regex --with-pcre-dir --enable-mbstring --with-mcrypt --with-gd --enable-gd-native -ttf --with-openssl-dir=/usr/local/openssl --with-mhash

make && make install

5. Check the operation of PHP

After the installation is complete, check whether the PHP environment is installed successfully.

/usr/local/php7/bin/php -v

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!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!