In what ways can the Apache user's permissions be adjusted to allow access to ClamAV LocalSocket for scanning uploaded files?

To allow the Apache user access to ClamAV LocalSocket for scanning uploaded files, you can adjust the permissions of the ClamAV LocalSocket file or change the group ownership of the file to the Apache user's group. This will enable the Apache user to communicate with the ClamAV service and scan uploaded files for malware.

// Adjust permissions of the ClamAV LocalSocket file
exec('sudo chmod 666 /var/run/clamav/clamd.sock');

// Change group ownership of the ClamAV LocalSocket file to the Apache user's group
exec('sudo chgrp www-data /var/run/clamav/clamd.sock');