Windows XP Pro
Service Pack 3 / .Net 3.5
Apache 2.2.11
PHP 5.2.9-2
Hi,
In a website project I have to convert mathematical formulas into .png images with LaTeX in my PHP code. The problem I have is that when I call LaTeX from PHP, the program takes for ever to execute and PHP crash after the timeout have been reached.
And this, even if everything went normally without any error with latex.exe. However, in command line, this process takes a fraction of a second to execute without any error too.PHP Fatal error: Maximum execution time of 30 seconds exceeded in C:\WWW\lc.workspace.com\site\index.php on line 44
My homework so far:
Like suggested in another forum, I have added this to my php file:
Code: Select all
ini_set("max_execution_time", "240");Code: Select all
exec($command);
exec($command . " >NUL");
exec("start /B " . $command);
shell_exec($command);
pclose(popen("start ". $command, "r"));
$output = array();
$result = null;
$return = exec($command, $output, $result);
or
exec('start /B "'.$command.'"', $output, $return);Once the timeout problem resolved, I don't have any error in the Apache logs.
In php.ini, safe_mode is Off and disable_functions is Off like suggested elsewhere.
I have tried some simple commands to test for permissions, like "dir *.*" and "copy from to"... Every things works fine, with the dir command, the folder is listed in the output array. With the copy command, the file is copied and I have the message "1 file(s) copied." in the array. All of these tests with other command went fine and took a fraction of a second to execute.
I had the idea to look what was going on in the windows task manager to see what is happening. It's weird, when I execute latex.exe through PHP, the processor usage go to 90% to 100% during 2 minutes 40 secondes or so, until the process stop and then everything comes back to normal. When I do the same command in command line, I can't even see the process in the task manager, it's too fast. And CPU usage doesn't even budge. This isn't normal?
So here I am... I'm a bit lost now.
Thanks for your help and suggestions.
Sébastien.