PHP ORM with support for SQL Server 2005 - php

I have been looking around the current options (and related SO questions) regarding PHP ORM solutions, however I have a couple of unique requirements:
I am running PHP on Windows Server 2003
I need to interface with SQL Server 2005
I can't seem to find a simple answer from the PHP ORM solutions out there as to which (if any) support MSSQL as an adaptor option. Outlet seems to support this, for instance, but is only mentioned in passing on the documentation page, while other references say that the current version (1.0) has only been tested with MySQL.
At the moment, I am using the Microsoft PHP SQL Server driver, which as I understand it, can't be used with current ORM solutions until the driver itself supports PDO (which the team are looking into, but with no timeframe).
So what can I use today as an ORM solution on PHP for Windows that interfaces with SQL Server. Anything out there at all?

From Doctrine manual:
The currently supported PDO database drivers are:
fbsql FrontBase
ibase InterBase / Firebird (requires PHP 5)
mssql Microsoft SQL Server (NOT for Sybase. Compile PHP --with-mssql)
mysql MySQL
mysqli MySQL (supports new authentication protocol) (requires PHP 5)
oci Oracle 7/8/9/10
pgsql PostgreSQL
querysim QuerySim
sqlite SQLite 2
And PHP on Windows should ship with an appropriate extension for MSSQL for PDO. Just enable
extension=php_pdo.dll
extension=php_pdo_mssql.dll
Propel should also support MSSQL, as it is written on top of PDO. And while not a full fledged ORM as such, Zend_Db has an adapter for MSSQL as well. The latter uses pdo-dblib though.

Related

running a codeigniter application on localhost/xampp

