Use the phalcon framework to perform the following query
public function getCarSeriesList($brandId, $start = 0, $count = 1000){
$phql = "SELECT cs.*, b.* FROM Test\Common\Models\Entities\CarSeries cs LEFT JOIN Test\Common\Models\Entities\CarBrands b ON cs.brandId = b.id ";
$condition = array();
if(!empty($brandId)){
$phql .= " WHERE cs.brandId = ?0 ";
$condition[0] = $brandId;
}
$phql .= " ORDER BY cs.name_en ASC ";
if(!empty($count)){
$phql .= " LIMIT ?1, ?2";
$condition[1] = $start;
$condition[2] = $count;
}
$result = $this->modelsManager->executeQuery($phql, $condition);
return $result->toArray();
}
The result is that the php-fpm process reports an error:
2017/06/27 17:07:49 [error] 60709#0: *1028 FastCGI sent in stderr: "PHP message: PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 532692992 bytes) in /Users/tester/www/testserver/apps/backend/controllers/CarSeriesController.php on line 27" while reading response header from upstream, client: 127.0.0.1, server: local.test.me, request: "GET /series HTTP /1.1", upstream: "fastcgi://127.0.0.1:9000", host: "admin.local.test.me"
The memory_limit value of php.ini has been changed from 128M to 512M, but this problem still exists. Have you ever encountered similar problems?
1. This is not a problem with phalcon but with PHP. 2. The queried data is too large. Loading it all into the memory will definitely cause this problem. 3. You can use ini_set("memory_limit", "-1"); to resolve, however. . . . As an online project, this is definitely not recommended. 4. The amount of data detected at one time is too large. You need to optimize your program instead of modifying certain system parameters.