A small PHP web application for keeping track of a library's books, computers and room keys, and of who has borrowed them.
- PHP 8.2 or newer with the
pdo_mysqlandmbstringextensions, on a release that includes the October 2026 security fixes (8.2.35, 8.3.36, 8.4.27, 8.5.12 or later). See SECURITY.md. - MySQL 5.7+ or MariaDB 10.3+
- Apache (the bundled
.htaccessprotects internal folders) or Nginx with the example configuration indeploy/nginx.conf. Nginx ignores.htaccess, so without that configuration.git/,includes/and the database dumps would be downloadable.
-
Create the database and the first administrator account:
mysql -u root -p < database/libraryrecords.sql -
Create a database user for the application with only the rights it needs:
CREATE USER 'library'@'localhost' IDENTIFIED BY 'a-strong-password'; GRANT SELECT, INSERT, UPDATE, DELETE ON libraryrecords.* TO 'library'@'localhost';
-
Give the application its database settings, either as environment variables (
LIBRARY_DB_HOST,LIBRARY_DB_PORT,LIBRARY_DB_NAME,LIBRARY_DB_USER,LIBRARY_DB_PASSWORD) or by editingincludes/config.php. -
Open the site and sign in as admin with the password ChangeMe123!, then change the password straight away on the Settings page.
- Apache with mod_php: nothing to do;
.htaccesshides internal files and sets the PHP options.AllowOverride Allmust be on for the folder. - Apache with PHP-FPM: same
.htaccessfor Apache; PHP reads its options from.user.ini. - Nginx with PHP-FPM: copy
deploy/nginx.confinto your Nginx configuration and adjustserver_name,rootandfastcgi_pass. PHP reads its options from.user.ini.
Set expose_php = Off in your server's php.ini; it cannot be changed from
.htaccess or .user.ini.
Back up your database, then run the upgrade script once:
mysql -u root -p libraryrecords < database/upgrade-v1-to-v2.sqlExisting passwords keep working and are converted to secure hashes the next time each person signs in.
| Path | Contents |
|---|---|
*.php (root) |
One file per screen; each also handles that screen's forms |
includes/ |
Start-up code, configuration, helpers and the page layout |
lang/ |
Interface translations (en, tr) |
database/ |
Schema for new installs and the version 1 upgrade script |
deploy/ |
Example Nginx configuration |
tests/server/ |
Checks the server hardening on Apache, PHP-FPM and Nginx |
assets/ |
The application's own CSS and JavaScript |
dist/ |
AdminLTE theme files |
tests/server/run.sh starts MariaDB, Apache with mod_php, Apache with
PHP-FPM and Nginx with PHP-FPM in Docker, then checks that internal files
are hidden, the PHP options take effect, oversized requests are refused and
sign-in throttling works. It needs Docker, curl and python3, and runs on
every pull request.
Please open an issue if you find a problem. This project is not under constant development, but reports are welcome.