OK,
I have done some creative searches and am kind of hitting a road block.
I am trying to use the linux program "sox." I am trying to call it from my PHP script. The script DOES work if I use the command line. However, when I use PHP exec, it does not work.
Example:
sox file1.mp3 file2.mp3 tempfile.mp3 -V3
("V3" specifies a verbose output)
When executing in the command line as "User X" or as root, I am able to create the new file. However, when I execute the command as:
<?php
exec('sox file1.mp3 file2.mp3 tempfile.mp3 -V3', $output);
foreach($output as $line){
print $line;
}
It does not generate the new file. Furthermore, the array that should return the results of of the command is blank.
I have done a simple text with
exec(ls,$output);
and i get the contents of the root directory.
I used the PHP command get_current_user()
and it returned the owner of the directory that is the root of the web site.
However, when I use the linux command whoami
I found out that it views the current person as "apache." Would I need to give apache the rights to use the program?
I will continue to search online and do trial and error in an effort to figure out what I am doing wrong. Any help is appreciated.
Clarifications
- I am not in safe mode (I checked the phpinfo() page")