Re: exec command fails in php, works in the command line

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If the web server didn't have permission to execute the app, it would NEVER execute the app, not execute it some of the time. In fact, it ALWAYS executes the app, it just doesn't always allow it to finish. I log all attempts to run these apps in order to debug, so I know that the command as passed from php will work in the command line. I copy and paste the command from the log and it runs, even though it didn't complete execution when called from php. I have increased several parameters in php.ini, including memory limit and allowed execution time. Nothing has helped. The only thing that helps is if I wrap the app I want to run in a perl script and call the perl script from php. That works more of the time, though it still often breaks.



On Wed, 21 Sep 2005, John Nichel wrote:

ernst@xxxxxxxxxxxxxxx wrote:
I don't want to crowd the list up with dead ends, so I was trying to respond only to you.
<snip>

You'll get more chances at finding the solution to this with the list's eyes on it rather than just myself. Plus, it provides an archive of the problem and the (if we find it) solution to the next person who comes along.

</snip>
I'm not calling a php program from exec, I'm calling ecasound and convert. For example, in the php code:
<snip>

Understood, but if the web server doesn't have permission to execute the app, it won't.

</snip>
exec("convert $internalpath/$filename -resize {$thumbWidth}x{$thumbHeight} $internalpath/$thumbname", $out, $err);

doesn't always work, but with variables substituted on the command line:
<snip>

Are you sure that the variables have value, and it is the value you want? What is stored in $err when you try to execute this? Echo that out, and it may tell you exactly what's going wrong.

</snip>
bash:~> convert futon.jpg -resize 240x180 futon_thumb.jpg

will always work.

The same is true, on a different server, of my exec that calls ecasound, an mp3 processing utility. Both of these could conceivably use a lot of resources, which is why I think php is killing them off some of the time.
<snip>

Try increasing the memory limit in your script with ini_set.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
john@xxxxxxxxxxxx

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


New Disorder Records - ten years of something:
Coming soon, new Power Struggle CD.
* Free Email with 5 megs, no ads
* Internet Radio Station - upload your music, we'll put it in rotation
* 100's of CDs for sale
* videos, message board, byofl
http://www.newdisorder.com
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux