docker:ubuntu18.04 配置phalcon3.4环境

一、拉取ubuntu18.04镜像
sudo docker pull ubuntu:18.04
sudo docker  run -it -p 80:80  -v ~/data/vhost/:/var/www   --name myubuntu18.04 ubuntu:18.04 /bin/bash

二、添加阿里源(ubuntu18.04: bionic; 20.04: focal)

cp  /etc/apt/sources.list   /etc/apt/sources.list.bak
tee /etc/apt/sources.list <<-‘EOF‘
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
EOF

更新 && 安装vim

apt-get update && apt-get upgrade && apt-get install vim

卸载apache+安装Nginx

apt-get --purge remove apache2* && apt-get autoremove apache2
apt-get install nginx && /etc/init.d/nginx restart

安排php7.2

apt-get install php php7.2-fpm php7.2-redis php-dev

接下来操作参考:
https://blog.csdn.net/qq_36290650/article/details/90411807

3、配置php-frm
        vi /etc/php/7.2/fpm/php.ini
        #修改参数如下:
        # 778行 ;cgi.fix_fathinfo=1  更改为  cgi.fix_fathinfo=0

        vi /etc/php/7.2/fpm/pool.d/www.conf
        #修改参数如下
        #  36行 listen = 127.0.0.1:9000 
        #  62行 listen.allowed_clients = 127.0.0.1
        # 113行 pm.max_children = 50
        # 139行 pm.max_requests = 500 
        # 340行 request_terminate_timeout = 0 
        # 344行 rlimit_files = 1024
4、配置nginx
    vi /etc/nginx/sites-available/default
    第44行,在index.html前面加入index.php

    第56-62行,用如下内容替换:
    location ~ \.php$ {
        root           html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /var/www/html/$fastcgi_script_name;
        include        fastcgi_params;
    }
5、重启服务
/etc/init.d/nginx restart    
/etc/init.d/php7.2-fpm restart

安装phalcon3.4扩展

在主机上先

cd ~/data/vhost
git clone https://gitee.com/mirrors/cphalcon.git
cd cphalcon
git checkout -b 3.4.x origin/3.4.x

在docker myubuntu18.04中进行操作

cd /var/www/cphalcon/build
./install

echo "extension=phalcon.so" | tee -a /etc/php/7.2/mods-available/phalcon.ini
cd /etc/php/7.2/mods-available
phpenmod phalcon 

/etc/init.d/php7.2-fpm restart

vim /var/www/html/1.php

<?php
phpinfo();

浏览器访问

http://localhost/1.php

docker:ubuntu18.04 配置phalcon3.4环境

上一篇:Linux基础知识


下一篇:centos8创建局域网的私有yum源