ThurSN Posted September 24, 2013 Share Posted September 24, 2013 (edited) I wrote a simple console program using Microsoft Speech API to generate a .WAV file from a hard-coded text ("Hello world"). If I run the code directly on the console (on the server), it produces a correct .WAV file (about 60 kB). However, if I call the program from PHP: <?php $cmd = "helloTTS.exe" // Program name exec($cmd); ?> The program runs and finishes, but the size of the .WAV file is only 46 bytes. I've tried using system(), shell_exec(), and passthru(), all with the same result. In another forum, somebody said that probably the buffer size of PHP is not enough to hold the amount of the generated data. If it's the buffer, I guess it's the buffer of the PHP shell. How to check & increase the size of this buffer? And what else could cause this problem? Edited September 24, 2013 by ThurSN Quote Link to comment https://forums.phpfreaks.com/topic/282404-running-microsoft-speech-api-console-program-in-php/ Share on other sites More sharing options...
ThurSN Posted September 24, 2013 Author Share Posted September 24, 2013 Update to the above: I tried to run the PHP script using PHP interactive mode in Windows (php -a), and the .WAV file is produced correctly (60 kB). Is there actually any difference between the PHP script run from the browser and using interactive mode? Quote Link to comment https://forums.phpfreaks.com/topic/282404-running-microsoft-speech-api-console-program-in-php/#findComment-1451004 Share on other sites More sharing options...
trq Posted September 24, 2013 Share Posted September 24, 2013 Is there actually any difference between the PHP script run from the browser and using interactive mode? Yes. Accessing a php script means that it is served up by your http server. The php script therefor runs with the permissions of this http server. Running the script yourself executes the script with whatever permissions you have. Quote Link to comment https://forums.phpfreaks.com/topic/282404-running-microsoft-speech-api-console-program-in-php/#findComment-1451021 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.