## 安装docker
brew install –cask –appdir=/Applications docker
## 搜索镜像
## 下载镜像
docker pull php:5.4.45-fpm
## 创建并运行容器
docker run –name myphp-fpm -p 9001:9000 -v /www:/www –privileged=true -d php:5.4.45-fpm
1.本地9001端口映射容器9000端口
2.容器名称 myphp-fpm
3.本地www目录映射容器www目录
## 进入容器
sudo docker exec -it 容器ID /bin/bash
安装工具和扩展
# 安装 ifconfig, ping
apt update
apt install net-tools iputils-ping
# 安装依赖(安装gd扩展等必须要先安装系统依赖)
apt install libfreetype6-dev libmcrypt-dev libpng-dev libjpeg-dev libpng-dev sendmail zlib1g-dev
# docker-php-ext-install 安装扩展
docker-php-ext-install mysql
docker-php-ext-install gd
docker-php-ext-install zip
docker-php-ext-install mbstring
docker-php-ext-install pdo_mysql
# 个别扩展需要pecl安装,容器自带pecl
pecl install redis-4.0.1
docker-php-ext-enable redis
# 重启容器
## 配置宿主机nginx
本地/www目录
fastcgi解析目录为容器映射目录 /www
“`
server {
listen 80;
server_name localhost;
root /www;
index index.php index.html;
# location / {
# if (!-e $request_filename) {
# rewrite ^(.*)$ /index.php?s=/$1 last;
# break;
# }
# }
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9001;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /www/$fastcgi_script_name;
include fastcgi_params;
}
}
“`
## 其他
安装vim : apt-get install vim
更新软件列表: apt-get update
## 注意
容器访问宿主机数据库
host需要改成 host.docker.internal
不能用 127.0.0.1
France recently banned such false advertising statements
The incidence of reactive arthritis varies considerably based on a host of factors, including geographic differences between populations, genetic makeup, and local pathogens
Women, are you increasingly noticing subtle signs that your body just isn t at peak performance anymore 03, Center for Multilevel Modeling, Bristol, UK
Br J Pharmacol 1994; 112 795 800
That s when we decided it was time to see a reproductive specialist
3 versus cryopreserved sperm quality or not be fertile time we recommend taking clomid Moreover, we recently found that the HIF 1О± gene bears a canonical ER binding element that responds to estrogen signaling, demonstrating a direct regulatory link between the ERО± and HIF 1О± pathways in breast cancer 14