Drupal often recommends that you install and enable PECL UploadProgress to show better feedback when uploading files, but it doesn't make it obvious how to do that. This quick post will run through what it took for me to get PECL UploadProgress on an Oracle Linux 8 server.
Add required packages
There are a few preliminary packages that you'll need: gcc, make, php-devel, and php-pear. You can install in Oracle Linux 8 using this command:
sudo yum -y install gcc make php-devel php-pear
You don't have to provide the -y. That will pre-approve any other prompts that come up, including if it requires installing other dependent packages. If you want to be more careful, don't use that, but it can come in handy in contexts like installing this through a script.
Now that you've got the dependencies, you can install uploadprogress:
sudo pecl -y install uploadprogress
Add to php.ini
The packages are now in place, but your PHP installation will not make use of it unless it is recognized as an extension in your php.ini file. In the default Oracle Linux 8 setup, this file is located at /etc/php.ini. You'll need to add this line to your file:
You can edit that file directly using your preferred editor to add this line to the file, or if you are using this within a script, you can have the script write it to the end of the file like this:
sudo echo "extension=uploadprogress.so" >> /etc/php.ini
If you first need to check whether that line is already in the file - so that you don't end up writing it multiple times in a context where a script might add another line every time - you can use this in a bash script:
if [ ! -z $(grep "extension=uploadprogress.so" /etc/php.ini) ]; then sudo echo "extension=uploadprogress.so" >> /etc/php.ini fi
Finally, you'll need to restart Apache and PHP for this to go into effect:
sudo systemctl restart php-fpm sudo systemctl restart httpd