{"id":627,"date":"2025-12-26T16:27:55","date_gmt":"2025-12-26T12:27:55","guid":{"rendered":"https:\/\/hostatto.com\/?p=627"},"modified":"2026-04-06T22:53:50","modified_gmt":"2026-04-06T18:53:50","slug":"how-to-check-folder-permissions-on-a-server-using-php","status":"publish","type":"post","link":"https:\/\/hostatto.com\/blog\/how-to-check-folder-permissions-on-a-server-using-php.html","title":{"rendered":"How to check folder permissions on a server using PHP"},"content":{"rendered":"<p>You have a folder <strong>public<\/strong> on the server<\/p>\n<blockquote><p>\/var\/www\/site.com\/public\/<\/p><\/blockquote>\n<p>And want to check its permissions without accessing the terminal, using PHP. To do this, run the following command.<\/p>\n<blockquote><p>$folder = '\/var\/www\/site.com\/public\/';<br \/>\necho 'Permissions: ' . substr(sprintf('%o', fileperms($folder)), -3);<br \/>\necho 'Owner: ' . posix_getpwuid(fileowner($folder))['name'];<br \/>\necho 'Group: ' . posix_getgrgid(filegroup($folder))['name'];<\/p><\/blockquote>\n<p>The result will be something like this<\/p>\n<blockquote><p>Permissions: 770<br \/>\nOwner: jack<br \/>\nGroup: www-data<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>...<\/p>\n","protected":false},"author":1,"featured_media":206,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24],"tags":[83,45,19],"class_list":["post-627","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php","tag-folder-permissions","tag-linux","tag-php"],"_links":{"self":[{"href":"https:\/\/hostatto.com\/blog\/wp-json\/wp\/v2\/posts\/627","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hostatto.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hostatto.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hostatto.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hostatto.com\/blog\/wp-json\/wp\/v2\/comments?post=627"}],"version-history":[{"count":3,"href":"https:\/\/hostatto.com\/blog\/wp-json\/wp\/v2\/posts\/627\/revisions"}],"predecessor-version":[{"id":678,"href":"https:\/\/hostatto.com\/blog\/wp-json\/wp\/v2\/posts\/627\/revisions\/678"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hostatto.com\/blog\/wp-json\/wp\/v2\/media\/206"}],"wp:attachment":[{"href":"https:\/\/hostatto.com\/blog\/wp-json\/wp\/v2\/media?parent=627"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hostatto.com\/blog\/wp-json\/wp\/v2\/categories?post=627"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hostatto.com\/blog\/wp-json\/wp\/v2\/tags?post=627"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}