gpt4 book ai didi

php - 无法在Docker PHP 7.3.5中启用php-ast

转载 作者:行者123 更新时间:2023-12-02 18:28:06 24 4
gpt4 key购买 nike

我正在尝试将php-ast扩展安装到我的项目中。这是我的Dockerfile:

FROM php:7.3.5-apache
RUN apt-get -yqq update \
&& apt-get -yqq install --no-install-recommends libzip-dev git
COPY ./php/php.ini /usr/local/etc/php/
COPY ./php/php_errors.log /var/log/php_errors.log
COPY ./apache/error.log /var/log/apache2/error.log
COPY ./apache/access.log /var/log/apache2/access.log
COPY . /var/www/html
COPY ./apache/vhost.conf /etc/apache2/sites-available/000-default.conf
COPY ./mysql/my.cnf /etc/mysql/conf.d/my.cnf
COPY --from=composer:1.6.5 /usr/bin/composer /usr/bin/composer
RUN apt-get update && apt-get install -y libmcrypt-dev libtool zip unzip \
&& docker-php-ext-install mysqli pdo_mysql \
&& pecl install mcrypt-1.0.2 ast-1.0.1 \
&& docker-php-ext-enable mcrypt ast \
&& a2enmod rewrite
RUN chown -R www-data:www-data /var/www/html

运行此构建并尝试使用ast之后,我收到消息ast未启用。有人会用简单的英语解释如何在Docker php 7.3.5或更高版本上安装此扩展吗?

更新资料

这是我的docker-compose.yml:
version: "3"
services:
appnew:
build: .
depends_on:
- mysqlnew
ports:
- 8080:80
networks:
- app-net
volumes:
- ..:/var/www/html

container_name: appnew
mysqlnew:
image: mysql:5.6
ports:
- 13317:3306
environment:
- MYSQL_DATABASE=XXXX_db
- MYSQL_ROOT_PASSWORD=XXXXXX
volumes:
- mysql57data:/var/lib/mysql
- ./mysql/my.cnf:/etc/mysql/conf.d/my.cnf
# - ./mysql/logs:/var/log/mysql/
networks:
- app-net
container_name: mysqlnew
networks:
app-net:
driver: "bridge"
volumes:
mysql57data:
driver: "local"

这是我的php.ini:
date.timezone = Europe/London
memory_limit = 128M
post_max_size = 500M
upload_max_filesize = 200M
error_log = /var/log/php_errors.log
error_reporting = -1
log_errors = 1

最佳答案

我用了这个Dockerfile

FROM php:7.3.5-apache
RUN apt-get -yqq update \
&& apt-get -yqq install --no-install-recommends libzip-dev git
RUN apt-get update && apt-get install -y libmcrypt-dev libtool zip unzip \
&& docker-php-ext-install mysqli pdo_mysql \
&& pecl install mcrypt-1.0.2 ast-1.0.1 \
&& docker-php-ext-enable mcrypt ast \
&& a2enmod rewrite

运行构建并编写 php -m,这是输出
[PHP Modules]
ast
Core
ctype
curl
date
dom
fileinfo

然后你那么多行。

关于php - 无法在Docker PHP 7.3.5中启用php-ast,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56074779/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com