Package libapache2-mod-auth-mysql is not available
You are encountering a fundamental shift in how Linux distributions handle authentication modules. The error message Package libapache2-mod-auth-mysql has no installation candidate indicates that the specific package you requested does not exist in your current software repositories. This is not a configuration error on your part; it is the result of upstream changes that occurred long before you attempted to install the stack.
On modern Debian-based systems, including Linux Mint 16 and its successors, the Apache module for MySQL authentication (libapache2-mod-auth-mysql) has been deprecated. The underlying reason is architectural: relying on a compiled C extension within Apache to handle database lookups is inefficient and difficult to maintain compared to using native PHP functions or dedicated libraries. Consequently, package maintainers removed this specific .deb package from the default repositories to encourage the use of more robust alternatives.
Attempting to install it via apt-get will fail because the metadata simply does not list the file. You might see a suggestion that the package is referred to by another, but in this case, no modern package depends on it anymore. The friendly URL feature (often implemented as .htaccess rules) you are trying to enable relies on verifying user credentials against the database. Since the deprecated module is gone, you must achieve the same goal using a different mechanism that aligns with current best practices.
The standard replacement for libapache2-mod-auth-mysql is to move the authentication logic into PHP itself or use the native Apache HTTP Server support for remote databases provided by the mod_remoteip or similar modern modules, though the most direct equivalent for web applications is handling login directly in PHP. If you strictly require Apache-level authentication (where the server validates credentials before passing the request to PHP), you should switch to MySQL's own built-in authentication plugins or use a dedicated module like libapache2-mod-auth-sqlite if local users are sufficient, but for remote MySQL databases, the industry standard is to handle this in the application layer.
However, if your goal is simply to enable "friendly URLs" (clean URLs) rather than strict directory-based authentication, you may be conflating two different features. Friendly URLs usually rely on .htaccess rewrite rules that can live entirely within Apache without needing database lookups for every request. If your requirement is actually to authenticate users against a MySQL database to grant access to specific paths, the modern approach involves configuring Apache to use mod_authnz_dbm (with an external script) or, more commonly in PHP environments, letting the application handle session validation.
If you are building a LAMP stack where the web application manages user sessions, you do not need Apache to authenticate every request against MySQL. Instead, configure your .htaccess file to allow all requests and let your PHP application verify the session validity on each page load or AJAX call. This decouples the web server from the database for authentication purposes, improving performance and reducing the attack surface.
To implement this modern architecture, update your Apache configuration to ensure mod_rewrite is enabled:
a2enmod rewrite
systemctl restart apache2
Then, in your .htaccess file (located in the web root or subdirectory), add the standard rewrite rules:
RewriteEngine On
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
This configuration routes all requests to your application's entry point, where PHP can check the database for active sessions. This approach is more flexible and supports modern frameworks like Laravel or Symfony better than legacy Apache modules. If you specifically need directory-level protection without rewriting everything to a single file, consider using mod_authn_file combined with a script that validates against MySQL, effectively replacing the deprecated module's functionality with a custom handler.
The takeaway is that relying on libapache2-mod-auth-mysql is an obsolete pattern. The ecosystem has moved toward application-layer authentication or more efficient database connection methods within PHP. By adjusting your stack to use these modern standards, you gain better compatibility with current web frameworks and avoid dependency issues entirely.