Skip to content

Commit f696103

Browse files
committed
lamp.sh: Fix opcache settings installed to the wrong path
1 parent 8e55ef7 commit f696103

12 files changed

Lines changed: 45 additions & 8 deletions

File tree

‎.github/workflows/build-lxd.yml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ jobs:
547547
echo "Running update to ${VERSION}"
548548
549549
current_nc_version="$(sudo "$LXC" exec ncp -- ncc status | grep "version:" | awk '{ print $3 }')"
550-
latest_nc_version="34.0.2"
550+
latest_nc_version="33.0.2"
551551
552552
sudo "$LXC" exec ncp -- bash -c "DBG=x ncp-update ${UPDATE_ARGS[*]}"
553553
sudo "$LXC" exec ncp -- /usr/local/bin/ncc status
@@ -837,6 +837,8 @@ jobs:
837837
echo "nextcloud log: "
838838
datadir="$(sudo "$LXC" exec ncp -- ncc config:system:get datadirectory)"
839839
sudo "$LXC" exec ncp -- cat "$datadir/nextcloud.log" || true
840+
echo "opcache.interned_strings_buffer:"
841+
sudo "$LXC" exec ncp -- bash -c 'grep -R opcache.interned_strings_buffer /etc/php/*/fpm/conf.d/'
840842
exit 1
841843
}
842844
USE_INCUS="$USE_INCUS" ../.venv/bin/python system_tests.py --non-interactive || {

‎bin/ncp-restore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ sed -i "s|'datadirectory' =>.*|'datadirectory' => '${DATADIR}',|" "${NCDIR}"/con
153153

154154
# Just in case we moved the opcache dir
155155
install_template "php/opcache.ini.sh" "/etc/php/${PHPVER}/mods-available/opcache.ini"
156+
systemctl reload "php${PHPVER}-fpm"
156157

157158
# tmp upload dir
158159
mkdir -p "$DATADIR/tmp"

‎bin/ncp-update-nc.d/update-nc.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ then
260260

261261
# Reload library.sh to reset PHPVER
262262
source /usr/local/etc/library.sh
263-
elif ! is_more_recent_than "34.0.0" "${NCVER}" && is_more_recent_than "8.5.0" "${PHPVER}.0" && [[ "$DEBIAN_VERSION" -ge 13 ]]
263+
elif ! is_more_recent_than "33.0.0" "${NCVER}" && is_more_recent_than "8.5.0" "${PHPVER}.0" && [[ "$DEBIAN_VERSION" -ge 13 ]]
264264
then
265265
/usr/local/bin/ncp-update-nc.d/upgrade-php-trixie-8.5.sh
266266

‎bin/ncp-update-nc.d/upgrade-php-trixie-8.5.sh‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ export DEBIAN_FRONTEND=noninteractive
77
PHPVER_OLD="$PHPVER"
88
PHPVER_NEW="8.5"
99
PHP_PACKAGES_OLD=("php${PHPVER_OLD}" \
10-
"php${PHPVER_OLD}"-{curl,gd,fpm,cli,opcache,mbstring,xml,zip,fileinfo,ldap,intl,bz2,mysql,bcmath,gmp,redis,common})
10+
"php${PHPVER_OLD}"-{curl,gd,fpm,cli,opcache,mbstring,xml,zip,fileinfo,ldap,intl,bz2,mysql,bcmath,gmp,redis,common,apcu})
1111
PHP_PACKAGES_NEW=("php${PHPVER_NEW}" \
12-
"php${PHPVER_NEW}"-{curl,gd,fpm,cli,mbstring,xml,zip,fileinfo,ldap,intl,bz2,mysql,bcmath,gmp,redis,common})
12+
"php${PHPVER_NEW}"-{curl,gd,fpm,cli,mbstring,xml,zip,fileinfo,ldap,intl,bz2,mysql,bcmath,gmp,redis,common,apcu})
1313

