You have a folder public on the server

/var/www/site.com/public/

And want to check its permissions without accessing the terminal, using PHP. To do this, run the following command.

$folder = '/var/www/site.com/public/';
echo 'Permissions: ' . substr(sprintf('%o', fileperms($folder)), -3);
echo 'Owner: ' . posix_getpwuid(fileowner($folder))['name'];
echo 'Group: ' . posix_getgrgid(filegroup($folder))['name'];

The result will be something like this

Permissions: 770
Owner: ubuntu
Group: www-data