Index of /lamp_chmearl

[ICO]NameLast modifiedSizeDescription

[DIR]Parent Directory  -  
[DIR]510/21-Jun-2014 12:29 -  
[DIR]514/12-Dec-2013 18:33 -  
[DIR]518/21-Jun-2014 12:32 -  
[TXT]README.html27-Jan-2010 13:15 7.8K 
[TXT]chm.reg.txt18-Nov-2007 23:08 146  
[TXT]chm_py.txt18-Nov-2007 23:08 4.6K 
[TXT]chmdumptoc.vbs.txt18-Nov-2007 23:08 3.9K 
[   ]chmearl.tar.gz18-Nov-2007 23:08 236K 
[TXT]chmreg.reg.txt18-Nov-2007 23:08 146  
[TXT]exmirror.txt18-Nov-2007 23:08 60  
[IMG]konqwarn.png18-Nov-2007 23:08 343K 
[   ]libtext-chm-perl_0.01-1_amd64.deb15-Feb-2010 09:12 15K 
[TXT]myfstab.txt18-Nov-2007 23:08 498  
[IMG]snapshot1.png18-Nov-2007 23:08 344K 
[   ]url_restrict19-Apr-2010 10:50 298  

ChmEarl Ebook Repository

Announcing ChmEarl

This is a small LAMP+KDE project to make a client/server repository for CHM 
files. In your workgroup, a single machine acting as a CHM web server can allow an unlimited number of client 
machines to view a (arbitrarily large) library of CHM files with a web browser. All the CHM files are stored and managed on a 
single machine. The clients are freed to view the ebooks without the trouble of managing them.
Win32 clients must use Internet Explorer and Linux clients must use Konqueror -- this
restriction is tied to the io-slave support provided by these two Applications.

The CHM compressed file format is quite well thought out. It's not widely known that every individual component 
HTML page can be separately addressed in a browser. When each chapter's URL and title are stored in a MySQL DB, 
we can quickly search for our desired chapter, then instantly bring up that page in our web browser, in Linux or Win32.

Furthermore, many CHM compilation tools add a binary index into the resulting CHM file. Now we have the feature called 
full-text search. We are currently using package python-chm for this.

Target Environment

The included gzip file is setup for Fedora Core 4 Linux. IOW your single CHM server should run in FC4, while the clients can be almost anything, whether Win32 or Linux. You will need Apache2, MySQL, phpMyAdmin, and Mod_Perl installed. I find that Mod_Perl is upto 5 times faster than forked CGI. It is recommended to store the CHM files in a vfat partition. The default mount point is /windows/d (vfat). Then the root path to the library will be /windows/d/ebooks. This project assumes you are running SAMBA on the FC4 host. Hence you need to make public/writable/browsable the ebooks folder. #cat ./conf/smbadd.conf >> /etc/samba/smb.conf or open the Samba system configuration dialog. My partition is 55 GB. My 550 CHM files require around 5 GB. The rest of the space I plan to use for other multimedia files used cross-platform.


You will need some FC4 RPM packages and a single Perl module


python-chm chmlib chmlib-devel kchmviewer Support for the ms-its io-slave comes in package kdevelop, via kchmpart. As you can see this project is for the KDE (kdm) desktop -- the Gnome (gdm) desktop is not supported. AFAIK, there are no io-slaves for CHM in Gnome/Nautilus. If you don't want to install kdevelop, then your clients will have no ms-its until they install kchmviewer (yum install kchmviewer --enablerepo=dries). With kdevelop you can readily compile kchm, which provides chmnewpart support into konqueror. The kchm io-slave is [chm:].

CPAN module:

Text::CHM /* this should be packaged as RPM now (>2008)- do #yum install perl-Text-CHM */ #perl -MCPAN -e 'install Text::CHM'

Integration with phpmyadmin