1414
php_restore() {
1515
trap "" INT TERM HUP ERR
@@ -24,7 +24,8 @@ php_restore() {
2424
apt-get remove --purge -y "${PHP_PACKAGES_NEW[@]}"
2525
apt-get install -y --no-install-recommends -t "$RELEASE" "${PHP_PACKAGES_OLD[@]}"
2626
set_ncpcfg "php_version" "${PHPVER_OLD}"
27-
install_template "php/opcache.ini.sh" "/etc/php/${PHPVER_NEW}/mods-available/opcache.ini"
27+
install_template "php/opcache.ini.sh" "/etc/php/${PHPVER_OLD}/mods-available/opcache.ini"
28+
phpenmod -v "${PHPVER_OLD}" -s fpm opcache
2829
run_app nc-limits
2930
a2enconf "php${PHPVER_OLD}-fpm"
3031
service "php${PHPVER_OLD}-fpm" start
@@ -54,6 +55,7 @@ apt-get install -y --no-install-recommends -t "$RELEASE" "${PHP_PACKAGES_NEW[@]}
5455

5556
set_ncpcfg "php_version" "${PHPVER_NEW}"
5657
install_template "php/opcache.ini.sh" "/etc/php/${PHPVER_NEW}/mods-available/opcache.ini"
58+
phpenmod -v "${PHPVER_NEW}" -s fpm opcache
5759
( set -e; export PHPVER="${PHPVER_NEW}"; run_app nc-limits )
5860

5961
a2enconf "php${PHPVER_NEW}-fpm"

‎bin/ncp/CONFIG/nc-datadir.sh‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ configure()
142142
# opcache dir
143143
create_opcache_dir
144144
install_template "php/opcache.ini.sh" "/etc/php/${PHPVER}/mods-available/opcache.ini"
145+
systemctl reload "php${PHPVER}-fpm"
145146

146147
# update fail2ban logpath
147148
[[ -f /etc/fail2ban/jail.local ]] && \

‎bin/ncp/CONFIG/nc-nextcloud.sh‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,12 @@ configure()
180180
if [[ -z "${OPCACHEDIR}" ]]
181181
then
182182
install_template "php/opcache.ini.sh" "/etc/php/${PHPVER}/mods-available/opcache.ini" --defaults
183+
systemctl reload "php${PHPVER}-fpm"
183184
else
184185
mkdir -p "$OPCACHEDIR"
185186
chown -R www-data:www-data "$OPCACHEDIR"
186187
install_template "php/opcache.ini.sh" "/etc/php/${PHPVER}/mods-available/opcache.ini"
188+
systemctl reload "php${PHPVER}-fpm"
187189
fi
188190

189191
## RE-CREATE DATABASE TABLE

‎etc/library.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ install_template() {
256256
local target="${2?}"
257257
local bkp="$(mktemp)"
258258

259-
echo "Installing template '$template'..."
259+
echo "Installing template '$template' to '$target'..."
260260

261261
mkdir -p "$(dirname "$target")"
262262
[[ -f "$target" ]] && cp -a "$target" "$bkp"

‎etc/ncp-templates/php/opcache.ini.sh‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ mkdir -p "$TMP_DIR"
2323

2424
cat <<EOF
2525
zend_extension=opcache.so
26+
27+
[opcache]
2628
opcache.enable=1
2729
opcache.enable_cli=0
2830
opcache.fast_shutdown=1
29-
opcache.interned_strings_buffer=12
31+
opcache.interned_strings_buffer=32
3032
opcache.max_accelerated_files=10000
3133
opcache.memory_consumption=128
3234
opcache.save_comments=1

‎lamp.sh‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ install()
6565
##########################################
6666

6767
install_template "php/opcache.ini.sh" "/etc/php/${PHPVER}/mods-available/opcache.ini" --defaults
68+
phpenmod -v "${PHPVER}" -s fpm opcache
69+
systemctl reload "php${PHPVER}-fpm"
6870

6971
# systemd drop-in: allow write access to NCP paths blocked by ProtectSystem=full
7072
mkdir -p /var/www/ncp-web
@@ -120,6 +122,11 @@ y
120122
y
121123
y
122124
EOF
125+
126+
php --version | grep "PHP ${PHPVER}" || {
127+
echo "Unexpected default PHP version (expected: ${PHPVER})!"
128+
return 1
129+
}
123130
}
124131

125132
configure() { :; }

‎tests/nextcloud_tests.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,8 @@ def test_nextcloud(IP: str, nc_port: str, driver: WebDriver, skip_release_check:
234234
expected['ncp_version'] = True
235235
elif 'php version' in divs[0].text.lower() and divs[1].text == ncp_cfg['php_version']:
236236
expected['php_version'] = True
237+
elif 'php version' in divs[0].text.lower() and divs[1].text != ncp_cfg['php_version']:
238+
print(f"{tc.yellow}{divs[1].text} != ${ncp_cfg['php_version']}")
237239
elif 'debian release' in divs[0].text.lower():
238240
if divs[1].text == ncp_cfg['release'] or skip_release_check:
239241
expected['debian_release'] = True

0 commit comments

Comments
 (0)