[PHP] exec command fails in php, works in the command line

2005-09-21 Thread ernst
I have two programs on two servers, and they both have similar problems. 
In each one, I use 'exec' to call a helper program.  In one case, it is 
ecasound, which I use to resample an mp3.  In the other, it is convert, 
which creates a thumbnail of a very large image the user has uploaded.  In 
both cases, the exec command fails.  Not all the time, but some times.  In 
both cases, the command that is being called by exec will work fine at the 
command line.  I assume that there is some memory / resource limit that is 
being breached when this happens, but I don't know what it is, or how to 
tell php to allow my programs to run.  Any ideas?


-Ernst Schoen-Rene

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



Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread John Nichel

[EMAIL PROTECTED] wrote:
I have two programs on two servers, and they both have similar problems. 
In each one, I use 'exec' to call a helper program.  In one case, it is 
ecasound, which I use to resample an mp3.  In the other, it is convert, 
which creates a thumbnail of a very large image the user has uploaded.  
In both cases, the exec command fails.  Not all the time, but some 
times.  In both cases, the command that is being called by exec will 
work fine at the command line.  I assume that there is some memory / 
resource limit that is being breached when this happens, but I don't 
know what it is, or how to tell php to allow my programs to run.  Any 
ideas?


Is it a disallowed function you your php.ini?

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread John Nichel

[EMAIL PROTECTED] wrote:
I have two programs on two servers, and they both have similar problems. 
In each one, I use 'exec' to call a helper program.  In one case, it is 
ecasound, which I use to resample an mp3.  In the other, it is convert, 
which creates a thumbnail of a very large image the user has uploaded.  
In both cases, the exec command fails.  Not all the time, but some 
times.  In both cases, the command that is being called by exec will 
work fine at the command line.  I assume that there is some memory / 
resource limit that is being breached when this happens, but I don't 
know what it is, or how to tell php to allow my programs to run.  Any 
ideas?


Or is save mode on?

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread John Nichel

Please reply to the list.

[EMAIL PROTECTED] wrote:
No, all of these things your are bringing up would cause the programs to 
NEVER work, not work some of the time or when the data they are 
processing is small.


Depends on the install.  My cli uses a different php.ini than the web one.

Did you check permissions?  Does the user which your web server is 
running as have execute permission on the app?



 On Wed, 21 Sep 2005, John Nichel wrote:


[EMAIL PROTECTED] wrote:

I have two programs on two servers, and they both have similar 
problems. In each one, I use 'exec' to call a helper program.  In one 
case, it is ecasound, which I use to resample an mp3.  In the other, 
it is convert, which creates a thumbnail of a very large image the 
user has uploaded.  In both cases, the exec command fails.  Not all 
the time, but some times.  In both cases, the command that is being 
called by exec will work fine at the command line.  I assume that 
there is some memory / resource limit that is being breached when 
this happens, but I don't know what it is, or how to tell php to 
allow my programs to run.  Any ideas?



Or is save mode on?

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--
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



--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread ernst
I don't want to crowd the list up with dead ends, so I was trying to 
respond only to you.
  I'm not calling a php program from exec, I'm calling ecasound and 
convert.  For example, in the php code:


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


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

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.




On Wed, 21 Sep 2005, John Nichel wrote:


Please reply to the list.

[EMAIL PROTECTED] wrote:
No, all of these things your are bringing up would cause the programs to 
NEVER work, not work some of the time or when the data they are processing 
is small.


Depends on the install.  My cli uses a different php.ini than the web one.

Did you check permissions?  Does the user which your web server is running as 
have execute permission on the app?



 On Wed, 21 Sep 2005, John Nichel wrote:


[EMAIL PROTECTED] wrote:

I have two programs on two servers, and they both have similar problems. 
In each one, I use 'exec' to call a helper program.  In one case, it is 
ecasound, which I use to resample an mp3.  In the other, it is convert, 
which creates a thumbnail of a very large image the user has uploaded. 
In both cases, the exec command fails.  Not all the time, but some times. 
In both cases, the command that is being called by exec will work fine at 
the command line.  I assume that there is some memory / resource limit 
that is being breached when this happens, but I don't know what it is, or 
how to tell php to allow my programs to run.  Any ideas?



Or is save mode on?

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--
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



--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--
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

Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread John Nichel

[EMAIL PROTECTED] 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
[EMAIL PROTECTED]

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



Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread ernst
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:



[EMAIL PROTECTED] 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
[EMAIL PROTECTED]

--
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

Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread John Nichel

[EMAIL PROTECTED] wrote:
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.


What do the logs say??

  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.


Maybe the problem's not php but Apache (or whatever webserver you're 
using), as it has limits in place for these items too.


--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread ernst

