0

I have problem with script that running screen session.

<?php  exec("screen -m -d ffmpeg2theora -v 3 /path/to/video.mp4");  ?>

and see this on logs:

Wed Oct 17 16:17:39 2012] [error] [client 83.5.x.x] sh: 1: screen: not found, referer: http://xxxxxx.xx

It's stop working on some update (apache/php/suphp?), before that was working like charm Any idea's what's happend, how configure suPhp/Apache?

hakre
  • 193,403
  • 52
  • 435
  • 836
r4ven
  • 303
  • 2
  • 11
  • 2
    What happens when you run that same command from your command line? – afuzzyllama Oct 17 '12 at 15:11
  • 4
    It looks like your Path variables aren't set. So you'll need to run `which screen` which will give you the full path of the executable. Something that will look like `/usr/bin/screen` – james_t Oct 17 '12 at 15:14
  • @afuzzyllama when run script from from bash (php5-cli -f file.php) session is started and movie is converted – r4ven Oct 17 '12 at 15:18
  • I think @james_t has the answer to your problem – afuzzyllama Oct 17 '12 at 15:20
  • Why do you want to use screen to do this anyway? – Explosion Pills Oct 17 '12 at 15:22
  • @Explosion Pills i don't want hold executing script until conversion is done. when video file is large php throw execution time error, but if you have any better idea to solve this i'm listening – r4ven Oct 17 '12 at 15:31

2 Answers2

0

Instead, simply do:

exec("ffmpeg2theora -v 3 /path/to/video.mp4 &");
Explosion Pills
  • 188,624
  • 52
  • 326
  • 405
0

If you want PHP to start a long-running command in the background, why not try the following:

<?php pclose(popen("/usr/bin/nohup /path/to/ffmpeg2theora -v 3 /path/to/video.mp4 >/tmp/result 2>&1", "r")); ?>

It's always wise to use explicit paths to commands in these sorts of situations.

Brian Showalter
  • 4,321
  • 2
  • 26
  • 29