Bulk change PHP memory_limit across all installed PHP versions

On my server, I have PHP 5.6 to 8.1 installed and use the versions for various testing purposes.

To change the memory_limit across all versions as simply as possible instead of editing each file, I use the following command.

find /etc/php -iname 'php.ini' -exec sed -i 's/memory_limit = .*/memory_limit = 512M/g' {} \;

Leave a Reply

Your email address will not be published. Required fields are marked *