Does PHP have to connect with MySQL, Oracle, SQL Server line?
Reply content:
Does PHP have to connect with MySQL, Oracle, SQL Server line?
PHP for each database system (Mysql/sqlite/postgresql/oracle/sql Server) corresponding to the extension
PHP three major MySQL connection methods (5.4 start to drive the underlying implementation are all MYSQLND):
Mysqli (preferred) pdo_mysql (recommended) MySQL (not recommended)
PHP has built-in MySQL driver Mysqlnd starting from 5.4:
php-src/ext/mysqlnd/php-src/ext/mysql/php-src/ext/mysqli/php-src/ext/pdo_mysql/
Relationship: Mysql,mysqli,pdo_mysql This 3 set of PHP operation MySQL programming interface bottom all rely on PHP built-in MySQL driver mysqlnd.
Framework to be compatible with a variety of databases, so like to use PDO.
But like phpMyAdmin, a PHP program that specializes in managing MySQL, it uses a better mysqli for MySQL support.
PHP5.3 Enable MYSQLND support like this:
--with-mysql=mysqlnd--with-mysqli=mysqlnd--with-pdo-mysql=mysqlnd
When PHP5.4 is left blank, MYSQLND is enabled by default:
--with-mysql--with-mysqli--with-pdo-mysql
PHP7 began to no longer support--with-mysql.
Sqlite:
--with-sqlite3 is enabled by default.
--with-pdo-sqlite is enabled by default and relies on--with-sqlite3, it is recommended to use Pdo_sqlite to manipulate SQLite.
The following extensions are built into the Windows binary package ext directory:
php_mysql.dllphp_mysqli.dllphp_pdo_mysql.dllphp_sqlite3.dllphp_pdo_sqlite.dll
Debian/ubuntu Package: Php5-mysqlnd php5-sqlite
PostgreSQL Driver for PHP:
--with-pgsql=DIR--with-pdo-pgsql=DIRDIR is the PostgreSQL base install directory or the path to pg_config.
Debian/ubuntu Package: Php5-pgsql
apt-cache depends php5-pgsql
See the C client library that relies on LIBPQ5 for this PostgreSQL.
Development package Libpq-dev with/usr/bin/pg_config.
sudo apt-get install libpq-dev--with-pgsql=/usr/bin/pg_config--with-pdo-pgsql=/usr/bin/pg_config
Oracle Driver for PHP:
--with-oci8=DIR--with-pdo-oci=DIR 此扩展是试验性质的.DIR defaults to $ORACLE_HOME.
or install the Oracle Instant client and specify this:
--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/technet ...
Php_oci8.dll
Php_oci8_11g.dll
Php_pdo_oci.dll
SQL Server Driver for PHP (Php_sqlsrv.dll and Php_pdo_sqlsrv.dll, only Windows supported):
Http://www.microsoft.com/en-u ...
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.
UNIXODBC provides Linux support for ODBC, but it's just an ODBC manager,
The ODBC driver for this database is also provided to connect to the actual database.
FreeTDS is the free ODBC driver for connecting SQL Server and Sybase under Linux.
Install UNIXODBC First, then install FreeTDS.
IODBC is a unix/linux ODBC database connection implementation, similar projects have UNIXODBC.
--with-iodbc--with-pdo-odbc=iODBC,/usr/local--with-unixODBC--with-pdo-odbc=unixODBC,/usr/local
Related Packages on Ubuntu/debian:
php5-odbc - ODBC module for php5php5-sybase - Sybase / MS SQL Server module for php5/usr/lib/php5/20121212/mssql.so/usr/lib/php5/20121212/pdo_dblib.so
Of course it has to be.
PHP can be said to use any database on the market, but their MySQL match is the most efficient, like PHP can be used by IIS, or Apache. In contrast to Apache under the high efficiency, and then appeared Nginx, under it more efficient.
Use PDO to complete the adaptation without worrying about any database
Of course, it's not necessarily a link to MySQL.
Mainly depends on your needs
PHP has PDO, has abstracted the specific DB Driver, the other database certainly can.
PDO Dafa Good
It can only be said that MySQL is the most widely used and open source free of many other common databases are available
PHP and MySQL are gold partners, but not only with MySQL, using PDO to manipulate a variety of databases