PHP Fatal error: Allowed memory size of 987654 bytes exhausted (tried to allocate 321 bytes) in /path/to/file.php on line 12
Error: There has been a critical error on this website.
If you get an out of memory error when running a PHP file from the CLI, you can inline an increased limit for just a single run with the -d memory_limit
switch.
Examples:
# For calling a PHP file directly
php -d memory_limit=512M file.php
# For running a WP CLI command
php -d memory_limit=512M "$(which wp)" search-replace 'find' 'replace' --report-changed-only