Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
exec oil task ignored from controller!?
  • hi,
    am using fuelphp to convert some video files, in my controller i use "exec" to start ffmpeg processing.

    the first step i create thumbs, and retrieve video info with no problems, using exec and ffmpeg but when i launch the conversion task using exec("FUEL_ENV=production /usr/local/php53/bin/php -q ".APPPATH."oil refine videos:convert $vid"); it ignore the command, and nothing is converted!
    it happen only in remote linux host. on my local windows everthing is working fine!! with a little change for the command exec("start php ".APPPATH."oil refine videos:convert $vid");

     I've redirected  the output using "$command > output.txt 2>&1", in the file i found the json response of the controller instead of the exec output ... so am out of idea!!!
  • I wonder how this can ever work, APPPATH is not the location of the oil script...
  • i've moved the oil script and configured it to work inside the application path!! so it works in local machine and when i run the full  command from the shell
  • Ah, ok.

    I don't use exec() myself, so I can't help you on this, but I know on some linux flavours you need to use "env FUEL_ENV=production...", perhaps this is the case here?
  • i got the same issue with env, also i tried popen and shell_exec to execute the command, but it fail too , and there is no error! so i've changed the oil script permissions to 777 and nothing happens... the generated command works fine on shell...

  • I've also created a new action in the controller, with only the command to execute ... still blocked with the same issue... so i will try to run a standard php file to catch this issue. 
  • the result is the same... i've created a standalone php script containing only the full command to be executed but still the same issue...
  • the same command copied and pasted to shell, works !!! 
  • Might be your exec() then.

    Are you sure it's available on your server? Some hosting companies cripple their PHP installation with the rediculous idea that it would make their environment safer...
  • yes, i used it to create thumbnails directly with the ffmpeg, i've tried exec , and popen and no error or warning returned, so i switched to "system" and got a warning "Unable to fork [env HTTP_FUEL_ENV=production .... "
  • i should see this issue with the hosting company, maybe there is permissions issue  !
  • Looks indeed like they've blocked something...
  • runing the command : 

    "env FUEL_ENV=production /usr/local/php53/bin/php /path/to/oil -v", 
    recieving the error : 
    "Warning: exec() [function.exec]: Unable to fork [env HTTP_FUEL_ENV=production /usr/local/php53/bin/php /path/to/oil -v] in /path/to/public_html/test.php on line 2

    the company hosting still give no response for my ticket, :\
  • also i got a lot of "Content-type: text/html" repeated in the exec output followed by Warning: exec() [function.exec]: Unable to fork ...
  • HarroHarro
    Accepted Answer
    I see a lot of reports of this issue from Windows users, but not from linux users.

    It could be that the user apache runs under doesn't have shell access on your server (which would be logical in a hosted environment), in which case it will never work. But you'll have to wait for the reply from your hosting company.
  • thank you very much, am still waiting  for their reply ...

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion