We have an uploader which takes customer data, maps the data to our database structure and then uploads to the database. As part of the uploader, we load all the uploaded data into memory.
The issue we are having is that "large" datasets seem to cause session issues (current example failing is around 800kb). In the code base there is a check one every page load for the contents of the session to ensure the user is logged in and is valid etc - when performing this upload and things going awry, that check fails upon form submission. Through troubleshooting we discovered that when the issue occurs the session is emptied hence the check fails and causes the user to be logged out.
The code works fine with the 800kb dataset in development and also works fine on live with around 100kb dataset. This points to the code being OK and the issue being "environmental".
Session code is:
// If the session hasn't been started yet.
if (session_status() == PHP_SESSION_NONE)
{
// Start the session.
session_start();
}
and also then in the file itself:
$_SESSION['csv_data'] = array_map('str_getcsv', file($file_path));
and finally MUCH later (doesn't get here):
// Remove the session data.
unset($_SESSION['csv_data']);
We tried changing the memory_limit in PHP up to 1GB and even 10GB to no avail -likewise we upped max_filesize and post_max_size to 512MB respectively and same thing happens (we restarted both HTTPD and PHP-FPM)
The server is quad-core, 32GB RAM with 4 x 256GB SSD in RAID 10 - at no point does free memory drop below 28GB and both uptime and top show low usage so it doesn't seem to be lack of traditional resources causing an issue. It is running Centos 6.9 64 bit and Apache 2.4.9 with PHP 5.6.33
Is there anything else on the server which could be setting a limit to the (PHP) session/memory size? What else can we try to figure out what might be causing this?