I think you're doing something wrong there....43500 html files is kind of an overkill. The purpose of ebooks is to have digital publications not html portations of php sites. Either way there are 2 scenarios for ebooks: reflowable content (case in which you could have your content split into far less files) or fixed layout (case which I find kinda unrealistic since fixed layout usually is a digital copy of a book/publication and no way would a book have than many pages). My guess is that you are trying to port a site to an ebook format, generating a html page for each entry in the database. If this is the case I would suggest that you would switch from ur static htmlpages engine to a more suited Javascript based one in which you would import the info you need when you need it (even if is static/embedded).