-
Notifications
You must be signed in to change notification settings - Fork 69
Configuration
There are several ways to configure the IFM. At the moment you can either change the default configuration at the top of the script, or pass a custom configuration array to the constructor (when using libifm.php
). Furthermore it is possible to configure the IFM via 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. |
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. |
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
|