Apache - PHP - Mimer SQL on Mac OS X
Tools and Interfaces
This article will describe how to connect a Mimer SQL database to Apache using PHP on Mac OSX. A very simple application will be used to select from the Mimer SQL example environment.
Apache and PHP are both shipped with Mac OS X, though as default PHP is not activated and must be configured as described below.
PHP is a widely-used general-purpose scripting language that can be embedded into HTML and is therefore especially suited for Web development.
Apache HTTP Server is an open source HTTP web server for a wide range of platforms.
Below is an example on how to use Mimer SQL with these products.
When a Mimer SQL database server is created on Mac OS X, i.e. using the Mimer SQL Database Install application, it is a default option enabled that creates an ODBC Data Source for the database. The Data Source is given the same name as the database itself and is using the ODBC Driver libmimodbc.so which is a "Mach-O bundle ppc" library.
This Data Source definition is needed in the example below.
Configuring Apache and PHP
If you already have Apache and PHP running on your Mac, you can skip this first step and continue with the Mimer SQL database setup. If you have not previously configured Apache and PHP, there is a guide which you can follow in the article Enabling Apple's Supplied PHP in OS X 10.4 Tiger found at www.phpmac.com.
Using this guide will enable the PHP and Apache versions shipped with Mac OSX. (Usually this task implies that php4 should be enabled in the
Versions of PHP
The PHP version currently shipped with Mac OS X is usually not the latest one. For more advanced use, you can upgrade to a newer version. A popular way to do this is to fetch binary installers from www.entropy.ch. However, the very simple Mimer SQL demo described here will work with all versions of PHP.
The Mimer SQL database setup
To run the enclosed
mimerdemo.php file, you need to have a Mimer SQL database installed. It should be installed with the following options when using the Mimer SQL Database Install application:
- Create a database called mimersql. To fit the example as is, the Mimer SQL database should be named "mimersql". This will give you an ODBC Data Source with the same name. To use another name, edit the mimdemo.php file or update the Data Source name using the ODBC Administrator.
- Create ODBC Data Source for the database. An ODBC Data Source must be defined for the database. The Mimer SQL Database Install application creates one for you if the appropriate check box is enabled on installation, which it is by default.
- Populate the database with the MIMER_STORE example environment. The example application is based upon the Mimer SQL example environment. If you check the corresponding check box in the Mimer SQL Database Install app window, the MIMER_STORE example environment will be installed.
The demo application
When you have everything running, place the two demo documents mimdemo.html and mimdemo.php in
/Library/Webserver/Documents (right-click and do "Save Link Target As"). Then open your web browser and access
Now you should be able to see the very simple demo and confirm that your Mimer SQL database server can be connected from the Apache/PHP environment.
Note! The instructions given in this article have been verified on Mac OSX 10.4 Tiger, using Mimer SQL 9.2.4.
Last updated: 2005-09-30