Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 743867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:54:46+00:00 2026-05-14T08:54:46+00:00

I have installed SQLite on my UNIX system, and am planning on accessing it

  • 0

I have installed SQLite on my UNIX system, and am planning on accessing it from PHP. However, the database is created in the directory I initialize it in, and if a script runs in a different directory a new database is created in the same directory.

Is there an option for SQLite (or the PHP wrappers) to create the databases in one location, and have those databases accessible just by name outside of that directory?

Ideally, I’d like to be able to do something like $db=new SQLiteDatabase("db.test"); in any directory and have it reference the same database, if that makes sense.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T08:54:46+00:00Added an answer on May 14, 2026 at 8:54 am

    In order to always use the same database (which, afterall, is only a file), you’ll have to use an absolute path.

    Instead of using 'db.test', which is relative to the current directory, you’ll have to use something like '/home/user/development/application/db.test'.

    Note the / at the beginning of the path, which makes it absolute.

    Of course, up to you to adapt this to your needs 🙂

    A good possibility, to not put a fully hard-coded path in your code, would be to use dirname(__FILE__) in one of your PHP files, to get the full absolute path to the directory containing that file, and build up from there, to get to your database’s file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have installed SQLite and am using the wrapper from: http://sqlite.phxsoftware.com/ I have created
I use Netbeans IDE (6.5) and I have a SQLite 2.x database. I installed
I have downloaded and installed linq-to-sqlite from http://sqlite.phxsoftware.com/ But the following test code: [
I have just installed Rails Ready script from GitHub on my Ubuntu Server 10.04.
I have downloaded, compiled and installed so far: apr-1.3.9 apr-util-1.3.9 sqlite-3.6.23 zlib-1.2.4 libtool-2.2.6b Now
I have installed Visual Studio 2008 and patch it with SP1. However, I cannot
I have installed Xperf performance analyzer from Windows SDK and captured a trace as
I have installed pylons based application from egg, so it sits somewhere under /usr/lib/python2.5/site-packages.
I would like to have an interface between Python and sqlite. Both are installed
I have an iOS app that stores some data in a sqlite database. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.