php:7-cli-apline安装mysql redis mongo扩展模块

apk add --no-cache build-dependencies build-base openssl-dev autoconf g++ libtool make curl-dev libxml2-dev linux-headers

docker-php-ext-install -j 2 mysqli
docker-php-ext-install pdo_mysql

pecl install mongodb-1.2.2
echo "extension=mongodb.so" >>  /usr/local/etc/php/conf.d/mongodb.ini

pecl install redis
echo "extension=redis.so" >>  /usr/local/etc/php/conf.d/redis.ini

在容器里面执行之后再commit,封装成新镜像就好。

centos7镜像安装php并添加模块

下面的模块包含了差不多常用的所有模块,包括mysql\amqp\redis\mongo\memccache

yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

yum -y install \
php70 \
php70-php-cli \
php70-php-pecl-amqp \
php70-php-pecl-redis \
php70-php-pecl-apcu \
php70-php-bcmath \
php70-php-bcmath \
php70-php-ldap \
php70-php-mbstring \
php70-php-mcrypt \
php70-php-pecl-memcached  \
php70-php-pecl-mongodb \
php70-php-mysqlnd \
php70-php-pdo \
php70-php-pgsql \
php70-php-soap \
php70-php-pecl-vips \
php70-php-xml \
php70-php-pecl-zip \
php70-php-gd \
php70-php-pecl-imagick \
php70-php-intl \
php70-php-ioncube-loader \
php70-php-process \
php70-php-imap \
php70-php-xmlrpc \
php70-php-opcache \
php70-php-process \
php70-php-devel

echo "PATH=$PATH:/opt/remi/php70/root/usr/bin/" > /etc/profile.d/php.sh

posted @ 2023-05-09 16:04  Gshelldon  阅读(35)  评论(0编辑  收藏  举报