Skip to content

Commit

Permalink
feat: add opcache optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
zgq354 committed Dec 5, 2023
1 parent ba9e626 commit e48f391
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ RUN \
# && apk add autoconf automake make gcc g++ libtool pkgconfig shadow rsync redis nginx mariadb-client \
# APCu
&& pecl install apcu \
&& pecl install xhprof \
&& docker-php-ext-enable apcu --ini-name 10-docker-php-ext-apcu.ini

# Install xdebug
Expand Down
4 changes: 4 additions & 0 deletions .devcontainer/php/conf.d/dev-config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ display_errors = Off
log_errors = On
error_reporting = E_ALL
error_log = /data/log/php/php_errors.log

; profile
[xhprof]
extension=xhprof.so
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ RUN \
libjpeg-turbo-dev \
patch \
supervisor \
$PHPIZE_DEPS \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) gd gmp pdo_mysql exif \
&& docker-php-ext-install -j$(nproc) gd gmp pdo_mysql exif opcache \
# complier & shadow & rsync & redis & nginx
&& apk add autoconf automake make gcc g++ libtool pkgconfig shadow rsync redis nginx \
# APCu
Expand All @@ -38,13 +39,15 @@ RUN \
freetype-dev \
libpng-dev \
libjpeg-turbo-dev \
$PHPIZE_DEPS \
&& rm /var/cache/apk/* \
# nginx log
&& mkdir -p /data/log/nginx \
&& chown -R nginx:nginx /data/log/nginx

# php config
ADD ./build/app/custom-php.ini "$PHP_INI_DIR/conf.d/"
ADD ./build/app/opcache.ini "$PHP_INI_DIR/conf.d/"

# nginx
ADD ./build/nginx/nginx.conf /etc/nginx/
Expand Down
9 changes: 9 additions & 0 deletions build/app/opcache.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[opcache]
opcache.enable=1
opcache.revalidate_freq=0
opcache.validate_timestamps=0
opcache.max_accelerated_files=10000
opcache.memory_consumption=192
opcache.max_wasted_percentage=10
opcache.interned_strings_buffer=16
opcache.fast_shutdown=1

0 comments on commit e48f391

Please sign in to comment.