I have two simple PHP scripts: testHash.php and me.php. The testHash.php is simply doing a md5_file
function to the me.php and printing out the result
testHash.php contains:
<?php
$test = md5_file(__DIR__."/me.php");
echo $test;
echo phpinfo();
?>
and me.php contains:
<?php
echo "Hello World";
?>
I have uploaded both script to two different Webserver using an FTP Tool (FileZilla) without of course touching the files. One is a local virtual machine and the other is a public Webserver.The output of the $test
variable was different from the other. Both webserver operates on LAMP framework
Why are they different from each other? Are there external factors (framework, PHP Versions, PHP configuration files) which affects the computation of the hash. Thank You.
The md5's are different if the files are.
If you're transfering your file in ascii-mode, something in them could change, like the line endings changing from CRLF to LF.