Skip to content

Commit

Permalink
fix: introduced opcache
Browse files Browse the repository at this point in the history
  • Loading branch information
blt950 committed Nov 30, 2024
1 parent 8bbba01 commit 430fe7f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ COPY --from=mlocati/php-extension-installer:2.2.19 /usr/bin/install-php-extensio
# These are the extensions we depend on:
# $ composer check -f json 2>/dev/null | jq '.[] | select(.name | startswith("ext-")) | .name | sub("ext-"; "")' -r
# Currently, this seems to only be pdo_mysql.
RUN install-php-extensions pdo_mysql
RUN install-php-extensions pdo_mysql opcache

# Install composer
COPY --from=docker.io/library/composer:latest /usr/bin/composer /usr/bin/composer
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,10 @@ After recreating the docker container, remember to run the migration to make sur
docker exec -it --user www-data events php artisan migrate
```

## Caching
This application uses the OPCache to cache the compiled PHP code. Default setting is for production which means that the cache is not cleared automatically. To clear the cache, you need to restart the container if you change a file.

For development, change `validate_timestamps` to `1` in the `/usr/local/etc/php/php.ini` file to make sure that the cache is cleared automatically when a file is changed.

## Contribution and conventions
Contributions are much appreciated to help everyone move this service forward with fixes and functionalities. We recommend you to fork this repository here on GitHub so you can easily create pull requests back to the main project.
2 changes: 1 addition & 1 deletion config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
| Needs to be updated manually for each iteration we do.
|
*/
'version' => '1.0.5',
'version' => '1.0.6',

/*
|--------------------------------------------------------------------------
Expand Down
20 changes: 10 additions & 10 deletions container/configs/php.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1766,23 +1766,23 @@ ldap.max_links = -1

[opcache]
; Determines if Zend OPCache is enabled
;opcache.enable=1
opcache.enable=1

; Determines if Zend OPCache is enabled for the CLI version of PHP
;opcache.enable_cli=0
opcache.enable_cli=1

; The OPcache shared memory storage size.
;opcache.memory_consumption=128
opcache.memory_consumption=64

; The amount of memory for interned strings in Mbytes.
;opcache.interned_strings_buffer=8
opcache.interned_strings_buffer=4

; The maximum number of keys (scripts) in the OPcache hash table.
; Only numbers between 200 and 1000000 are allowed.
;opcache.max_accelerated_files=10000
opcache.max_accelerated_files=8000

; The maximum percentage of "wasted" memory until a restart is scheduled.
;opcache.max_wasted_percentage=5
opcache.max_wasted_percentage=5

; When this directive is enabled, the OPcache appends the current working
; directory to the script key, thus eliminating possible collisions between
Expand All @@ -1792,12 +1792,12 @@ ldap.max_links = -1

; When disabled, you must reset the OPcache manually or restart the
; webserver for changes to the filesystem to take effect.
;opcache.validate_timestamps=1
opcache.validate_timestamps=0

; How often (in seconds) to check file timestamps for changes to the shared
; memory storage allocation. ("1" means validate once per second, but only
; once per request. "0" means always validate)
;opcache.revalidate_freq=2
opcache.revalidate_freq=1

; Enables or disables file search in include_path optimization
;opcache.revalidate_path=0
Expand Down Expand Up @@ -1868,7 +1868,7 @@ ldap.max_links = -1
; Enables and sets the second level cache directory.
; It should improve performance when SHM memory is full, at server restart or
; SHM reset. The default "" disables file based caching.
;opcache.file_cache=
opcache.file_cache=/tmp

; Enables or disables opcode caching in shared memory.
;opcache.file_cache_only=0
Expand Down Expand Up @@ -1908,7 +1908,7 @@ ldap.max_links = -1
; Prevents caching files that are less than this number of seconds old. It
; protects from caching of incompletely updated files. In case all file updates
; on your site are atomic, you may increase performance by setting it to "0".
;opcache.file_update_protection=2
opcache.file_update_protection=2

; Absolute path used to store shared lockfiles (for *nix only).
;opcache.lockfile_path=/tmp
Expand Down

0 comments on commit 430fe7f

Please sign in to comment.