Created
August 21, 2017 16:57
-
-
Save jsonUK/dc2525aae7e1e9ef7fab4fe2105c9b22 to your computer and use it in GitHub Desktop.
Clear the OpCache via the console
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Gracefully Restart PHP7 FPM with SIGUSR2 | |
# This clears PHP5 OpCache | |
if (kill -s USR2 `cat /var/run/php/php7.0-fpm.pid`) then | |
echo "Cleared PHP OpCache" | |
fi |
If using Capistrano to clear caching, add the command to sudoers file (visudo to edit), then add this line:
deploy ALL=NOPASSWD: /usr/local/sbin/clear-opcache
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Place this file inside /usr/local/sbin
Change to correct permissions:
chmod +x /usr/local/sbin/clear-opcache