Search code examples
phplinuxubuntulamp

exec function is not working in PHP


in php exec function is not working to run a shell command.

if I run in terminal

   $ avconv -i in.mp4 -f mp3 -ab 192000 -vn rip.mp3 

the command is working fine, the command is for converting a video to mp3. But when I try to execute through PHP it just doesn't work.

   exec("avconv -i in.mp4 -f mp3 -ab 192000 -vn rip.mp3");

or if I try exec("whoami"); is giving me the correct output.


Solution

  • okay, it was a file permission issue. www-data had not the permission to write the file, after changing the permission it's working now.