SoftTimur SoftTimur - 9 months ago 46
PHP Question

Cannot redirect the output of an OCaml bytecode to a file in Windows server

I have written a basic OCaml file
, and compiled that my Windows server. It works in a command prompt:

enter image description here

However, if I run it in a php, Only the last line (i.e.,
) succeeded to write to
, whereas
always failed:

exec('C:\\PRODSERVER\\OCamlTest\\test.exe >> C:/inetpub/testaddbbacom/test/result.txt');
exec('C:/PRODSERVER/OCamlTest/test.exe >> C:/inetpub/testaddbbacom/test/result.txt');
exec('C:\PRODSERVER\OCamlTest\test.exe >> C:/inetpub/testaddbbacom/test/result.txt');
exec("C:\\PRODSERVER\\OCamlTest\\test.exe >> C:/inetpub/testaddbbacom/test/result.txt");
exec('C:/PRODSERVER/OCamlTest/testbat.bat >> C:/inetpub/testaddbbacom/test/result.txt');

enter image description here

Does anyone know how to solve this?

Answer Source

I have found the solution: add -custom as option of ocamlc while compiling...