# Web Based File Management with PHP and Tiny File Manager

## Download and Setup Tiny File Manager

1. Download Tiny File Manager Download
2. Extract the Tiny File Manager files
3. Copy TinyFileManager.php to Apache install directory/htdocs/filemanager
4. Rename TinyFileManager.php to index.php
5. Edit index.php in a text editor
6. Find $use_auth and set the value to false
7. Save
8. Open a web browser and navigate to https://DNSorIP/filemanager

## Customizing Root Location and Authentication

1. Optionally, Edit Apache install directory/htdocs/filemanager/index.php
2. Find $root_path and edit the value to limit the scope of the file manager
3. Save index.php
4. Navigate to the Apache install directory/conf in Explorer
5. Edit httpd.conf in a text editor
6. Find the authnz_ldap_module and make sure it is enabled by removing the # at the start of the line

   LoadModule authnz_ldap_module modules/mod_authnz_ldap.so

7. Find the ldap_module and make sure it is enabled by removing the # at the start of the line

   LoadModule ldap_module modules/mod_ldap.so

8. Create a Location block to enable LDAP authentication for the specified directory

   <location /filemanager>
   # Basic authentication with LDAP against MS AD
   AuthType Basic
   AuthBasicProvider ldap
   # AuthLDAPURL specifies the LDAP server IP, port, base DN, scope and filter
   # using this format: ldap://host:port/basedn?attribute?scope?filter
   AuthLDAPURL "ldap://i12bretro.local:389/DC=i12bretro,DC=local?sAMAccountName?sub?(objectClass=user)" NONE

   # The LDAP bind username and password
   AuthLDAPBindDN "readonly_svc@i12bretro.local"
   AuthLDAPBindPassword "Read0nly!!"
   LDAPReferrals Off
   AuthUserFile /dev/null
   AuthName "Restricted Area [i12bretro.local]"
   # to authenticate a domain group, specify the full DN
   AuthLDAPGroupAttributeIsDN on
   require ldap-group CN=WebAuthAccess,CN=Users,DC=i12bretro,DC=local
   </location>

9. Save httpd.conf
10. Restart the Apache service
11. Refresh https://DNSorIP/filemanager