Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP Internal Server Error 500 when using ffmpeg to convert files
    primarykey
    data
    text
    <p>I've a PHP script that it's being called with a cron job in my server to run uploaded video conversions. It works fine for some videos, but when the video is a bit larger (21MB for example) I get a <code>500 Internal Server Error</code> and no other output. </p> <p>I think that it's possible that this problem was due to timeouts so I've added <code>set_time_limit(9000)</code> and also <code>ini_set('max_execution_time', 9000)</code> to prevent this, but this does not solve anything. </p> <p>I execute ffmpeg using:</p> <pre><code>$cmdOut = shell_exec ('ffmpeg -y -i [....] 2&gt;&amp;1'); // [....] is the rest of the command, it works fine with other videos, so i assume that it works ok. echo print_r($cmdOut); </code></pre> <p>However there is no output, and the following lines are not being executed, so after the <code>shell_exec</code> the script is aborted. </p> <p>Looking at the apache error_log I can see this line:</p> <pre><code>[Wed Jan 12 00:12:46 2011] [error] [client xx.xxx.xxx.xxx] Premature end of script headers: index.php </code></pre> <p>But there are no other clues. Can anyone help me?</p> <p>For testing purposes i've created this PHP script:</p> <pre><code>&lt;?php set_time_limit(300); sleep(120); echo "SLEEP OUT"; ?&gt; </code></pre> <p>This script causes a "500 Internal Server Error" when i call it from my web browser, so i suppose that set_time_limit is not working. If i put sleep(30) it works and it returns the text SLEEP OUT. So the question is, how can i avoid the timeout error to execute a PHP script that is taking 5 or 10 minutes to complete??</p> <p>NOTE: Server is CentOS running apache and php as FastCGI module.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload