How to install latest SQLite version on cPanel

Since all versions of SQLite can be easily installed locally on your shared hosting accounts, it is very common to find that the version available by default is older than your needs.

Here are the steps to install a newer version:

1. Download the latest version of SQLite and extract it. You can check the SQLite download page for the latest version (remember to update the following commands with the actual version number):

$ cd ~
$ wget https://www.sqlite.org/2022/sqlite-autoconf-3400000.tar.gz
$ tar xvfz sqlite-autoconf-3400000.tar.gz

 

2. Configure and install the new version of SQLite in the .local folder (executing the last command may take some time):

$ cd sqlite-autoconf-3400000
$ ./configure --prefix=$HOME/.local
$ make && make install

 

3. Tell the server where to look for the new version of SQLite:

$ echo "alias sqlite3="$HOME/.local/bin/sqlite3"" >> ~/.bashrc
$ echo "export LD_LIBRARY_PATH=$HOME/.local/lib:$LD_LIBRARY_PATH" >> ~/.bashrc
$ source ~/.bashrc

 

4. The previous step remapped the sqlite3 shell command to point to the new installation, let's check it:

$ sqlite3 --version
3.40.0

 

5. If you are using Python: In Step 3 we also stated where to look for SQLite libraries when imported into Python. So let's check that Python is loading the correct SQLite version (make sure the python command points to a Python3 version):

$ python -c 'import sqlite3; print(sqlite3.sqlite_version)'
3.40.0

If it still shows the old version, be sure to check that the LD_LIBRARY_PATH environment variable in your .bashrc file points to the SQLite library folder (in this case .local/lib).

You can now enjoy the benefits of the latest version of SQLite, in case your Python application (or other languages) only runs locally on the server. However, if you plan to run it using a production server like Phusion Passenger, keep reading.

Production Setup (with Phusion Passenger):

This is the Phusion Passenger server running your Node.js, Ruby or Python applications, so it needs to know the new value of the LD_LIBRARY_PATH environment variable. In cPanel, it's a very simple configuration:

  • Go to application settings (to create or edit environments for Passenger)
  • Create or modify an environment, go to the bottom of the settings and add the variable:cpanel-python-env-var-en.jpg
  • Click the "Save" button in the upper right corner
  • In case the Passenger server was already running, restart it (click on the "Restart" button)

The Passenger server is now aware of the LD_LIBRARY_PATH environment variable and knows how to import the latest version of SQLite.

Reference: https://eeinte.ch/stream/install-latest-sqlite-version-shared-hosting/

  • SQLite, Shared Web Hosting, cPanel
  • 60 用戶發現這個有用
這篇文章有幫助嗎?

相關文章

How to install a PHP Symfony application on cPanel

Symfony is a Open Source MVC framework written in PHP that allows you to quickly and easily build...

How to install a Python Django application on cPanel

Django is a Python-based framework that lets you build powerful websites quickly and easily. This...

Powered by WHMCompleteSolution