Hosting & Domaining Forum

Hosting Discussion => Hosting Software and Control Panels => Hosting Software & CPs Related Offers & Requests => Topic started by: solomankane on Apr 05, 2023, 12:05 AM

Title: How to use SQLite if it is not installed in webhosting?
Post by: solomankane on Apr 05, 2023, 12:05 AM
Is it possible to download and use SQLite on hosts that do not have it pre-installed? I wanted to add support for SQLite to a CMS written in php that currently works with MySQL.
Title: Re: How to use SQLite if it is not installed in the hosting?
Post by: towertech on Apr 05, 2023, 01:16 AM
It seems there is a misunderstanding about SQLite. Unlike traditional DBMS, SQLite doesn't require installation in the usual sense. It is an embedded database that operates differently.

To work with SQLite, you need to follow these steps:
1. Create a database file on disk.
2. Access and manipulate the database from your program.

To achieve step 2, the language itself or additional libraries must have built-in functions for working with SQLite format. This essentially means that the provider of database requests is either integrated into the language's core or implemented as a library.

This is why people suggest using a specific PHP extension when working with SQLite. By installing this extension, or if it is already present on your hosting, you can work with SQLite databases. It's possible that you have this extension locally (if you have a newer version of PHP), but it may be missing on your hosting (if you have an older version of PHP). In such cases, you can either search for the extension as a set of *.php files or install it from pecl or pear. However, if your hosting prohibits this operation, then unfortunately there is nothing more that can be done.
Title: Re: How to use SQLite if it is not installed in the hosting?
Post by: hieronymusf01 on Apr 05, 2023, 02:27 AM
There seems to be some confusion regarding the difference between SQLite and other DBMS. Unlike other DBMS, which are servers that can be located on different servers and connected using sockets, SQLite is a library that directly works with a database file.

I may be using different terminology, but I hope the essence of the distinction is now clear.

It's worth noting that SQLite's unique nature as a self-contained library brings certain advantages, such as ease of use and portability. Additionally, its lightweight design makes it suitable for embedded systems or applications with low resource requirements.
Title: Re: How to use SQLite if it is not installed in the hosting?
Post by: Emporseupsert on Apr 05, 2023, 02:56 AM
SQLite is not a standalone program; it is simply an ordinary file with its own structure, similar to Excel's XLS format for better understanding. To work with this file using PHP, a PHP extension needs to be connected to the host.

The PHP extension allows you to interact with the SQLite file and perform various operations such as querying, inserting, updating, and deleting data. It provides a seamless integration between the PHP programming language and the SQLite database.
Title: Re: How to use SQLite if it is not installed in webhosting?
Post by: aliceria on Jul 27, 2023, 02:52 AM
Yes, it is possible to download and use SQLite on hosts that do not have it pre-installed. SQLite is a self-contained, serverless, and zero-configuration database engine, which means it does not require a separate server process to be installed or configured. You can download the SQLite library and add it to your PHP project, allowing you to create and manage SQLite databases directly from your CMS. However, keep in mind that the syntax and functionality of SQLite may differ from MySQL, so you will need to make necessary modifications to your CMS code to support SQLite.

To add support for SQLite to your PHP CMS, you can follow these steps:

1. Download the SQLite library: Head to the official SQLite website (https://www.sqlite.org/download.html) and download the appropriate precompiled binary for your operating system.

2. Include the SQLite library in your project: Extract the downloaded files and include the necessary SQLite library files in your PHP project. This can usually be achieved by copying the library files to a designated folder within your project.

3. Modify your CMS code: Since SQLite has a different syntax and functionality than MySQL, you will need to modify your CMS code to work with SQLite. This may involve rewriting database queries, adjusting table schemas, and incorporating SQLite-specific functions.

4. Establish a connection to the SQLite database: In your PHP code, create a new connection object using the SQLite library. Provide the necessary details such as the path to the SQLite database file.

5. Adapt your queries and database operations: Review your existing SQL queries and adjust them to use SQLite syntax instead of MySQL. Additionally, make any necessary changes to the database operations in your CMS code to accommodate SQLite.

6. Test thoroughly: After making the necessary modifications, thoroughly test your CMS to ensure it works correctly with the SQLite database. Pay attention to any differences in behavior or limitations compared to MySQL.
Title: Re: How to use SQLite if it is not installed in webhosting?
Post by: markopolo on Jul 08, 2025, 12:31 PM
Most shared hosting rigs are locked down tighter than a vault, and you ain't gonna sneak in custom binaries without root access. Sure, SQLite is a neat little file-based DB, no server drama, but if your host doesn't support the PHP SQLite extension outta the box, you're hosed. You'll need to beg their support crew for a config tweak, and they'll likely ghost you.
Why not stick to MySQL, the big dog, since your CMS already plays nice with it?