Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Stacky's avatar
Level 8

Change SQLITE version

I have to update my default MYSQL lite version to get drops working correctly on L11. But i'm not sure how to change it. On Rocky9.3, ❯ sqlite3 --version 3.46.0 2024-05-23 13:25:27 96c92aba00c8375bc32fafcdf12429c58bd8aabfcadab6683e35bbb9cdebf19e (64-bit)

From L11 PDO {#3707 inTransaction: false attributes: { CASE: NATURAL ERRMODE: EXCEPTION PERSISTENT: false DRIVER_NAME: "sqlite" ORACLE_NULLS: NATURAL CLIENT_VERSION: "3.34.1" SERVER_VERSION: "3.34.1" STATEMENT_CLASS: array:1 [ 0 => "PDOStatement" ] STRINGIFY_FETCHES: false DEFAULT_FETCH_MODE: BOTH } }

Restarted apache, php-fpm and cleared app cache. Any tips or ideas?

0 likes
2 replies
LaryAI's avatar
Level 58

To update the SQLite version used by your Laravel application, you need to ensure that the PHP SQLite extension is using the correct version of SQLite. Here are the steps you can follow to achieve this:

  1. Check the Installed SQLite Version: You already have SQLite 3.46.0 installed on your system. You can verify this by running:

    sqlite3 --version
    
  2. Check the PHP SQLite Extension Version: The version of SQLite used by PHP is determined by the SQLite library that PHP was compiled with. You can check the version by creating a PHP file (e.g., phpinfo.php) with the following content:

    <?php
    phpinfo();
    ?>
    

    Access this file through your web server and look for the SQLite section to see the version.

  3. Update the PHP SQLite Extension: If the PHP SQLite extension is not using the desired version, you may need to update or recompile PHP with the correct SQLite version. Here are the steps to do that:

    • Install the Required SQLite Version: Ensure that the desired SQLite version is installed on your system. You already have SQLite 3.46.0 installed.

    • Recompile PHP with the Correct SQLite Version: You may need to recompile PHP to link it against the correct SQLite version. This process can vary depending on your system and PHP installation method. Here is a general approach:

      sudo apt-get update
      sudo apt-get install libsqlite3-dev
      

      Then, recompile PHP with the new SQLite version. This step can be complex and may require specific configuration options. Refer to the PHP documentation or your system's package manager for detailed instructions.

  4. Restart Web Server and PHP-FPM: After updating the PHP SQLite extension, restart your web server and PHP-FPM to apply the changes:

    sudo systemctl restart apache2
    sudo systemctl restart php-fpm
    
  5. Clear Laravel Cache: Clear the Laravel application cache to ensure that any cached configuration is updated:

    php artisan cache:clear
    php artisan config:clear
    php artisan config:cache
    
  6. Verify the Update: Check the SQLite version used by PHP again by accessing the phpinfo.php file or by running a PHP script that outputs the SQLite version:

    <?php
    echo 'SQLite Library Version: ' . SQLite3::version()['versionString'];
    ?>
    

By following these steps, you should be able to update the SQLite version used by your Laravel application to the desired version. If you encounter any issues during the process, please provide more details, and I can assist you further.

Stacky's avatar
Level 8

@LaryAI Good guide, but did not flip the sqlite version over from 3.34.1 to the system version of 3.46

Please or to participate in this conversation.