Apache::FileManager - apache mod_perl file manager


Install in mod_perl enabled apache conf file <Location /FileManager> SetHandler perl-script PerlHandler Apache::FileManager </Location>

Or call from your own mod_perl script use Apache::FileManager; my $obj = Apache::FileManager->new(); $obj->print();


The Apache::FileManager module is a simple HTML file manager. It provides file manipulations such as cut, copy, paste, delete, rename, extract archive, create directory, and upload files. The interface is clean and simple, and configuration is a breeze.

For those of you who are up to the challenge, you can configure Apache::FileManager on run on a development server and update your live server htdocs tree with the click on a button.


  The following (non-code) perl modules must be installed before installing Apache::FileManager.

      Apache::Request => 1.00
      File::NCopy     => 0.32
      File::Remove    => 0.20
      Archive::Any    => 0.03
      CGI::Cookie     => 1.20


Make sure the web server has read, write, and execute access access to the directory you want to manage files in. Typically you are going to want to run the following commands before you begin.

chown -R nobody /web/xyz/htdocs chmod -R 755 /web/xyz/htdocs

The extract functionality only works with tarballs and zips.


To use the rync functionality you must have ssh, rsync, and the File::Rsync perl module installed on the development server. You also must have an sshd running on the production server.

Make sure you always fully qualify your server names so you don't have different values in your known hosts file. for example: ssh my-machine - wrong ssh - right

Note: if the ip address of the production_server changes you will need a new known_hosts file.

To get the rsync feature to work do the following:

  #1 log onto the production server

  #2 become root

  #3 give web server user (typically nobody) a home area
     I made mine /usr/local/apache/nobody
     - production_server> mkdir /usr/local/apache/nobody
     - edit passwd file and set new home area for nobody
     - production_server> mkdir /usr/local/apache/nobody/.ssh

  #4 log onto the development server

  #5 become root

  #6 give web server user (typically nobody) a home area
     - dev_server> mkdir /usr/local/apache/nobody
     - dev_server> chown -R nobody.nobody /usr/local/apache/nobody
     - edit passwd file and set new home area for nobody
     - dev_server> su - nobody
     - dev_server> ssh-keygen -t dsa      (don't use passphrase)
     - dev_server> ssh production_server (will fail but will make known_hosts file)
     - log out from user nobody back to root user
     - dev_server> cd /usr/local/apache/nobody/.ssh
     - dev_server> scp production_server:/usr/local/apache/nobody/.ssh/authorized_keys
     - dev_server> chown -R nobody.nobody /usr/local/apache/nobody
     - dev_server> chmod -R 700 /usr/local/apache/nobody

  #7 log back into the production server

  #8 become root

  #9 Do the following commands:
     - production_server> chown -R nobody.nobody /usr/local/apache/nobody
     - production_server> chmod -R 700 /usr/local/apache/nobody

You also need to specify the production server in the development server's web conf file. So your conf file should look like this:

     <Location /FileManager>
       SetHandler           perl-script
       PerlHandler          Apache::FileManager
       PerlSetVar           RSYNC_TO   production_server:/web/xyz

If your ssh path is not /usr/bin/ssh or /usr/local/bin/ssh, you also need to specify the path in the conf file or in the contructor with the directive SSH_PATH.

You can also specify RSYNC_TO in the constructor: my $obj = Apache::FileManager->new({ RSYNC_TO => "production_server:/web/xyz" });

Also make sure /web/xyz and all files in the tree are readable, writeable, and executable by nobody on both the production server AND the development server.


I am sure there are some.


It would be nice if you could choose a different base directory other then the document root in the constructor. I may do this sometime if I have a need to. If you want to contribute, let me know.


Apache::FileManager was written by Philip Collins <>.