When I run the
rsync command to push my files to production, sometimes - not always, and it's very rare - after the sync has completed, we are getting errors within our production environment.
rsync command is;
rsync -avzO --exclude=*.git --exclude=*.log /var/www/html/ver_1/api email@example.com:/var/www/html/ver_1
I've confirmed the following;
- Production and test environment settings (PHP and Apache) mirror one another
- The issue has to be with the
rsynccommand because when I manually copy the files (using WinSCP) there is no issue - so it's not a code fault.
- We're syncing from a CentOS machine to a CentOS machine (if that makes any difference)
- What could be causing the issue?
- Why would it only happen sometimes (2/3 times out of 25-ish)
- How can I resolve it, or minimize the occurrence?
PHP Fatal error: require_once(): Cannot redeclare class api\lib\classapitools\apitools in /var/www/html/ver_1/api/index.php on line 42
- I've copied the index.php file from test to production, but it didn't fix it.
- Re-ran the rsync command, and it didn't fix it.
- Then I copied all the files manually and it worked. I debugged the whole application, but it didn't return anything insightful about the error (I know why the error is there (in a general sense), but the
rsyncseemed to have FUBAR'd the whole application until a manual sync)