What versions of PHP and MYSQL should I use, if I want to run a codeigniter application of version 2.2.0 on my XAMPP local host?
Thanks in advance.
Codeigniter 2.2.0 needs below Server Requirements
PHP version 5.1.6 or newer.
A Database is required for most web application programming. Current supported databases are MySQL (4.1+), MySQLi, MS SQL, Postgres, Oracle, SQLite, and ODBC.
PHP version 5.6 or newer is recommended.
It should work on 5.3.7 as well, but we strongly advise you NOT to run such old versions of PHP, because of potential security and performance issues, as well as missing features.
A database is required for most web application programming. Currently supported databases are:
MySQL (5.1+) via the mysql (deprecated), mysqli and pdo drivers
Oracle via the oci8 and pdo drivers
PostgreSQL via the postgre and pdo drivers
MS SQL via the mssql, sqlsrv (version 2005 and above only) and pdo drivers
SQLite via the sqlite (version 2), sqlite3 (version 3) and pdo drivers
CUBRID via the cubrid and pdo drivers
Interbase/Firebird via the ibase and pdo drivers
ODBC via the odbc and pdo drivers (you should know that ODBC is actually an abstraction layer)
Link Server Requirements
Upgrading to Code Igniter 2.2.0
Code Igniter 2.2.0 can be upgraded to (or installed) using any of Installatron's products. Use Installatron's optional Automatic Update feature to automatically apply Code Igniter updates as new versions are released, or use Installatron's Clone feature to duplicate an existing Code Igniter install to test the 2.2.0 upgrade prior to applying it live. Get started managing your Code Igniter installations with Installatron
What's New in Code Igniter 2.2.0
This is a security release for the 2.x branch. The Encryption Class now requires the Mcrypt extension, so please ensure your environment is ready for the update.
General Changes
Security: The xor_encode() method in the Encrypt Class has been removed. The Encrypt Class now requires the Mcrypt extension to be installed.
Security: The Session Library now uses HMAC authentication instead of a simple MD5 checksum.
Bug Fixes
Fixed an edge case (#2583) in the Email Library where Suhosin blocked messages sent via mail() due to trailing newspaces in headers.
Fixed a bug (#696) - make oci_execute() calls inside num_rows() non-committing, since they are only there to reset which row is next in line for oci_fetch calls and thus don't need to be committed.
Fixed a bug (#2689) - Database Forge Class methods create_table(), drop_table() and rename_table() produced broken SQL for tge 'sqlsrv' driver.
Fixed a bug (#2427) - PDO Database driver didn't properly check for query failures.
Fixed a bug in the Session Library where authentication was not performed for encrypted cookies.

Doctrine2: DBAL connection to Sql-Server

Connecting to MSSQL using Doctrine2 on Unix
Im currently developing a project which uses Doctrine2 with PHP on an Ubuntu Server (x64). It's required to fetch data from a MSSQL-Server which is running externally.
Problem
Doctrine2 doesn't support the pdo_dblib driver, neither there's a support for sqlsrv on unix-like machines (sqlsrv is windows only). Being that given, it seems like Doctrine simply doesn't have a built-in support for MSSQL-Servers on unix-machines.
Solutions
These are solutions I tried without success.
1. Write own wrapper for pdo_dblib and integrate in doctrine's DBAL
I couldn't figure out how to write my own driver, platform and schema for doctrines DBAL neither found anything usefull in its docs or per google.
Actual Question
Is there any kind of support for MSSQL-Servers with Doctrine 2 without using Symfony or other third-party code ?
Your original solution is not actually that hard to achieve. I've run into this issue trying to connect to SQL Server using ODBC, which is one option for linux hosts, and the only change that I needed was in this file.
If you update that function and use a valid ODBC connection string instead, it will work just fine. Of course the Doctrine folks didn't make it easy by making that function private, so you'll either have to resort to editing your library or copy/pasting the entire SQL Server driver code.
That said, SQL Server support with ODBC is somewhat poor. For example, I've run into an issue where exceptions are thrown if you use bound parameters inside a subquery. Even though it works just fine with Microsoft's official driver which itself is based on ODBC. Go figure. If possible, copy your data to a more Linux friendly database and work with it there.

Laravel mssql driver support

I have been searching mssql driver for Laravel framework, but had no luck so far. I know Laravel has sqlsrv support for sql servers, but what I need is mssql connector (ones that have functions starting with 'mssql_').
We cannot use sqlsrv because most of our servers are MSSQL 2000, and sqlsrv doesn't provide support for these servers as far as I know. Also, MS does not provide sqlsrv driver for linux. (We are using freetds driver with manually compiled php 5.4.8 on Fedora 17 64-bit).
My question is
Is there any patch for mssql support in Laravel?
If not, which files should I create/modify to have mssql supported if it is ever possible?
I could use different framework that supports mssql as well, but I really like how Laravel handles everything. I didn't want to give up on Laravel just because it doesn't support mssql.
It seems it does not include that driver... I believe you can setup it at laravel/database/connectors

Trouble using MsSQL with PHP

I am debating between using MsSQL and SQLSrv to connect to SQL Server.
Our platform is running IIS7 on Windows and using PHP. We tried using the MsSQL extension to work but had problems so we decided to use SQLSrv instead since it was easier to get working.
Using MsSQL would be the preferred option because it fits the workflow better and the function names are similar to the ones used in SQL. Is it worth the effort to use MsSQL with PHP in light of the problems we are facing or should we use SQLSrv with the downsides mentioned.
Also, on the MSDN Docs for SQLSrv it mentions that the documentation is for preview and might change. Does that mean the functions could end up changing?
As far as the notice on the documentation all it means is they may change the wording of the document later in its release, I can't promise that the functions will stay the same however nothing on that page leads me to believe otherwise. Here is a Microsoft Wiki article on Accessing SQL Server Databases from PHP is says that the process outlined on that page is compatible with SQL Server 2005, SQL Server 2008, and SQL Server 2008 R2 so the software should not change since it needs to maintain compatibility with older versions of SQL Server.
You may also want to reference that wiki article, it contains step by step setup procedures for MsSQL and SQLSrv which may work for you and fix the issue you have.

PHP host without database drivers

My web host (bargainvault) has PHP 5 installed, but it does not have a ton of database drivers installed. I specifically need sqlite3, but they only have the sqlite driver installed. And no PDO.
So, my question is how can I bring support for my database to my application if there is no driver installed? I have looked at several database abstration layers, and they all seem to need those drivers installed.
You can't. An abstraction layer is not a substitute for the underlying driver.
Your choices are:
become a good friend of the server admin and make him install PDO
find another host
make do with SQLite v. 2
Your hosting supports mysql, and it is supported from mant abstraction layers.

Categories