This project adds a new table to the phpmyadmin database. The table is called pma_access. It is used for password storage. You can setup it up for your users by running the script ./script/AutoGenSQL/ There is an anonymous array for your user/pwd pairs. For defaults, simply open the mysql cli by doing #cd ./scripts/AutoGenSQL/ #mysql -u root -p (enter pwd) >source junk1.sql; >quit be sure to use your pma password that you included in ./phpmyadmin/

Our necessary MySQL users

See the script ./sql/grants.sql to add the 2 users to MySQL needed for our project. That script also adds privileges.

Project Root

You will want to extract the gzip file into /usr/share. Do #cd /usr/share #tar xvzf /path_to/chmearl.tar.gz

Apache2 Configuration

to tell Apache2 about us, copy ./conf.d/* to /etc/httpd/conf.d/ copy ./images to /var/www/html/images Once Apache2 is restarted #/etc/init.d/httpd restart then you can launch the main window (later) as http://localhost/chmearl/SQL_Test.shtml The two CONF files setup the registry handler for mp2, turn on SSI, make an alias for our html folder, and add an mp2 startup script.

Your System Configuration

This folder ./conf contains your system configuration files. The insertion scripts mentioned below need this data to be right for your system. Go there now and make changes. Especially change all instances of LMP-7053DF1FAFC to the name of your box.

Doing Insertions and loading the data

Start by adding the folder: #mkdir/var/www/html/images/ebooks/ There are three PL scripts that grab our data from the CHM files. 1) -- will define the DB tables and get the basic data. 2) -- will add the css style paths and cover images to the DB. 3) -- will finally extract all the cover images and put them in your web image folder defined earlier. Run these three in the order shown as root from the CLI. You should redirect output #perl > myout.out (to speed things up)

Logging from myadmin.cgi

You can create a debug log, but it must be #chown apache:apache the variable is chmlog in ./conf/earl.conf

CHM File Viewers

You need to use a viewer that provides an io-slave available to your browser. At this time there are only limited choices of viewer/browser pairs. I use kchmviewer/konqueror in Linux and InternetExplorer/ms-its in Win32. Its easy to also use kchm in FC4. The project compiles with no trouble if you setup your machine for kde-develop. Linux clients will need to mount an ebooks folder for best results -- something Windows does for you. The server script will detect a Linux client and use the mount point: /mnt/ebooks. I get best results with NFS in this situation -- tests with SAMBA (Linux-Linux) showed poor/slow response. SAMBA works best for Windows-Linux. To mount I use this #mount -t nfs /mnt/ebooks To share a folder on the server via NFS, use the python applet: >system-config-nfs then add the folder /windows/d/ebooks (whatever you choose).

KDE-Konqueror untrusts http-->ms-its redirects

Append the following file (indexed above) to kdeglobals to restore trust for this operation. >cat url_restrict >> .kde/share/config/kdeglobals Without this reconfig, you will see a warning from konqie when redirecting to an ms-its file from an http-web page.

Windows blocks viewing CHM files over LAN

If you are running WinXP sp2+ (or Vista|Win7) with all updates as of Feb 2006 (or Win2k3), you will need to add this registry fix to view CHM files remotely over the LAN: [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions] "MaxAllowedZone"=dword:00000001 Merge chmreg.reg into registry to fix the security restriction. At the same time remember that any CHM file that you want to be part of the library should be pre-checked for virus. I use a perl script to do this. Any embedded BAT,COM, or EXE means trouble.

Project History

I started development in January 2004 in Win2k. By June 2005, I had a prototype for SuSE 9.2. I have since installed it on 2 FC4 boxes setup as dev/web boxes. Amazingly it all began on Windows. It runs much cleaner and faster on Linux thanks in part to the great reverse engineering needed to code chmlib!


As of January 2006, Chmearl now can run as a server on SuSE x86_64. The author of chmlib has a new release that supports 64 bit platforms. Before that work, several needed modules failed to compile for SuSE x86_64. msp December 4, 2005