I'm trying to get the difference between 2 files on my Debian system.

$output=`diff path/to/file1 path/to/file2`;
echo "<hr>".$output."<hr>";

Gives a page with "<hr><hr>".

However, this:

$output=`ls -la path/to/files/`;
echo "<hr>".$output."<hr>";

Gives me a listing of the directory as expected.

Do the executables need to be registered somewhere?

Comments

criznach’s picture

Does your apache user have the necessary permissions to access the files and to execute the diff command?

davecoventry’s picture

Odd.

$output=`diff path/to/file1 path/to/file2>/tmp/difffile`;
echo "<hr>".$output."<hr>";

Produces the file /tmp/diffile with the 'diff' output.

But I would have expected the following:

$output=`diff path/to/file1 path/to/file2`;
echo "<hr>".$output."<hr>";

to produce the contents of the diff file as the $output.