Search code examples
phpmp3exec

why my exec function is failing in live server?


I write a exec function to convert ogg to mp3 in my local its working fine but my main server its through an error trans failed.

below is my code.

exec("oggdec $file_path/{$file_name}.ogg -o - | lame - $file_path/{$file_name}.mp3",$output,$return);

file_path and file_name is also correct.


Solution

  • Assuming you mean shared host by live server :

    In most of shared hosts the OS functions are restricted because of security risks.


    Update: You can also run a command like this, try it for testing if its allowed or not :

    $cmd = `ls -l`;
    echo $cmd; 
    

    Or:

    shell_exec('ls -l');