Home Backend Development PHP Tutorial Detailed explanation of php7 installation yar and generating docker image

Detailed explanation of php7 installation yar and generating docker image

May 22, 2018 pm 03:54 PM
docker php php7

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源
Copy after login

(3) Download each version of nginx version

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

(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
Copy after login

(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启动的时候在后台运行!
Copy after login

(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
Copy after login

(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
Copy after login

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
Copy after login

(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
Copy after login

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
Copy after login

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1671
14
PHP Tutorial
1276
29
C# Tutorial
1256
24
PHP and Python: Different Paradigms Explained PHP and Python: Different Paradigms Explained Apr 18, 2025 am 12:26 AM

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

Choosing Between PHP and Python: A Guide Choosing Between PHP and Python: A Guide Apr 18, 2025 am 12:24 AM

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP and Python: A Deep Dive into Their History PHP and Python: A Deep Dive into Their History Apr 18, 2025 am 12:25 AM

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

The Continued Use of PHP: Reasons for Its Endurance The Continued Use of PHP: Reasons for Its Endurance Apr 19, 2025 am 12:23 AM

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

How do containerization technologies (like Docker) affect the importance of Java's platform independence? How do containerization technologies (like Docker) affect the importance of Java's platform independence? Apr 22, 2025 pm 06:49 PM

Containerization technologies such as Docker enhance rather than replace Java's platform independence. 1) Ensure consistency across environments, 2) Manage dependencies, including specific JVM versions, 3) Simplify the deployment process to make Java applications more adaptable and manageable.

The Compatibility of IIS and PHP: A Deep Dive The Compatibility of IIS and PHP: A Deep Dive Apr 22, 2025 am 12:01 AM

IIS and PHP are compatible and are implemented through FastCGI. 1.IIS forwards the .php file request to the FastCGI module through the configuration file. 2. The FastCGI module starts the PHP process to process requests to improve performance and stability. 3. In actual applications, you need to pay attention to configuration details, error debugging and performance optimization.

Docker on Linux: Containerization for Linux Systems Docker on Linux: Containerization for Linux Systems Apr 22, 2025 am 12:03 AM

Docker is important on Linux because Linux is its native platform that provides rich tools and community support. 1. Install Docker: Use sudoapt-getupdate and sudoapt-getinstalldocker-cedocker-ce-clicotainerd.io. 2. Create and manage containers: Use dockerrun commands, such as dockerrun-d--namemynginx-p80:80nginx. 3. Write Dockerfile: Optimize the image size and use multi-stage construction. 4. Optimization and debugging: Use dockerlogs and dockerex

What happens if session_start() is called multiple times? What happens if session_start() is called multiple times? Apr 25, 2025 am 12:06 AM

Multiple calls to session_start() will result in warning messages and possible data overwrites. 1) PHP will issue a warning, prompting that the session has been started. 2) It may cause unexpected overwriting of session data. 3) Use session_status() to check the session status to avoid repeated calls.

See all articles