How does PDO connect to the MSSQL and Oracle databases?

Source: Internet
Author: User
Tags sql server driver mssql php compiler php source code sybase
Find PHP used in traditional enterprises (with MSSQL, Oracle Database Enterprise) is really very few ah.

Recently there is a project that requires a PHP system to be deployed in the development and production environment, with PDO objects to access databases such as MySQL, MSSQL, and Oracle.

How do I do this, using PHP's PDO to configure access to these databases under Mac, Windows, Windows Server? MSSQL version Minimum 2005, currently used by the XAMPP integrated environment.

If not, you have to change to. NET ...
__
I'm sorry, but maybe I'm not quite clear about it.
I tried the PHP manual and opened the Extension=php_mssql.dll,extension=php_pdo_mssql.dll, but regardless of $dsn = "mssql:host=10.1.1.1;dbname= Test ", or $DSN =" dblib:host=10.1.1.1;dbname=test ";.
At New PDO, I was prompted with the error: uncaught exception ' pdoexception ' with message ' could not find driver '.

I saw in phpinfo that PDO drivers had only mysql,pgsql,sqlite three items in it, and guess that the MSSQL for PDO driver did not, but only searched for windows.
At the same time, see in the Mac with FreeTDS (he did not say is xampp or what environment), but also need Xcode and another component, and to compile, I think, there is no more concise method?

Therefore, I would like to mention a more complete question, I hope to have this practice of the expert can systematically answer, but also facilitate the search engine for SF diversion (because I found that the search engine to the SF rate is very fast), there are people who touch the similar problems, do not have to find ways to fight the West, Because it really takes time and energy, and you can't learn anything.

Reply content:

Find PHP used in traditional enterprises (with MSSQL, Oracle Database Enterprise) is really very few ah.

Recently there is a project that requires a PHP system to be deployed in the development and production environment, with PDO objects to access databases such as MySQL, MSSQL, and Oracle.

How do I do this, using PHP's PDO to configure access to these databases under Mac, Windows, Windows Server? MSSQL version Minimum 2005, currently used by the XAMPP integrated environment.

If not, you have to change to. NET ...
__
I'm sorry, but maybe I'm not quite clear about it.
I tried the PHP manual and opened the Extension=php_mssql.dll,extension=php_pdo_mssql.dll, but regardless of $dsn = "mssql:host=10.1.1.1;dbname= Test ", or $DSN =" dblib:host=10.1.1.1;dbname=test ";.
At New PDO, I was prompted with the error: uncaught exception ' pdoexception ' with message ' could not find driver '.

I saw in phpinfo that PDO drivers had only mysql,pgsql,sqlite three items in it, and guess that the MSSQL for PDO driver did not, but only searched for windows.
At the same time, see in the Mac with FreeTDS (he did not say is xampp or what environment), but also need Xcode and another component, and to compile, I think, there is no more concise method?

Therefore, I would like to mention a more complete question, I hope to have this practice of the expert can systematically answer, but also facilitate the search engine for SF diversion (because I found that the search engine to the SF rate is very fast), there are people who touch the similar problems, do not have to find ways to fight the West, Because it really takes time and energy, and you can't learn anything.

The Windows version of PHP has a built-in Oracle driver, in the EXT directory:
Php_oci8.dll
Php_oci8_11g.dll
Php_pdo_oci.dll
If you compile on Linux, add the following configure configuration items, such as:
--with-oci8=shared,instantclient,/usr/lib/oracle/11.2/client/lib
--with-pdo-oci=shared,instantclient,/usr/lib/oracle,11.2
Oracle Instant Client Download address (60MB):
Http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html

SQL Server Driver for PHP (Php_sqlsrv.dll and Php_pdo_sqlsrv.dll, only Windows supported):
http://www.microsoft.com/en-us/download/confirmation.aspx?id=20098
Access to SQL Server on Linux can be used Unixodbc+freetds
Freetds:unix/linux to connect SQL Server and Sybase drivers.
--with-pdo-dblib=dir pdo:dblib-db Support. DIR is the FreeTDS home directory
UNIXODBC is the data source manager that manages the names of data sources established by various data drivers.
FreeTDS is a free SQL Server/sybase driver in the Unix/linux system,
You can create a data source name by UNIXODBC and access the data by name.

So PHP is still simple to use MySQL, because the PHP source code directly built-in MySQL driver Mysqlnd, based on MYSQLND to provide mysqli/pdo_mysql support. Of course, PHP also has a built-in SQLite engine.

http://php.net/manual/zh/ref.pdo-oci.php
http://php.net/manual/zh/ref.pdo-dblib.php

In fact, I would like to say that the PHP compiler is troublesome, I generally choose an integrated integration environment is basically a right-click menu a tick

@murmur Google out of the first few basic is on the StackOverflow, I also probably browsed, basically like you answer: Lose a php.net link, or Microsoft Driver link.
Perhaps I do not understand English, can not understand it, if my English is good, also not on the Segmentfault.
Oh.

  • Related Article

    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.