Ooooooodata!!! PHP ?? OData PHP Producer Library Configuration via Apache N MSSQL 2012


Well that’s a lot of O’s I am putting in this blog after a long time. Well the topic is fun, and getting it straight in this topic I am going to lay out a plan to produce OData feed using the PHP, Apache and MSSQL combination.

What is Odata ??

Simple, google it… There’s so much written about it on the web, I just keep this post focused on what I want to illustrate. It’s a web service protocol, to design and deliver data as a pre-defined XML format and design the web service on a layout laid by the foundation rules of OData (REST) combination

Wiki:Open Data Protocol
OData and REST

Why you guess is this exciting??

Well the reason being there is a new library in town, called as “OData Producer Library for PHP”, this was started off in CodePlex which eventually moved to the GitHub as the development grew!!

Why would I go for it?? Why not ASP.NET MVC WebAPI (or) WCF

Well what if you environment is not windows…, what if you broke your iis server …, what if you are open source and member of “The Cheapskates Club”…

Getting serious, this library is one of the attempts of Microsoft to promote their odata format to a wider audience where the open souce stack is able to leverage out the framework for their needs using the framework…

Why a blog on configuration, they must have a well-documented API??

Good luck, it had to scratch off enough hair of mine to get it working, maybe I am more of .NET arena guy. But I found it little complex to set it up on my laptop, (just becose it wasn’t well documented) …


To get started you need the following:

(Note: A quick note, don’t be tempted to download any of the following x64 options though you run a super computer with x64 architecture , believe me you would realize a long way down when it strikes)

1. Apache HTTPD Server:

2. PHP Framework (5.3.29):

3. MS Sql Drivers for PHP 3.0:

4. OData PHP Producer Library (GitHub):

5. MSSQL Northwind Database Sample:


1. Unzip all the above packages and place them as follows:

Apache: C:\Apache24
PHP: C:\php
MS SQL PHP Drivers: Copy the following files “php_sqlsrv_53_ts.dll” and “php_pdo_sqlsrv_53_ts.dll” and dump them into “C:\php\ext”
OData PHP Producer: In the folder “C:\Apache24\htdocs”, create a folder named as “odata” and dump all the content of the downloaded library

It should look some thing like this:


Once all the file operations are complete move on to next step (2) configuration.

2. Configurations:

Apache: “C:\Apache24\conf\httpd.conf”

Also create a new file in the location “C:\Apache24\htdocs\.htaccess” , which windows dont allow to create by default by right click. You would have to “Save As..” via notepad to create the same.

PHP: PHP doesnt intially have a “PHP.INI” , so take a copy of the “PHP.INI-development” and rename the file as “PHP.INI”

Also register the “C:\php” path in your environment vairable “PATH” for it to be available across system.

OData Producer:
“C:\Apache24\htdocs\odata\services\IDataServiceQueryProvider Implementation\NorthWind\NorthWindQueryProvider.php”

For the above all mentioned configuration files, just do a code compare with the content available with this post for download, to transfer the necessary configuration as desired.

3. Setup the database:

Last step above all the discussed steps is to configure the service, have the database in place for the web service to query the server and produce the data

And finally

4. Run the service:

Open the command prompt (as Admin) and navigate to the “C:\Apache24\bin” and run the following command:


And there you go, your server mu be up and running on the following URL, to display the following output in choice of your browser.

Note: The port and the IP address can vary depending on your version of configurations$metadata


And rest from here the documentation provided by the PHP OData Producer library can guide you well to structure the service according to your requirements.

I wonder why they couldn’t provide more clarity on the getting started section of the library documentation ??

I hope it helps !!!


Posted in Uncategorized

One Reply to “Ooooooodata!!! PHP ?? OData PHP Producer Library Configuration via Apache N MSSQL 2012”

Leave a Reply

Your email address will not be published. Required fields are marked *