Php configuration sqlite Database Development Instance

Source: Internet
Author: User

Php configuration sqlite Database Development Instance

Download SqLiteManager from Baidu search

PHP5 has been bound to sqlite
1. Manually added support for php pdo Driver Extensions, added in PHP. ini

Extension = php_pdo.dll
Extension = php_pdo_sqlite.dll
Extension = php_sqlite.dll

Extension_dir = "C: \ Program Files \ Apache Group \ php5 \ ext"

2. Ensure that php_sqlite.dll and php_pdo_sqlite.dll are available in C: \ Program Files \ Apache Group \ php5 \ ext,

Php_pdo.dll extension Library

3. Restart apache

4. Download SQLitemanager and create a database, save the database named "db. sqlite", and create a table,
Or sqliteadmin

5. Link SQLite in PHP

 

Connect to database

 

The following PHP code shows how to connect to an existing database. If the database does not exist, it will be created (created in the application directory by default, for example, under the php application directory), and a database object will be returned.

 open('test.db');      }   }   $db = new MyDB();   if(!$db){      echo $db->lastErrorMsg();   } else {      echo "Opened database successfully\n";   }?>

Now, let's run the above program and create our database in the current directoryTest. db. You can change the path as needed. If the database is successfully created, the following message is displayed:

Open database successfully

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.