Part 1. Connecting to a Microsoft Access Database Using PHP

Published on: April 02, 2014 Written by: Thokozani Mhlongo


We are going to be using PHP to read and write a Microsoft Access Database through the ODBC API. ODBC let's us connect to many databases such as PostgreSQL, Oracle, MS Access, etc. To start of, we are going to be configure PHP to enable ODBC.

Checking PDO drivers

1.  In your server public folder (namely htdocs) create a php file and write the following:

<?php phpinfo(); ?>

2. Locate PDO drivers and check to see of ODBC is enabled

pdo_drivers

If you do not see this then you want to follow these instructions:

Enabling ODBC

Assuming that you're using a windows machine follow these instructions

  1. Go to you php.ini file and find this extension extension=php_pdo_odbc.dll.
  2. Remove the semi-colon at the beginning of the line (if there is no semi-colon).
  3. Save the file and restart your Apache server
  4. Run your script created above again and see if ODBC is visible there

 

Comments