I've recently updated my php and found, that the settings for apache did not match the php cli version. I had to set the cli version with the following procedure:
For some years I had problems when updating or installing a site with composer from my vagrant box.
For drupal 8, take a look into composer.json and checkout for 'extra' section. Add the file_mapping:
function getNumPagesInPDF($PDFPath = NULL)
$stream = fopen($PDFPath, "r");
$PDFContent = fread ($stream, filesize($PDFPath));