This PHP script creates a ZIP file backup of the current directory. The ZIP file will be named Backup_[current_time].zip, where [current_time] is the timestamp at which the backup is created.
- Download the
backup.phpfile. - Upload it to the directory you wish to backup on your web server.
There are two ways to manually run the script:
- Open your web browser.
- Navigate to the URL where
backup.phpresides. For example:http://yourdomain.com/backup.php
- SSH into your web server.
- Navigate to the directory where
backup.phpis located. - Run the following command:
php backup.php
After running the script, a ZIP file will be created in the current directory. The ZIP file will contain all the files and subdirectories in the current directory, excluding the script itself.
- PHP 5.2.0 or newer
- ZipArchive PHP extension
- Make sure the PHP ZipArchive extension is installed on your server to run this script.
- Please be cautious when running this script, as it will create a ZIP file that includes all files in the current directory where the script is located.