PHP Classes

PHP Web Site Compare Files: Compare the list of files of two Web sites

Recommend this page to a friend!
  Info   View files Example   Demos   Screenshots Screenshots   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2022-10-21 (11 months ago) RSS 2.0 feedStarStarStarStar 77%Total: 240 All time: 8,005 This week: 257Up
Version License PHP version Categories
compare-site-files 1.0.2GNU General Publi...5PHP 5, Files and Folders, Web services
Collaborate with this project 



This class can compare the list of files of two Web sites.

It can take the URLs of two sites and compares the list of files between them.

The class uses file_list.php script that needs to be installed on both site servers, so it can use that script to retrieve the files list.

The class displays a report of the files that are missing or changed between servers, as well the respective modification dates and sizes.

Innovation Award
PHP Programming Innovation award winner
August 2016

Prize: One downloadable copy of CodeLobster Professional
Sometimes it is necessary to verify if the files of a site on the server are up to date and were not changed eventually by an attacker that took advantage of a security hole.

There are some solutions that compute hashes of all the files in the server but they do not tell whether the files different because they are not up to date with the latest development version or were changed eventually due to a security attack.

This class provides a solution that uses a different approach. It calls a script on the server that lists the existing files.

This way it can compare list of files on the production and the development environments, or even compare the files installed on different production or testing servers.

Manuel Lemos
Picture of Roger George
  Performance   Level  
Name: Roger George <contact>
Classes: 1 package by
Country: United States United States
Age: 45
All time rank: 3997512 in United States United States
Week rank: 388 Up39 in United States United States Up
Innovation award
Innovation award
Nominee: 1x

Winner: 1x



Compare similar website files. Shows missing files, different files (modified date / size), and files modified in the last 7 days.

Last Updated = 7/25/16 Created By: Blastroid


Copy the file_list.php file to the root directory of 2 websites you want to compare.

Use the following code:

$compare = new compareFolders('http://URL1/file_list.php', 'http://URL2/file_list.php');

Where it says URL1 change to the website #1 URL

Where it says URL2 change to the website #1 URL

Optional paremeters are naming the 2 website paths (Defaults are URL1, and URL2). Example:

$compare = new compareFolders('http://URL1/file_list.php', 'http://URL2/file_list.php', 'Website 1', 'Website 2');

Run the class where you want the 3 HTML tables to be written.

Note: In the compare_file.php you can add to the array $ignoreFiles to ignore files.

See for more information.

  Compare_Website_FilesExternal page  

Open in a separate window

  • screenshot.png
  Files folder image Files  
File Role Description
Plain text file compare_files.php Class Class source
Accessible without login Plain text file example.php Example Example script
Accessible without login Plain text file file_list.php Aux. Auxiliary script
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file Doc. Documentation

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:8,005
This week:257Up
User Ratings User Comments (1)
 All time