构建php的两种模式(php-fpm和php-cli)的运行环境
文档说明:只记录关键地方;
试验环境: linux debian 11
目标:nginx容器与php容器连接
php fpm 和 cli 区别
cli 没有进程管理器php-fpm
cli 模式下可以使用swoole
和 python 一样 apt 以后直接就能用
debian系列安装 php-cli
apt search php
apt install php-cli php-mysqlnd php-pgsql php-sqlite3 php-redis php-mongodb
apt install php-pear
apt install php-dev
# pecl update-channels
# 下载扩展慢的解决办法 pecl 使用代理设置
# pear config-set http_proxy http://127.0.0.1:8015
pecl channel-update https://pecl.php.net/channel.xml
pecl install swoole
# 移除代理
# pear config-set http_proxy ""
curl -fsSL 'https://curl.haxx.se/ca/cacert.pem' -o /etc/php/cacert.pem
curl -Lo /usr/local/bin/composer https://mirrors.aliyun.com/composer/composer.phar
chmod a+x /usr/local/bin/composer
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
debian系列安装 php-fpm
apt search php
apt install php-fpm php-mysqlnd php-pgsql php-sqlite3 php-redis php-mongodb
apt install php-pear
apt install php-dev
# pecl update-channels
pecl channel-update https://pecl.php.net/channel.xml
curl -fsSL 'https://curl.haxx.se/ca/cacert.pem' -o /etc/php/cacert.pem
alpine 安装 php-cli
apk search php
apk add php8-cli php8-mysqlnd php8-pgsql php8-sqlite3 php8-redis php8-mongodb
apk add php-pear
apk add php-dev
apk add gcc
# pecl update-channels
# 下载扩展慢的解决办法 pecl 使用代理设置
# pear config-set http_proxy http://127.0.0.1:8015
pecl channel-update https://pecl.php.net/channel.xml
pecl install swoole
# 移除代理
# pear config-set http_proxy ""
curl -fsSL 'https://curl.haxx.se/ca/cacert.pem' -o /etc/php/cacert.pem
curl -Lo /usr/local/bin/composer https://mirrors.aliyun.com/composer/composer.phar
chmod a+x /usr/local/bin/composer
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
alpine 安装 php-fpm
apk search php
apk add php8-php-fpm php8-mysqlnd php8-pgsql php8-sqlite3 php8-redis php8-mongodb
apk add php-pear
apk add php-dev
# pecl update-channels
pecl channel-update https://pecl.php.net/channel.xml
curl -fsSL 'https://curl.haxx.se/ca/cacert.pem' -o /etc/php/cacert.pem