What are the advantages and disadvantages of using SQLite as an alternative to a traditional database in PHP applications?

SQLite is a lightweight, serverless database that can be used as an alternative to traditional databases like MySQL in PHP applications. Advantages of using SQLite include its simplicity, portability, and ease of setup, as it does not require a separate server installation. Additionally, SQLite is fast and efficient for small to medium-sized applications. However, disadvantages include limited scalability and concurrent user support compared to traditional databases, as well as potential performance issues with larger datasets.

// Connect to SQLite database
try {
    $db = new SQLite3('database.db');
    echo "Connected to SQLite database";
} catch (Exception $e) {
    echo "Error connecting to SQLite database: " . $e->getMessage();
}