CentOS7.6 source code to compile and install PHP 7.3.8

installation steps

PHP official website to download link: https://www.php.net/downloads.php

1. Source wget command to download the installation package

wget https://www.php.net/distributions/php-7.3.8.tar.gz --no-check-certificate

[Description] If SSL Certification error report, then it together with --no-check-certificate option, generally do not need to add.

2. Unzip the .tar.gz file

tar xzvf php 7.3 . 8 . tar gz

3. Enter php-7.3.8 directory, ./configure performed, i.e., constructed and arranged PHP

  •  View configure usage and configuration options: ./configure -h or --help
  • Its common configuration described php
= --prefix / usr / local / php7 # install directory will
 --with-config- File -path = / usr / local / path configuration in php.ini php7 #
 --enable- Sockets # Open Socket 
 --enable- fpm fpm # enable extended
 --enable-cli # enable command line mode (from PHP 4.3 . 0 after this module can be turned on by default so do not add this command)
 --enable- mbstring # enable mbstring library
 --enable-pcntl # enable pcntl (CLI / only CGI)
 --enable- the SOAP # enable the SOAP 
 --enable- opcache # open opcache cache
 --disable-fileinfo # disable fileinfo (due to the 5.3 + Having no ongoing maintenance, but it is enabled by default, so it is still banned) (1G server memory or less directly related to it)
 --disable rpath # disable passing additional runtime library search path.
--with-mysqli # enable mysqli extension
 --with-PDO- MySQL # enable pdo extension
 --with-iconv- dir # Enable XMLRPC- EPI character encoding conversion expand
 --with-openssl # openssl extension enabled (openssl- need openssl devel)
 - with-fpm-user = user www # set fpm belongs 
 --with-fpm-group = Group www # set fpm belongs
 --with- curl # enable curl extension
 --with- mhash open mhash discrete # php encryption can not reverse the mathematical principles of extensions 
# GD
 --with- gd GD image manipulation # enable extended
 --with-JPEG- dir # open support for jpeg images (libjpeg required)
 --with-PNG- dir # open to png image support (libpng required)
 --with-freetype- dir # open FreeType 
# compression
--enable- ZIP # Enable ZIP 
--with- zlib zlib support to enable # 
# xml
 --enable- simplexml # Enable simplexml support
 --with-libxml- dir enable # libxml2 support for 

# some uncommon configuration
- enable-debug # turn on debug mode

I run the configure command as follows:

./configure --prefix=/usr/local/php7 \
--with-config-file-path=/usr/local/php7 \
--enable-sockets \
--enable-fpm \
--enable-cli \
--enable-mbstring \
--enable-pcntl \
--enable-soap \
--enable-opcache \
--disable-fileinfo \
--disable-rpath \
--with-mysqli
--with-pdo-mysql \
--with-iconv-dir \
--with-fpm-user=www \
--with-fpm-group=www \
--with-curl=/usr/local/curl \
--with-mhash \
--with-gd=no \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--enable-zip \
--with-zlib \
--enable-simplexml \
--with-libxml-dir \
--with-openssl=/usr/local/openssl

In the implementation process, there may be an error. I'm in the implementation process, having installation path curl and OpenSSL library not found, because it is not installed in the / etc / bin and etc / lib path /, so it is necessary to manually set the installation path of these two libraries:

--with-curl=/usr/local/curl

--with-openssl=/usr/local/openssl

I closed the GD image manipulation expansion, namely: - with-gd = no, if it is: - with-gd, it means open.

4. Compile and install

make && make install

5. Configure PHP environment variables

(1) vim / etc / profile // require root privileges
(2) add the following to the end of the file profile:
Export the PATH = $ the PATH: / usr / local / PHP7 / bin # This step allows us to use the global php command
(3 ) source / etc / profile # make the changes take effect profile
(4) php -i // View configuration information

If you perform the first step 4 successfully printed a PHP information, then, that PHP has been installed successfully.

## View php usage help

$ php -h

## to view the version of php

$ php -v

6. php.ini configuration file

$ Php -i | grep php.ini

Configuration File (php.ini) Path => /usr/local/php7
Loaded Configuration File => /usr/local/php7/php.ini

Configuration file in the installation package directory: PHP-7.3.8 /
the php.ini-development model Development // version
php.ini-production // mode of production version
Here, we select the mode of production version is copied to the specified path

$ Cp php.ini-production /usr/local/php7/php.ini

<Note> directory where php.ini file must be inside the php -i isolated position consistent, otherwise modify the php.ini file is not in force.

7. Install composer

> wget https://getcomposer.org/composer.phar
> cp composer.phar /usr/bin/composer
> cd /usr/bin; chmod u+x composer
> composer -v

If you print out the version information of the composer, composer means that the installation was successful.

Problems encountered

【问题】error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed

1. Download the certificate. https://curl.haxx.se/ca/cacert.pem, storage path: /home/lbs/cert/cacert.pem (this path custom)
2. Modify php.ini configuration file
> cd / usr / local / PHP7 /; LS
> Vim the php.ini
openssl.cafile = /home/lbs/cert/cacert.pem Review

【reference】

centos7 source code to compile and install PHP  https://www.cnblogs.com/l5gw/p/10992958.html

Reference to compile php7.1.4 isFinite appear undefined     https://blog.csdn.net/letshi/article/details/71079677

Installation under Linux composer  https://blog.csdn.net/lifei15731208550/article/details/91039823

 

Guess you like

Origin www.cnblogs.com/yunfan1024/p/11316641.html