Edward Tanguay
Edward Tanguay

Reputation: 193282

Why PHP exec() won't work in Windows 8 when it worked in Windows 7?

The following worked fine locally on Windows 7, but now the website is on Windows 8 and does not work. This is run in an Apache web request:

exec('ffmpeg -i "C:\temp\testing.mp4" "C:\temp\testing.mp3"', $errors, $result);
    var_dump($errors);
    var_dump($result);
    exit;

gives: array(0) { } int(1)

$output = exec('ffmpeg -i "C:\\temp\\testing.mp4" "C:\\temp\\testing.mp3"', $errors, $result);
var_dump($output);
var_dump($errors);
var_dump($result);
exit;

gives: string(0) "" array(0) { } int(1)

but if I execute the text C:\temp\testing.mp4" "C:\temp\testing.mp3 in the command window in any directory (PATH is set to ffmpeg), it works fine.

I set the rights on c:\temp for all users to full control, but the MP3 file is still not created. Why is this statement not being executed in Windows 8 but is executed in Windows 7? How can I find out more information about why it is not creating the MP3 file?

Interestingly, this works:

exec('copy "C:\\temp\\testing.mp4" "C:\\temp\\testing.mp3"', $result);
var_dump($result);

and yields:

array(1) { [0]=> string(30) " 1 file(s) copied." } 

Upvotes: 2

Views: 847

Answers (1)

Edward Tanguay
Edward Tanguay

Reputation: 193282

I found the answer:

After editing the Environment Path variable, Restart Apache for it to take effect in PHP.

Upvotes: 1

Related Questions