Skip to content

Instantly share code, notes, and snippets.

@daaru00
Last active December 15, 2023 04:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daaru00/96cc6364802869d59ee4c53eccec5b31 to your computer and use it in GitHub Desktop.
Save daaru00/96cc6364802869d59ee4c53eccec5b31 to your computer and use it in GitHub Desktop.
Reset PHP OPcache cache from command line
#!/bin/bash
WEBDIR=/var/www/html/
RANDOM_NAME=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 13)
echo "<?php opcache_reset(); ?>" > ${WEBDIR}${RANDOM_NAME}.php
curl http://localhost/${RANDOM_NAME}.php
rm ${WEBDIR}${RANDOM_NAME}.php
echo "cache reset"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment