Opcache: Difference between revisions
From Freephile Wiki
Created page with "Opcache settings for the Zend Engine are notoriously undocumented. So we try to choose good defaults for QualityBox. The book 'Scaling PHP' has some good explanations<ref>ht..." |
m Text replacement - "<(\/?)source" to "<$1syntaxhighlight" |
||
(One intermediate revision by one other user not shown) | |||
Line 3: | Line 3: | ||
However, if you ever need to reset a few, you could use sed, with a quick <code>apachectl -k graceful</code> to reload apache. | However, if you ever need to reset a few, you could use sed, with a quick <code>apachectl -k graceful</code> to reload apache. | ||
< | <syntaxhighlight lang="bash"> | ||
# as root | # as root | ||
myini=/etc/php.ini | myini=/etc/php.ini | ||
Line 11: | Line 11: | ||
sed -i s/\;opcache.fast_shutdown=0/opcache.fast_shutdown=1/ $myini | sed -i s/\;opcache.fast_shutdown=0/opcache.fast_shutdown=1/ $myini | ||
apachectl -k graceful | apachectl -k graceful | ||
</ | </syntaxhighlight> | ||
You can even turn off the opcache if you want | |||
<syntaxhighlight lang="bash"> | |||
# as root | |||
myini=/etc/php.ini | |||
sed -i s/opcache.enable=1/opcache.enable=0/ $myini | |||
sed -i s/opcache.enable_cli=1/opcache.enable_cli=0/ $myini | |||
apachectl -k graceful | |||
</syntaxhighlight> | |||
{{References}} | {{References}} |
Latest revision as of 13:30, 24 February 2025
Opcache settings for the Zend Engine are notoriously undocumented. So we try to choose good defaults for QualityBox. The book 'Scaling PHP' has some good explanations[1]
However, if you ever need to reset a few, you could use sed, with a quick apachectl -k graceful
to reload apache.
# as root
myini=/etc/php.ini
sed -i s/opcache.interned_strings_buffer=4/opcache.interned_strings_buffer=16/ $myini
sed -i s/opcache.revalidate_freq=30/opcache.revalidate_freq=0/ $myini
sed -i s/opcache.validate_timestamps=1/opcache.validate_timestamps=0/ $myini
sed -i s/\;opcache.fast_shutdown=0/opcache.fast_shutdown=1/ $myini
apachectl -k graceful
You can even turn off the opcache if you want
# as root
myini=/etc/php.ini
sed -i s/opcache.enable=1/opcache.enable=0/ $myini
sed -i s/opcache.enable_cli=1/opcache.enable_cli=0/ $myini
apachectl -k graceful