In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the knowledge of "how to use docker to run multiple php versions on the server". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
The following is to install the php7 version as an example to introduce the following specific practices.
Centos6 installation docker:
Yum install-y https://get.docker.com/rpm/1.7.1/centos-6/RPMS/x86_64/docker-engine-1.7.1-1.el6.x86_64.rpm service docker start chkconfig docker on
Pull php7.2 image
Docker pull php:7.2-fpm
Create a new directory and the file / usr/local/docker-php7/zz-docker.conf, and save the following:
[global] daemonize = Nowww] listen = 9001
; modify the variables in php.ini, just modify the corresponding properties of the php_value array
Php_ value [session.save _ handler] = redisphp_ value [session.save _ path] = tcp://127.0.0.1:6379php_ value [max_size] = 20Mphp_ value [max_filesize _ max_filesize] = 20Mphpvalue [date.timezone] = Asia/Shanghaiphp_value [opcache.enable] = 1phpvalue [opcache.enable _ value] = 1
Run the container and use host mode to communicate with the host
Docker run-d-v / var/www/html:/var/www/html-v / usr/local/docker-php7/zz-docker.conf:/usr/local/etc/php-fpm.d/zz-docker.conf-- net=host-- name php7.2 php:7.2-fpm
Install various common php extensions
Docker exec php7.2 apt-get update-ydocker exec php7.2 apt-get install-y libfreetype6-devdocker exec php7.2 apt-get install-y libjpeg62-turbo-devdocker exec php7.2 apt-get install-y libpng-devdocker exec php7.2 docker-php-ext-install pdo_mysqldocker exec php7.2 docker-php-ext-install mysqlidocker exec php7.2 docker-php-ext-install iconv docker exec php7.2 docker-php-ext-install gddocker exec php7.2 docker-php-ext-install mbstringdocker exec php7.2 docker -php-ext-install opcache# changes the configuration of docker exec php7.2 mv / usr/local/etc/php/php.ini-production / usr/local/etc/php/php.ini by the way
Since the redis extension cannot be installed through docker-php-ext-install, you need to install it manually
# enter the command line docker exec-it php7.2 sh docker-php-source extractcurl-L-o / tmp/redis.tar.gz https://github.com/phpredis/phpredis/archive/4.2.0.tar.gztar-zxvf / tmp/redis.tar.gz-C / usr/src/php/extmv / usr/src/php/ext/phpredis-* / usr/src/php/ext/phpredisdocker-php-ext-install phpredis# here and press ctr+p and ctrl+q to exit the container docker restart php7.2
The above command has successfully run php7.2 on port 9001. Next, as long as the php script points to port 9001 in the configuration of nginx (originally to port 9000)
This is the end of "how to run multiple php versions on the server with docker". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.