Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install php for docker

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "docker how to install php", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "docker how to install php" bar!

Docker install php

The content of docker was introduced in a previous article, but many netizens reported that they were not very familiar with docker, so it was difficult to receive it all at once, so I wrote an article about installing PHP separately.

Software address: https://github.com/wallace5303/dnnmmp

The installation steps are as follows:

Install git, docker, and docker-compose locally (the latest version 1.23 is recommended).

Docker installation

Docker-compose installation

Clone Project:

# if it is not a `root` user, add the current user to the `docker` user group $sudo gpasswd-a ${USER} docker# to get the project $git clone https://github.com/wallace5303/dnnmmp.git

Build and start:

$cd dnnmmp# build $docker-compose build php72 # background run $docker-compose up-d php72

View the container: $docker container ls

Command line usin

Edit ~ / .bashrc (or ~ / .zshrc) and add at the end of the line

# if the software is already installed on the computer Please change the function name php () {tty= tty-s & & tty=--tty docker run\ $tty\-interactive\-- rm\-- volume $PWD:/var/www/html:rw\-- workdir / var/www/html\ dnnmmp_php72 php "$@"} Composer () {tty= tty-s & & tty=--tty docker run\ $tty\-- interactive\-- rm\-- user $(id-u): $(id-g)\-volume ~ / dnnmmp/composer:/tmp\-volume / etc/passwd:/etc/passwd:ro\ -- volume / etc/group:/etc/group:ro\-- volume $(pwd): / app\ composer "$@"}

(3) give effect to the revised content

$source ~ / .bashrc (or ~ / .zshrc)

(4) View version information

$php-vPHP 7.2.19 (cli) (built: Jun 28 2019 03:58:08) (NTS) Copyright (c) 1997-2018 The PHP GroupZend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.2.19, Copyright (c) 1999-2018, by Zend Technologies$ composer-vComposer version 1.8.6 2019-06-11 15:03:05 Thank you for reading, this is the content of "how docker installs php", after the study of this article I believe that you have a deeper understanding of how to install php in docker, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report