the logs say things like:
/kunden/homepages/12/d117065027/htdocs/software/ImageMagick-6.2.3/utilities/convert 
ib_images/Other_Spices_Basic_004.jpg -resize 180x120 ib_images/Other_Spices_Basic_004_thumb.jpg


this is a command I'm trying to get php to run.  I then cut and paste it 
to the command line, and it works fine.  the paths are fine too, otherwise 
it would never run, not run some of the time.
  Can you give me an example of an apache directive that would restrict 
php?




 On Wed, 21 Sep 2005, John 
Nichel wrote:



[EMAIL PROTECTED] wrote:
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.


What do the logs say??

  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.


Maybe the problem's not php but Apache (or whatever webserver you're using), 
as it has limits in place for these items too.


--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--
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

Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread John Nichel

[EMAIL PROTECTED] wrote:

the logs say things like:
/kunden/homepages/12/d117065027/htdocs/software/ImageMagick-6.2.3/utilities/convert 
ib_images/Other_Spices_Basic_004.jpg -resize 180x120 
ib_images/Other_Spices_Basic_004_thumb.jpg


this is a command I'm trying to get php to run.  I then cut and paste it 
to the command line, and it works fine.  the paths are fine too, 
otherwise it would never run, not run some of the time.
  Can you give me an example of an apache directive that would restrict 
php?


Timeout


 On Wed, 21 Sep 2005, John Nichel wrote:


[EMAIL PROTECTED] wrote:

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.



What do the logs say??

  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.



Maybe the problem's not php but Apache (or whatever webserver you're 
using), as it has limits in place for these items too.


--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--
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




--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread ernst
timeout isn't being used on either of these machines, and as far as I read 
it, the timeout directive would make the web server fail, producing an 
apache error or some strange behaviour on the client end.  Neither of 
these happens, the php script completes normally, but the exec command 
(and only these exec commands, I'm using others in the script that work 
fine) doesn't always complete.  Even if timeout was set to its normal 
default of 300 seconds, this all happens way before 300 seconds have 
passed.  The whole process takes about 20 or 30 seconds.



 On Wed, 21 Sep 2005, John Nichel wrote:


[EMAIL PROTECTED] wrote:

the logs say things like:
/kunden/homepages/12/d117065027/htdocs/software/ImageMagick-6.2.3/utilities/convert 
ib_images/Other_Spices_Basic_004.jpg -resize 180x120 
ib_images/Other_Spices_Basic_004_thumb.jpg


this is a command I'm trying to get php to run.  I then cut and paste it to 
the command line, and it works fine.  the paths are fine too, otherwise it 
would never run, not run some of the time.
  Can you give me an example of an apache directive that would restrict 
php?


Timeout


 On Wed, 21 Sep 2005, John Nichel wrote:


[EMAIL PROTECTED] wrote:

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.



What do the logs say??

  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.



Maybe the problem's not php but Apache (or whatever webserver you're 
using), as it has limits in place for these items too.


--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--
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




--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--
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

Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread John Nichel

[EMAIL PROTECTED] wrote:
timeout isn't being used on either of these machines, and as far as I 
read it, the timeout directive would make the web server fail, producing 
an apache error or some strange behaviour on the client end.  Neither of


How is timeout _not_ being used?  It's a core directive.  If the timeout 
is reached, the thread dies, along with anything running with it.


these happens, the php script completes normally, but the exec command 
(and only these exec commands, I'm using others in the script that work 
fine) doesn't always complete.  Even if timeout was set to its normal 
default of 300 seconds, this all happens way before 300 seconds have 
passed.  The whole process takes about 20 or 30 seconds.


Just to make sure I'm understanding you, you're hitting the php page in 
a browser, right?  Like you're going to http://www.yourhost.com/page.php 
where page.php contains somthing like...


?php

exec ( '/path/myapp', $out, $res );

?

Right?

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread ernst
as I said, the default timout is 300 seconds, a lot longer than my program 
takes to run, and I am pretty certain that if timeout were triggered, I'd 
see it in the client.
  Yeah, I'm using a browser on the php page, and everything seems to 
function fine from the browser to the server, it's after the server gets 
the uploaded file and begins to play with it that things become weird.


 On 
Wed, 21 Sep 2005, John Nichel wrote:



[EMAIL PROTECTED] wrote:
timeout isn't being used on either of these machines, and as far as I read 
it, the timeout directive would make the web server fail, producing an 
apache error or some strange behaviour on the client end.  Neither of


How is timeout _not_ being used?  It's a core directive.  If the timeout is 
reached, the thread dies, along with anything running with it.


