-
Notifications
You must be signed in to change notification settings - Fork 70
Configuration
Markus edited this page Oct 29, 2022
·
6 revisions
There are several ways to configure the IFM.
- Default configuration at the top of the script (
main.php
in the sources or*ifm*.php
in the releases) - Pass a custom configuration array to the constructor (when using
libifm.php
) - Set environment variables. This is especially handy when you use the docker image or want to update the IFM without bothering with the new default config.
The way to set environment variables depends on the software you use. If you are using the apache2 webserver running mod_php you can set them by adding the SetEnv
directive to either you virtual host definition, or in a .htaccess
file:
SetEnv IFM_ROOT_DIR "/var/www/html"
SetEnv IFM_AUTH 1
SetEnv IFM_AUTH_SOURCE "file;/var/www/.htpasswd"
If you are using PHP-FPM then you can set them directly in the pool configuration:
env[IFM_API_EDIT] = 0
env[IFM_GUI_SHOWHTDOCS] = 0
env[IFM_FORBIDDENCHARS] = "$:/&?'*"
If you use docker, you can set them like this:
docker run ... -e IFM_ROOT_DIR="/var/www/html" ...
The IFM offers the following configuration options. The names depend on wheather you use the PHP config or the environment variables.
$config |
env var | description |
---|---|---|
auth , auth_source
|
IFM_AUTH, IFM_AUTH_SOURCE | see authentication |
root_dir |
IFM_ROOT_DIR | Sets a custom root directory. By default the IFM is locked to its own directory, so you can't go above. Notice that the PHP user has to have sufficient permissions for the root_dir , otherwise IFM will not work. Regardless of whether the root_dir is set or not, the IFM will not follow symlinks, as long as the destination lies outside the root_dir . This is by design and cannot be changed. |
root_public_url |
IFM_ROOT_PUBLIC_URL | If you set a custom root_dir , the IFM cannot be sure if it is publicly available. Therefore it has a "proxy" API, which allows you to get the files anyway. However, if you don't want that, e.g. because you want to share links with people who are not allowed to access the IFM, and there is a way to publicly request these files, you can set a custom URL. This can be either relative (if it starts with a slash), or absolute (if it starts with http ). So, if you set the root_public_url to /www , the IFM builds the link with window.location.origin , your custom root_public_url part and the actual file (http://example.org/www/actual_file). If the first character is not a slash, IFM treats the URL as absolute, and simply adds the actual file name (http://other_subdomain.example.org/actual_file). |
tmp_dir |
IFM_TMP_DIR | Sets a custom temporary directory. This is used to save temporary zip files when you download an entire directory. Make sure the PHP user has write permissions there. |
timezone |
IFM_TIMEZONE | Sets a custom timezone (for supported timezones see this page). |
ajaxrequest |
IFM_API_AJAXREQUEST | Controls if the user is allowed to perform an ajax request. This was primarily used to debug the IFM in the development process and I didn't remove it since it's quite useful in some cases. |
chmod |
IFM_API_CHMOD | Controls if the user is allowed to change permissions of files and directories. |
copymove |
IFM_API_COPYMOVE | Controls if the user is allowed to copy or move files and directories. |
createdir |
IFM_API_CREATEDIR | Controls if the user is allowed to create directories |
createfile |
IFM_API_CREATEFILE | Controls if the user is allowed to create files. |
edit |
IFM_API_EDIT | Controls if the user is allowed to edit files. I'm not sure if it makes any sense that creating files and editing files are two separate permissions, but I never changed that. |
delete |
IFM_API_DELETE | Controls if the user is allowed to delete files and directories |
download |
IFM_API_DOWNLOAD | Controls if the user is allowed to download files. |
extract |
IFM_API_EXTRACT | Controls if the user is allowed to extract zip files. |
upload |
IFM_API_UPLOAD | Controls if the user is allowed to upload files. |
remoteupload |
IFM_API_REMOTEUPLOAD | Controls if the user is allowed to upload files remotely via an URL. |
rename |
IFM_API_RENAME | Controls if the user is allowed to rename files and directories. |
zipnload |
IFM_API_ZIPNLOAD | Controls if the user is allowed to download directories as zip files. |
showlastmodified |
IFM_GUI_SHOWLASTMODIFIED | Show the last modified column |
showfilesize |
IFM_GUI_SHOWFILESIZE | Show the filesize |
showowner |
IFM_GUI_SHOWOWNER | Show the owner (*nix only) |
showgroup |
IFM_GUI_SHOWGROUP | Show the group (*nix only) |
showpermissions |
IFM_GUI_SHOWPERMISSIONS | Show the permissions |
showhtdocs |
IFM_GUI_SHOWHTDOCS | Show files starting with .ht . Notice: If you disable this, the user is also not allowed to edit or create such files. |
showhiddenfiles |
IFM_GUI_SHOWHIDDENFILES | Show hidden files. Notice: If you disable this, the user is also not allowed to edit or create such files. |
showpath |
IFM_GUI_SHOWPATH | Shows the absolute path to the root_dir
|