Installation Instructions for a Quick Start
The server infrastructure for the example program requires a web server that can run PHP code, and the PHP interpreter has to be compiled with the support of the selected RDBMS. In my case, I chose the LAMP framework: Linux (Debian), Apache, MySQL and, obviously, PHP. The following installation instructions assume you have working installs of Apache 2.X, PHP 5.X, and MySQL 4.X, as well as an Internet connection.
To begin, download the accompanying source code for this article, and extract the file_sharing.zip file under the web server documents root (from now on [document_root]) with the following command:
PEAR MDB2 Installation
The installation of PEAR packages requires an installer that you already have available if you installed PHP version 4.3.0 or higher. If so, you just run this on the command line:
pear install MDB2
pear install MDB2#mysql
To install the Smarty template engine (more on Smarty later), run the following if you are a Debian user:
apt-get install smarty
If you use another Linux system, take the following steps:
- Download the latest version of Smarty.
- Extract it under any directory you chose (e.g., /usr/local). This example will use [installation_dir] going forward.
- Create the directories [installation_dir]/smarty/templates_c and [installation_dir]/smarty/cache.
- Download the overLIB zip file.
- Go to the [document_root] directory and run the following commands:
- Extract the overLIB zip file.
Create your MySQL database schema with this command:
mysqladmin –u[user] –p[password] <file_sharing.sql
Setting Configuration Variables
As the file inc.config.php in the source code download explains, there are global variables specific to local installation. Set these variables as suggested in Table 1 below.
|Table 1. Suggested Settings for Configuration Variables: These are global variables specific to local installation. |
||where PEAR installation copies MDB2.php file
When all the above installations are complete, you can call http://yourserver/file_sharing/file_sharing.php (see Figure 1) and start to upload files (see Figure 2).
Figure 1. File-Sharing Application Home Page: This figure shows the uploaded and tagged files with the list of used tags.
Figure 2. File-Sharing Action Pop-Up: This figure shows the pop-up opened after clicking on a file.
|Author's Note: Versions 6 and 7 of Internet Explorer send the inner text of a button instead of its value, which is counter to the W3C recommendation. So if you would like to use these IE versions for this example, you have to replace all <button> instances in .tpl files with <input>, which will sacrifice some CSS benefits.|