Home  >  Article  >  Backend Development  >  Detailed explanation of php7 installation yar and generating docker image

Detailed explanation of php7 installation yar and generating docker image

墨辰丷
墨辰丷Original
2018-05-22 15:54:251482browse

This article mainly introduces php7 to install yar and generate docker images. Friends who need it can refer to it

Docker contains three concepts:

(1) Remote The warehouse is the gathering place for all the images in the remote image library (not accessible for operation).

(2) The local image is the image pulled from the remote warehouse

(3) The local image that runs is called a container (layered operable)

Docker usage:

1. First, pull the corresponding information such as centos, ubuntu, tomcat, etc. through the third-party image library (c.163.com) as the basic image.

Docker pull xxxx

2. Run the downloaded image.

Docker run -dt -p host port: mirror port --name give a name mirror id/mirror name bash

-d run in the background
-t generate a pseudo terminal
-p Specify the port
--name Give a name to the running container

3. There are two ways to enter the container

(1) docker exec -it container name/container id bash (ctrl d will not stop the running container when exiting)

(2) Docker attach container name/container id (ctrl d will stop the running container when exiting)

4 .Start downloading the corresponding tools and required dependency packages required for the compilation environment

(1) yum installs wget and the compiled tools yum install -y wget gcc gcc-c make openssl-devel

(2) Update domestic yum source

Wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/xxx/
Xxx表示你要选择的yum源
-O 下载并以不同的文件名保存
CentOS-Base.repo 表示命名的yum源

(3) Download each version of nginx version

Wget http://nginx.org/download/xxx
Xxx表示你要选择的nginx的版本

(4) Download pcre

ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/xxx

Xxx represents the selected one Version

(5) Update yum to ensure the latest

Yum update

(6) Download php7

http://php.net/downloads. php

Select version, select country

(7) Paste all the downloaded things above into /usr/local/src and unzip them all

(8) Compile nginx

(1) Create nginx user

 groupadd -r nginx
useradd -r -g nginx nginx

(2) Compile and install nginx

cd xxx 切换到您的nginx目录
./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module --with-pcre=/usr/local/src/pcre-8.37
./configure参数说明:
--prefix=指定文件的安装目录
--user=指定用户
--group指定用户组
--with-使用已有的软件包和库文件
Make && make install 出现问题自行百度
echo "daemon off;" >> /usr/local/nginx/conf/nginx.conf #在nginx的配置文件里加上这一行很关键,这样nginx可以在docker启动的时候在后台运行!

(9) Compile php

(1) Prepare php dependency package

yum install -y bison bison-devel zlib-devel libmcrypt-devel mcrypt mhash-devel libxml2-devel libcurl-devel bzip2-devel readline-devel libedit-devel sqlite-devel

(2) Enter the php file directory

(3) Start compiling php

./configure --prefix=/usr/local/php --with-zlib-dir --with-freetype-dir --enable-mbstring --with-libxml-dir=/usr/local/libxml --enable-soap --enable-calendar --with-curl --with-mcrypt --with-zlib --with-gd --disable-rpath --enable-inline-optimization --with-bz2 --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --enable-exif --enable-bcmath --with-mhash --enable-zip --with-pcre-regex --with-mysql --with-pdo-mysql --with-mysqli --with-jpeg-dir=/usr/local/libjpeg --with-png-dir=/usr/local/libpng --enable-gd-native-ttf --with-openssl --with-fpm-user=www --with-fpm-group=www --with-libdir=lib64 --enable-ftp --with-imap --with-imap-ssl --with-kerberos --with-gettext --with-xmlrpc --with-xsl --enable-opcache --enable-fpm --enable-xml --enable-shmop --enable-session --enable-ctype --with-iconv-dir --with-iconv

Note: If there is any problem, please refer to Baidu.

(4) make && make install

(5) Prepare php configuration file

cp php.ini-production /etc/php.ini
cd /usr/local/php/etc
cp php-fpm.conf.default php-fpm.conf

(6) Modify configuration File

;Remove the comment of daemonize = yes, and change yes to no

(7) Install yar extension

(1) Install binary packaging protocol msgpack

find / -name phpize 查找phpize是否存在
yum install php-devel 
pecl install msgpack

Note: Baidu if there is a problem

(2) Download yar wget http://pecl.php.net/get/xxx

Xxx indicates that it is very important to check the version with the php version.

(3) Decompress and compile tar -zxvf yar-2.0.0.tgz

(4) cd cd yar-2.0.0

( 5)/usr/bin/phpize

(6)./configure --with-php-config=/usr/bin/php-config7.0*

(7) make && make install

(8) If the module is not installed, you can use php --ini to check the relative adjustment of the ini path

(9) docker commit - m "Description" -a "Author" Container id Warehouse information mydocker/nginx: version information v1

(10) docker save xxx > /home/save.tar

(11)Docker load xxx

If an error is reported during the compilation and installation process, follow the error prompts to use yum to resolve the dependencies; if the current yum source cannot be resolved, then you can try:

 wget http://www.atomicorp.com/installers/atomic
    chmod +x atomic
    ./atomic 
    yum install -y XXX XXX

Related recommendations:

php7Install yarExtension method

Comprehensive analysis of php7Installing yarExtension method

What is yarn? yarHow does n manage front-end project module dependencies instead of npm?

The above is the detailed content of Detailed explanation of php7 installation yar and generating docker image. For more information, please follow other related articles on the PHP Chinese website!

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