I have noticed since I upgraded to PHP7 that some SQL statements no longer work and instead run out of memory.
I have this code:
$query = Yii::$app-&
It is not directly PHP7-related. The issue is due to new mysqlnd driver, so you can experience the the same problem even with PHP 5.x as well. It is actually a bugfix, because even before the memory was still allocated, but it didn't count towards memory_limit.
To avoid a memory issue you have to use unbuffered queries for the large resultsets.
So, for the query that is expecting a large dataset, set the proper setting like this:
$pdo->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
For the further reading, I've got a decent explanation in my PDO tutorial, thanks to Nikic, whose critical feedback was invaluable.