I am calling external Perl script to convert DXF file to SVG, but when script is called from PHP the output SVG file is always 0 bytes. When executing the same command from terminal the output SVG file is OK.
I am executing command via PHP system() and also tried exec() and popen() but I always have the same result.
dxf2svg.pl perl script source code: http://pastebin.com/fE2BcUqE
command that I am executing:
perl /path/dxf2svg.pl "/path_to_dxf/file.dxf" ">/output_path/file.dxf"
Outup path is writable to PHP user, so this is not the problem.
MODEis messing things up. I.e. that PHP turns it into redirection, and overwrites the file after the perl script is done. However, that should cause your perl script to die since it cannot open to a file name which is an undefined value.