Working on a deploy script, I ran into issues that I cannot explain. We have a production server (Ubuntu server 10.04), a repository (Gitlab), and a development server (Ubuntu 14.04). I work on the development server, and from there run the deploy script which, after removing everything else, does only this:
git archive --format=tgz $MASTER | ssh $HOST "mkdir $NEW && tar xzf - -C $NEW || echo Could not create folder"
The folder gets created properly. The files seem correct. But Apache spits various errors, usually relating to undeclared classes or variables, but different at each attempt. Moving the new folder out of the way and moving the old folder back into place works fine. Moving the old folder out of the way and moving the new folder back into place breaks. There is no noticeable difference between the two folders.
Then things get interesting: - If I use the new folder, it breaks. If I move various subfolders from the old folder into the new folder, it eventually works. But, no single folder is sufficient, and which folders help is not consistent. It seems to be some sort of "critical mass" - when enough of the old files are there, it works. Running ls -la shows the same files with the same sizes / ownerships / permissions. Running diff -r shows no difference between the folders / files. - If I use the old folder, it works. If I then move some subfolders / files from the new folder into old, it eventually breaks. The behavior is similar to the previous point. - If I move both old and new out of the way, and use cp -a to make an exact duplicate of the folder, it works fine. (EDIT: Not always. I just made a test were original failed, copy failed differently, copy of copy worked.)
So the files are identical, but they are bad somehow. If have also seen cases where using vi to save a file changed the behavior, i.e. seemingly "cleaned" the file. I don't understand what could possibly be wrong with the files, but invisible to the eye - and perfectly fine according to all software besides Apache/PHP.
What could possibly be wrong with the files that only Apache would pick up? What commands could reveal those?