server->get('SERVER_SOFTWARE', ''); // Get the web server identity. $is_nginx = preg_match("/Nginx/i", $server_software); $is_apache = preg_match("/Apache/i", $server_software); $fastcgi = $is_apache && ((str_contains($server_software, 'mod_fastcgi') || str_contains($server_software, 'mod_fcgi'))); // Check the uploadprogress extension is loaded. if (extension_loaded('uploadprogress')) { $value = $this->t('Enabled (PECL uploadprogress)'); $description = NULL; } else { $value = $this->t('Not enabled'); $description = $this->t('Your server is capable of displaying file upload progress, but does not have the required libraries. It is recommended to install the PECL uploadprogress library.'); } // Adjust the requirement depending on what the server supports. if (!$is_apache && !$is_nginx) { $value = $this->t('Not enabled'); $description = $this->t('Your server is not capable of displaying file upload progress. File upload progress requires an Apache server running PHP with mod_php or Nginx with PHP-FPM.'); } elseif ($fastcgi) { $value = $this->t('Not enabled'); $description = $this->t('Your server is not capable of displaying file upload progress. File upload progress requires PHP be run with mod_php or PHP-FPM and not as FastCGI.'); } $requirements['file_progress'] = [ 'title' => $this->t('Upload progress'), 'value' => $value, 'description' => $description, ]; return $requirements; } }