Un-zip the new version and put it in your web directory.
You will have to re-enter all of your settings in config.php and database.php. You cannot re-use your old config and database files because there are new settings for new features in the new version.
BACK UP YOUR DATA! - from the command line, the syntax is:
(your prompt)> mysqldump photos > photos_backup.sql
(where 'photos' is the name of your database)
Upgrading from a previous version of 'gallery'
Hit the 'upgrade_to_4.0.php' page (example: http://localhost/photos/upgrade_to_4.0.php) in your browser and follow the directions.
Note: Upgrading lots of photos takes time. If your server is running in safe mode, the set_time_limit() function does not work and the upgrade will probably fail.
Upgrading from photos 3.5b1
Hit the 'upgrade_from_3.5b1.php' page (example: http://localhost/photos/upgrade_from_3.5b1.php) in your browser and follow the directions.