'simplexml_load_file => mysql Aborted connection to db + Apache Segmentation fault
I'm using a local MAMP.
And here is a very small piece of code that has been driving me crazy:
try {
$xml = simplexml_load_file("https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml");
if ($xml === FALSE) {
echo "Error loading currencies";
throw new Exception ("Failed to load url");
}
else
{
echo "OK loading currencies";
}
}
catch(Exception $e) {
echo "Exception : ".$e->getMessage();
}
What happens is that about 9 times out of 10, even if I do see the message "OK" message.
I also have these kind of errors appearing:
In the mysql error log file:2020-01-31T15:02:50.877466Z 134 [Note] Aborted connection 134 to db: 'wordpress452' user: 'root' host: 'localhost' (Got an error reading communication packets)
And in the apache error log file:[Fri Jan 31 16:02:51 2020] [notice] child pid 37112 exit signal Segmentation fault (11)
And the rest of the program is stopped.
I tried changing the following values to mysql configuration:
skip-name-resolve
connect_timeout = 600
net_read_timeout = 600
net_write_timeout = 600
max_allowed_packet = 256M
But it didn't changed anything.
Any thoughts on what might be the issue with my code?
Thanks a lot,
Stephane.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