these happens, the php script completes normally, but the exec command (and 
only these exec commands, I'm using others in the script that work fine) 
doesn't always complete.  Even if timeout was set to its normal default of 
300 seconds, this all happens way before 300 seconds have passed.  The 
whole process takes about 20 or 30 seconds.


Just to make sure I'm understanding you, you're hitting the php page in a 
browser, right?  Like you're going to http://www.yourhost.com/page.php where 
page.php contains somthing like...


?php

exec ( '/path/myapp', $out, $res );

?

Right?

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--
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

Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread John Nichel

[EMAIL PROTECTED] wrote:
as I said, the default timout is 300 seconds, a lot longer than my 
program takes to run, and I am pretty certain that if timeout were 
triggered, I'd see it in the client.
  Yeah, I'm using a browser on the php page, and everything seems to 
function fine from the browser to the server, it's after the server gets 
the uploaded file and begins to play with it that things become weird.


What's the output of...

$output = shell_exec ( '/path/to/your/app' );
echo ( pre . $output . /pre );

...when it doesn't work?


 On Wed, 21 Sep 2005, John Nichel wrote:


[EMAIL PROTECTED] wrote:

timeout isn't being used on either of these machines, and as far as I 
read it, the timeout directive would make the web server fail, 
producing an apache error or some strange behaviour on the client 
end.  Neither of



How is timeout _not_ being used?  It's a core directive.  If the 
timeout is reached, the thread dies, along with anything running with it.


these happens, the php script completes normally, but the exec 
command (and only these exec commands, I'm using others in the script 
that work fine) doesn't always complete.  Even if timeout was set to 
its normal default of 300 seconds, this all happens way before 300 
seconds have passed.  The whole process takes about 20 or 30 seconds.



Just to make sure I'm understanding you, you're hitting the php page 
in a browser, right?  Like you're going to 
http://www.yourhost.com/page.php where page.php contains somthing like...


?php

exec ( '/path/myapp', $out, $res );

?

Right?

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--
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




--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread ernst
convert doesn't produce any output regardless of whether it works or not. 
Ecasound produces output when it works, but when it doesn't, it produces 
no output.  Using php tricks to capture standard error also produces no 
output.




 On Wed, 21 Sep 2005, John Nichel wrote:


[EMAIL PROTECTED] wrote:
as I said, the default timout is 300 seconds, a lot longer than my program 
takes to run, and I am pretty certain that if timeout were triggered, I'd 
see it in the client.
  Yeah, I'm using a browser on the php page, and everything seems to 
function fine from the browser to the server, it's after the server gets 
the uploaded file and begins to play with it that things become weird.


What's the output of...

$output = shell_exec ( '/path/to/your/app' );
echo ( pre . $output . /pre );

...when it doesn't work?


 On Wed, 21 Sep 2005, John Nichel wrote:


[EMAIL PROTECTED] wrote:

timeout isn't being used on either of these machines, and as far as I 
read it, the timeout directive would make the web server fail, producing 
an apache error or some strange behaviour on the client end.  Neither of



How is timeout _not_ being used?  It's a core directive.  If the timeout 
is reached, the thread dies, along with anything running with it.


these happens, the php script completes normally, but the exec command 
(and only these exec commands, I'm using others in the script that work 
fine) doesn't always complete.  Even if timeout was set to its normal 
default of 300 seconds, this all happens way before 300 seconds have 
passed.  The whole process takes about 20 or 30 seconds.



Just to make sure I'm understanding you, you're hitting the php page in a 
browser, right?  Like you're going to http://www.yourhost.com/page.php 
where page.php contains somthing like...


?php

exec ( '/path/myapp', $out, $res );

?

Right?

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--
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




--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--
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

Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread John Nichel

[EMAIL PROTECTED] wrote:
convert doesn't produce any output regardless of whether it works or 
not. Ecasound produces output when it works, but when it doesn't, it 
produces no output.  Using php tricks to capture standard error also 
produces no output.


Hopefully somebody else on the list can help.  Without any output/error 
messages, it's kind of hard to know what the problem is.


--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread ernst

You're telling me.  That's why I think php or apache kills it.

On Wed, 21 Sep 2005, John Nichel wrote:


[EMAIL PROTECTED] wrote:
convert doesn't produce any output regardless of whether it works or not. 
Ecasound produces output when it works, but when it doesn't, it produces no 
output.  Using php tricks to capture standard error also produces no 
output.


Hopefully somebody else on the list can help.  Without any output/error 
messages, it's kind of hard to know what the problem is.


--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--
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

Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread Rasmus Lerdorf
[EMAIL PROTECTED] wrote:
 You're telling me.  That's why I think php or apache kills it.

I didn't really follow this, but typically you can debug exec problems
from the command line by switching to the web server user id and running
the exact same command.

-Rasmus

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



Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread ernst
Yes, but that's been done.  Since these are shared servers, on one I am 
logged in as the user the web server is running as, on the other I can't 
su to nobody, but were there permissions errors, I would have been able to 
capture them.  If permissions caused this, it would fail every time, since 
I'm always writing to the same directory.  Instead it only fails some of 
the time.


 On Wed, 21 Sep 2005, Rasmus Lerdorf wrote:


[EMAIL PROTECTED] wrote:

You're telling me.  That's why I think php or apache kills it.


I didn't really follow this, but typically you can debug exec problems
from the command line by switching to the web server user id and running
the exact same command.

-Rasmus



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



Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread rouvas
I am assuming that you get hold of the file through uploading it, correct?
So, when it fails maybe another upload (i.e. script invocation) is happening 
and the previous file gets lost/corrupted/whatever. Try to move the file to 
another dir (maybe /tmp) with a random name and see what happens.

Anyway, I think that this kind of thing should really be delegated to a 
cronjob.

-Stathis

On Wednesday 21 September 2005 20:45, [EMAIL PROTECTED] wrote:
 Yes, but that's been done.  Since these are shared servers, on one I am
 logged in as the user the web server is running as, on the other I can't
 su to nobody, but were there permissions errors, I would have been able to
 capture them.  If permissions caused this, it would fail every time, since
 I'm always writing to the same directory.  Instead it only fails some of
 the time.

   On Wed, 21 Sep 2005, Rasmus Lerdorf wrote:
  [EMAIL PROTECTED] wrote:
  You're telling me.  That's why I think php or apache kills it.
 
  I didn't really follow this, but typically you can debug exec problems
  from the command line by switching to the web server user id and running
  the exact same command.
 
  -Rasmus

 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



Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread ernst
php places uploaded files in the /tmp directory with a unique name, and 
when I copy them to my directory, I also guarantee a unique name for them. 
I have verified that this is all working.  I've patched this with a cron 
job that runs every minute, but it really should happen in php, so that 
the user can get immediate feedback on how the thumbnail looks or how the 
mp3 file sounds.


 On Wed, 21 Sep 2005, rouvas wrote:


I am assuming that you get hold of the file through uploading it, correct?
So, when it fails maybe another upload (i.e. script invocation) is happening
and the previous file gets lost/corrupted/whatever. Try to move the file to
another dir (maybe /tmp) with a random name and see what happens.

Anyway, I think that this kind of thing should really be delegated to a
cronjob.

-Stathis

On Wednesday 21 September 2005 20:45, [EMAIL PROTECTED] wrote:

Yes, but that's been done.  Since these are shared servers, on one I am
logged in as the user the web server is running as, on the other I can't
su to nobody, but were there permissions errors, I would have been able to
capture them.  If permissions caused this, it would fail every time, since
I'm always writing to the same directory.  Instead it only fails some of
the time.

  On Wed, 21 Sep 2005, Rasmus Lerdorf wrote:

[EMAIL PROTECTED] wrote:

You're telling me.  That's why I think php or apache kills it.


I didn't really follow this, but typically you can debug exec problems
from the command line by switching to the web server user id and running
the exact same command.

-Rasmus


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



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



Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread adriano ghezzi
did you tried to run the script from the shell as www-data user ?
(if not su www-data) an then run the script may be something regarding
permission

hth


2005/9/21, John Nichel [EMAIL PROTECTED]:
 [EMAIL PROTECTED] wrote:
  I have two programs on two servers, and they both have similar problems.
  In each one, I use 'exec' to call a helper program.  In one case, it is
  ecasound, which I use to resample an mp3.  In the other, it is convert,
  which creates a thumbnail of a very large image the user has uploaded.
  In both cases, the exec command fails.  Not all the time, but some
  times.  In both cases, the command that is being called by exec will
  work fine at the command line.  I assume that there is some memory /
  resource limit that is being breached when this happens, but I don't
  know what it is, or how to tell php to allow my programs to run.  Any
  ideas?

 Or is save mode on?

 --
 John C. Nichel
 ÜberGeek
 KegWorks.com
 716.856.9675
 [EMAIL PROTECTED]

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



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



Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread ernst

yeah, if you look at the thread you will see that I've already done this.

On Wed, 21 Sep 2005, adriano ghezzi wrote:


did you tried to run the script from the shell as www-data user ?
(if not su www-data) an then run the script may be something regarding
permission

hth


2005/9/21, John Nichel [EMAIL PROTECTED]:

[EMAIL PROTECTED] wrote:

I have two programs on two servers, and they both have similar problems.
In each one, I use 'exec' to call a helper program.  In one case, it is
ecasound, which I use to resample an mp3.  In the other, it is convert,
which creates a thumbnail of a very large image the user has uploaded.
In both cases, the exec command fails.  Not all the time, but some
times.  In both cases, the command that is being called by exec will
work fine at the command line.  I assume that there is some memory /
resource limit that is being breached when this happens, but I don't
know what it is, or how to tell php to allow my programs to run.  Any
ideas?


Or is save mode on?

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

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




--
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