2

I have PHP application that uses pdf2htmlEX and HTMLpurifier to convert pdf documents to text format. Conversion process consist of few steps:
1. uploading book using web browser
2. conversion from pdf to txt using pdf2htmlex
3. processing txt files using HTMLPurifer

For most of the documents everything works properly but for some documents with a lot of pages (more than 230) step 3 fails. While HTMLpurifier processes page it raises error: "PHP Fatal error: Maximum execution time of 0 seconds exceeded". In my configuration max_execution_time is set to 0. I've attached strace to Apache process and here's the output just before termination:

lstat("/tmp/books/3349/html/78.page", {st_mode=S_IFREG|0644, st_size=40165, ...}) = 0
open("/tmp/books/3349/html/78.page", O_RDONLY) = 20
fstat(20, {st_mode=S_IFREG|0644, st_size=40165, ...}) = 0
lseek(20, 0, SEEK_CUR)                  = 0
fstat(20, {st_mode=S_IFREG|0644, st_size=40165, ...}) = 0
read(20, "<div class=\"pd w1 h1\"><div id=\"p"..., 8192) = 8192
read(20, "AACAsAQAAQFgCAAAgLAEAABCWAAAACEs"..., 8192) = 8192
read(20, "7\"><span class=\"_ _1f\"> </span>F"..., 8192) = 8192
read(20, "class=\"_ _8\"> </span>of<span cla"..., 8192) = 8192
read(20, "/span></div><div class=\"t m1 x7a"..., 8192) = 7397
read(20, "", 8192)                      = 0
read(20, "", 8192)                      = 0
close(20)                               = 0
lstat("/tmp/books/3349/text/78.txt", 0x7fff115a43f0) = -1 ENOENT (No such file or directory)
open("/tmp/books/3349/text/78.txt", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 20
fstat(20, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
lseek(20, 0, SEEK_CUR)                  = 0
write(20, "66 2. TOPOSESa \357\254\201xed space is a"..., 2157) = 2157
close(20)                               = 0
lstat("/tmp/books/3349/html/79.page", {st_mode=S_IFREG|0644, st_size=48214, ...}) = 0
open("/tmp/books/3349/html/79.page", O_RDONLY) = 20
fstat(20, {st_mode=S_IFREG|0644, st_size=48214, ...}) = 0
lseek(20, 0, SEEK_CUR)                  = 0
fstat(20, {st_mode=S_IFREG|0644, st_size=48214, ...}) = 0
read(20, "<div class=\"pd w1 h1\"><div id=\"p"..., 8192) = 8192
read(20, "AWAIAACAsAQAAYN5hAoBPSWIEdtXWCAD"..., 8192) = 8192
read(20, "=\"_ _0\"></span>oof<span class=\"f"..., 8192) = 8192
read(20, "c\"></span>).</span></div><div cl"..., 8192) = 8192
read(20, "lass=\"_ _23\"> </span>sho<span cl"..., 8192) = 8192
read(20, "ls0 ws0 r0\">F<span class=\"ff4\"><"..., 8192) = 7254
read(20, "", 8192)                      = 0
read(20, "", 8192)                      = 0
close(20)                               = 0
--- SIGPROF (Profiling timer expired) @ 0 (0) ---

What's interesting - I have two environments in the same system configuration - one in AWS and another VM in VirtualBox. Both have Ubuntu 12.04 + Apache 2.2 + PHP 5.4.13, configuration setting are the same, but problem occurs only on AWS node. Any idea?

3
  • What happens when you add an actual execution limit? Like say, 60 seconds?
    – Nathan C
    May 17, 2013 at 13:52
  • 1
    Have you checked whether the web server has a timeout that gets hit? See php.net/manual/en/info.configuration.php#ini.max-execution-time It feels somewhat far-fetched, but you never know and it should be pretty easy to check...
    – user
    May 17, 2013 at 14:16
  • Thanks guys for feedback. I've checked all timeouts except one - max_input_time. I didn't realized it can have anything in common May 17, 2013 at 15:21

1 Answer 1

4

It was problem with too little value set for option max_input_time. When I've increased it, problem disappeared. This PHP error message is very misleading.

1
  • 1
    I'm glad that you solved it, but that's exactly what the error / config parameter relate to: setting a maximum time that a process can run. Yes, in many places "0" would mean "no limit", but here it's interpreted literally.
    – gWaldo
    May 17, 2013 at 17:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .