Apache needs to be reconfigured to use Embperl to process HTML files. This requires a decision about how to use this module: whether to process every file with Embperl or to tag Embperl files with a special extension ( .epl is commonly used) so that only those files are processed .
Processing only the files with the different filename extension is more efficient. The drawbacks are that the extension gives out information about the server, and URLs aren't uniform, which presents a human factors issue ”people remember .html and don't remember .epl .
There is another good reason not to use special filenames. Suppose you have a page that has no Embperl and is linked everywhere else in your site. If you decide that page needs Embperl, it must be renamed , and all references to that file changed everywhere on your site. If that page is linked externally, it will be wrong on all the search engines.
If you do decide to create a special filename extension such as .epl , add this to Apache's configuration file:
<Files *.epl> SetHandler perl-script PerlHandler HTML::Embperl Options ExecCGI </Files> AddType text/html .epl
We choose to not use a special extension. Instead, we'll limit the use of Embperl to a certain directory within the web document tree for only HTML files (files ending in .html ).
By limiting it to one directory, only the .html files under that directory and its subdirectories will be processed by Embperl ” .html files in other directories will not be affected by Embperl. This is a good compromise.
Make a directory for the Embperl stuff:
$ mkdir /var/www/html/embperl $ chmod a+rx /var/www/html/embperl
As root , add the following to the bottom of /etc/httpd/conf/httpd.conf :
SetEnv EMBPERL_DEBUG 2285 PerlSetEnv EMBPERL_LOG /var/log/embperl.log <Directory /var/www/html/embperl> <Files *.html> SetHandler perl-script PerlHandler HTML::Embperl Options ExecCGI </Files> </Location>
The SetEnv directive sets the variable EMBPERL_DEBUG to the value 2285 . This sets the debugging level to a very high value, causing a great deal of output to be written to the log file (here configured to be /var/log/embperl. log ).
To have a minimal amount of log information, set EMBPERL_DEBUG to 1 . More is good for now ”you can change it later after you get used to using it. For fun, run tail -f /var/log/embperl.log in a terminal to see the debug information as it is generated.
Configuring the log file to be in /var/log/embperl.log requires that the webserver apache be able to write to this file.  So, as root , execute these commands to create the file and give it the proper owner and permissions:
# touch /var/log/embperl.log # chmod gw-rwx /var/log/embperl.log # chown apache /var/log/embperl.log
The <Directory> directive says that for the directory /var/www/html/embperl and its subdirectories, the following specifications are applied. The <Files *.html> directive tells Apache to process only .html files with HTML::Embperl! Files with .txt and .jpg extensions in these directories are normal files that should not processed by Embperl and should be served up plain. See perldoc HTML::Embperl for all the different ways to configure this directory.
Now, load the changed Apache configuration file:
# /etc/init.d/httpd graceful