HomePHP Page 2 - Setting Up a Web-Based File Manager: PHPfileNavigator2
Installing pfn2 - PHP
This is the second half of the two-part series titled “Setting Up a Web-Based File Manager.” Here we are going to continue with the installation and configuration of web-based file managers. We’ll present another freeware, open-source PHP-based file manipulation utility in the same way we explained bfExplorer in the previous part. This time, it’s going to be the PHPfileNavigator2 (pfn2).
As always, the first thing to do is visit pfn2’s official site (here). Then we download the latest version (at the time of writing, it is 2.3.3) in the appropriate language. In my case, that is English. You should also check out the documentation written by the author himself (here). That’s right. By now you should have already downloaded pfn2.
Extract its contents and direct them to a specific folder on your local machine. Upload it to a particular directory on your web server. Let’s say you upload it to “hostname.com/pfn-2.3.3/”. Find the file named “/data/conf/default-example.inc.php” in pfn2’s directory. Rename it “default.inc.php”. This is required to start the installation process. Another thing we need to set is the necessary permissions: read, write, and execution rights.
The following directories require the aforementioned permissions: “data/servidor/”, “data/conf/”, as well as the file named “data/conf/basicas.inc.php”. If you run your own server, then you “chmod 700,” but you can’t do this with paid hosting, which runs on a shared server system. Instead you should “chmod 777” (full access: rwxrwxrwx) these two directories and that one file. Then you can move on.
It’s time for us to find out the required server-side information before proceeding. You’ll see that as soon as we start the installation process, the script checks the server requirements. If it can continue, then it’s going to ask you for the necessary user information. So just redirect your browser to the path you’ve extracted -- pfn-2.3.3.
The script automatically launches at first. We’re going to need the following MySQL connection data: host (generally it is localhost), name (the name of a database; it can be the same one we created during the first part of this series because, due to prefixes, we won’t have conflicts), user (admin rights), password, and the prefix. The username is required to have modification rights to the database.
A problem can stem from the MySQL username. Some paid hosting services don’t explicitly state this and since you can work with your database from your cPanel administration control panel, “amateur admins” run into a dilemma when this kind of information is asked of them. However, in general, the username and password for the user with full control rights in the database is the same as the cPanel login.
As far as the prefix goes, leave that field intact on “pfn_” since it won’t cause conflicts. Chances are pretty low (almost none) that your database already has some tables with the prefix “pfn_”. Then comes the Administrator Data part – you need to type in the name of the administrator, its username, password, and e-mail address.
The e-mail address is required for advanced security features because pfn2 is able to detect unauthorized attempts and other abuses of the system. The system can then inform the administrator by sending him/her the wrong access alerts.
You also need to set up a main data root. The name for the main root can be anything. The Absolute Path requires the full path to the main root directory, such as “/home/hostname/public_html/files/” (usually with paid hosting on shared servers) or “/var/www/html/files/” (with your own server). Then you set the Web Path, which is the path for web access (“/files”). The host is useful when managing multiple domains because you can associate different roots.
On phase 1 – Introduction – pick your language and select “fresh install.” Proceed to the second step. Now the script has tested the necessary permissions. If this step is passed, then you can move on to the third one. If one of them failed, then go back and re-set the file attributes for that directory and/or file. Step three checks the server requirements, such as PHP, MySQL, GD, Zlib, etc.
It’s worthwhile to mention that by default PHP has 2M on the following variables: “upload_max_filesize” and “post_max_size”. This means that the maximum amount that can be uploaded (via HTML POST) through the PHP server is 2MB. If the server is your own, then changing the values of these variables in “php.ini” isn’t hard at all.
However, if you are on a paid hosting service on a shared system, then you don’t have access to the “php.ini”. On earlier versions of PHP you could use “.htaccess” directives to change these values, but lately this doesn’t work anymore. Your best bet is to contact the technical support for your hosting company and explain your need to have a higher limit for those two variables.
A while ago I faced the same situation. I contacted tech support and they were very friendly. We sorted out the problem. They only increased the limit to 16M (that is, 16MB) because this was their policy for shared servers. Nevertheless, 16MB should suffice when hosting via a web-based file manager. When you need to host larger files, you’ll do it via a FTP client anyway, so it’s fine.
Back to the installation process. The next two steps are pretty straightforward and you can just monitor the progress of the setup. Once it has successfully finished, don’t forget to rename the “instalar” folder, located in pfn2’s directory, to something along the lines of “instalar_backup” or something. If you fail to do this, then the installation process wants to start each time you visit pfn2.
Now you should fire up your web browser and type in the link for pfn2. It should be something like “hostname.com/pfn-2.3.3”. The login screen should pop up. On the next page, we are going to cover how to configure with some tips and tricks!