(I'm not sure if this forum is related to webdeveloper.com or not, but i'm posting here since there wasn't any response there)
No matter what I tried to call my open office macro, whether it's exec, shell_exec, system or even COM("WScript.Shell"), the command line seems to be ignored without returning any errors from php. Sometimes it just hangs!
It's running fine from command line itself. (im using php 5.2.6, winxp, apache)
- my php calls the following batch file through this :
$cmd = "c:\\php\\cmd.exe /c c:\\convert.cmd c:\myoutput.html";
$output = shell_exec($cmd);
- convert.cmd contains the following to convert html into word:
@ECHO OFF
"C:\\Program Files\\OpenOffice.org 3\\program\\soffice" -invisible -headless "macro:///Standard.Conversion.ConvertHTMLToWord(%1)"
echo "Converted!"
EXIT
- expected output on c:\ should have generated *.doc files but theres none. but i get a "Converted!" string back from $output. It seems to have ignored my macro call?
This doesn't happen if i call it directly through command prompt Or if i call it not through a web server such as :
<?php
$filename = $argv[1];
$cmd = "c:\php\cmd.exe /c c:\convert.cmd $filename\n";
echo $cmd;
$output = shell_exec($cmd);
print($output);
?>
then run with "C:\php\php c:\myoutput.html" it'll generate the doc file as well as "Converted!" string.
But what i really need is the ability to run it from apache hosted web server, through a web browser. How can i go about?