Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 9729

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Terminology overview</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="mysql.html">Overview of the MySQL PHP drivers</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="mysqlinfo.api.choosing.html">Choosing an API</a></div>
 <div class="up"><a href="mysql.html">Overview of the MySQL PHP drivers</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="mysqlinfo.terminology" class="chapter">
   <h1>Terminology overview</h1>

   <p class="para">
    This section provides an introduction to the options available to
    you when developing a PHP application that needs to interact with a
    MySQL database.
   </p>

   <p class="para">
    <em class="emphasis">What is an API?</em>
   </p>

   <p class="para">
    An Application Programming Interface, or API, defines the classes,
    methods, functions and variables that your application will need to
    call in order to carry out its desired task. In the case of PHP
    applications that need to communicate with databases the necessary
    APIs are usually exposed via PHP extensions.
   </p>

   <p class="para">
    APIs can be procedural or object-oriented. With a procedural API you
    call functions to carry out tasks, with the object-oriented API you
    instantiate classes and then call methods on the resulting objects.
    Of the two the latter is usually the preferred interface, as it is
    more modern and leads to better organized code.
   </p>

   <p class="para">
    When writing PHP applications that need to connect to the MySQL
    server there are several API options available. This document
    discusses what is available and how to select the best solution for
    your application.
   </p>

   <p class="para">
    <em class="emphasis">What is a Connector?</em>
   </p>

   <p class="para">
    In the MySQL documentation, the term <em class="emphasis">connector</em>
    refers to a piece of software that allows your application to
    connect to the MySQL database server. MySQL provides connectors for
    a variety of languages, including PHP.
   </p>

   <p class="para">
    If your PHP application needs to communicate with a database server
    you will need to write PHP code to perform such activities as
    connecting to the database server, querying the database and other
    database-related functions. Software is required to provide the API
    that your PHP application will use, and also handle the
    communication between your application and the database server,
    possibly using other intermediate libraries where necessary. This
    software is known generically as a connector, as it allows your
    application to <em class="emphasis">connect</em> to a database server.
   </p>

   <p class="para">
    <em class="emphasis">What is a Driver?</em>
   </p>

   <p class="para">
    A driver is a piece of software designed to communicate with a
    specific type of database server. The driver may also call a
    library, such as the MySQL Client Library or the MySQL Native
    Driver. These libraries implement the low-level protocol used to
    communicate with the MySQL database server.
   </p>

   <p class="para">
    By way of an example, the <a href="mysqli.overview.html#mysqli.overview.pdo" class="link">PHP
    Data Objects (PDO)</a> database abstraction layer may use one of
    several database-specific drivers. One of the drivers it has
    available is the PDO MYSQL driver, which allows it to interface with
    the MySQL server.
   </p>

   <p class="para">
    Sometimes people use the terms connector and driver interchangeably,
    this can be confusing. In the MySQL-related documentation the term
    "<span class="quote">driver</span>" is reserved for software that provides
    the database-specific part of a connector package.
   </p>

   <p class="para">
    <em class="emphasis">What is an Extension?</em>
   </p>

   <p class="para">
    In the PHP documentation you will come across another term -
    <em class="emphasis">extension</em>. The PHP code consists of a core,
    with optional extensions to the core functionality. PHP&#039;s
    MySQL-related extensions, such as the <em>mysqli</em>
    extension, and the <em>mysql</em> extension, are
    implemented using the PHP extension framework.
   </p>

   <p class="para">
    An extension typically exposes an API to the PHP programmer, to
    allow its facilities to be used programmatically. However, some
    extensions which use the PHP extension framework do not expose an
    API to the PHP programmer.
   </p>

   <p class="para">
    The PDO MySQL driver extension, for example, does not expose an API
    to the PHP programmer, but provides an interface to the PDO layer
    above it.
   </p>

   <p class="para">
    The terms API and extension should not be taken to mean the same
    thing, as an extension may not necessarily expose an API to the
    programmer.
   </p>
  </div>
<hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="mysql.html">Overview of the MySQL PHP drivers</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="mysqlinfo.api.choosing.html">Choosing an API</a></div>
 <div class="up"><a href="mysql.html">Overview of the MySQL PHP drivers</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>