linux - Problems when trying to exectue exec("unix2dos xxx") in PHP/Apache -
In one, I was trying to update php encoding to a downloadable file. One of the suggestions was made to run the unix2dos command before sending the file to the user. It works great when I run the command on the Linux box, but when I try and I command php Run got nothing to me. Here's what I tried:
$ cmd = "unix2dos -n $ fullPath $ downloadFile"; ACO ACC ($ CMD, $ Out, $ RATE);
It does not show anything on the screen, $ retVal is 0, and $ is an empty string.
resonance system ($ cmd, $ retVal);
It does not show anything on the screen, $ retVal is 0.
echo shell_exec ($ cmd);
It does not show anything on the screen.
I also tried to avoid a command such as this parameter:
$ cmd = escapeshellcmd ($ cmd);
and
$ cmd = "unix2dos" escapeshellarg ("- n \" $ fullpath \ "\" $ downloadFile \ "");
Please tell me if you see something that I'm doing wrong
thanks!
Edit: Here is some information that can be helpful Unix2dos version: 2.2 (1995.03.31) PHP version 5.2.9 is running in Apache 2 Redhat Enterprise Linux 4 In
Have you considered a pure PHP solution?
& lt ;? Php $ unixfile = file_get_content ('/ location / of / file /'); $ Dosfile = str_replace ("\ n", "\ r \ n", $ UNIX file); File_put_contents ('/ location / of / file /', $ dosfile); ? & Gt;
Comments
Post a Comment