The following code has the function of receiving multiple page ids, executing a procedure to obtain your data and returning an array with all this information.
The function works fine but only when it is 1 iteration, is there something that is missing? What can cause the error?
function getArrayToPost($pages) {
$array_response = array();
if($conn = createConnection()) {
$stmt = $conn->prepare('call wp_getFbPage(?);');
$stmt->bind_param('i', $page_id);
foreach ($pages as $fb_pagina){
$page_id = (int)$fb_pagina['id'];
$stmt->execute();
$result = $stmt->get_result();
$page_info = $result->fetch_assoc();
$array_response[] = $page_info;
// break; <= si es agregado, no lanza error, 1 iteracion
}
$conn->close();
$stmt->close();
}
return $array_response;
}
Error: pid 4116 exit signal Segmentation fault (11), possible coredump in / etc / apache2