downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Our source is open

The syntax highlighted source is automatically generated by PHP from the plaintext script. If you're interested in what's behind the several functions we used, you can always take a look at the source of the following files:

Of course, if you want to see the source of this page, we have it available. You can also browse the SVN repository for this website on svn.php.net.

Source of: /manual/en/mysql.installation.php

<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once
dirname(__FILE__) ."/toc/mysql.setup.inc";
$setup = array (
 
'home' =>
  array (
   
0 => 'index.php',
   
1 => 'PHP Manual',
  ),
 
'head' =>
  array (
   
0 => 'UTF-8',
   
1 => 'en',
  ),
 
'this' =>
  array (
   
0 => 'mysql.installation.php',
   
1 => 'Installation',
  ),
 
'up' =>
  array (
   
0 => 'mysql.setup.php',
   
1 => 'Installing/Configuring',
  ),
 
'prev' =>
  array (
   
0 => 'mysql.requirements.php',
   
1 => 'Requirements',
  ),
 
'next' =>
  array (
   
0 => 'mysql.configuration.php',
   
1 => 'Runtime Configuration',
  ),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);

manual_header();
?>
<div id="mysql.installation" class="section">
 <h2 class="title">Installation</h2>

 <p class="para">
  For compiling, simply use the
  <span class="option">--with-mysql[=DIR]</span>
  configuration option where the optional <i>[DIR]</i> points to
  the MySQL installation directory.
 </p>
 <p class="para">
  Although this MySQL extension is compatible with MySQL 4.1.0 and greater,
  it doesn&#039;t support the extra functionality that these versions provide.
  For that, use the <a href="ref.mysqli.php" class="link">MySQLi</a> extension.
 </p>
 <p class="para">
  If you would like to install the mysql extension along with the mysqli extension
  you have to use the same client library to avoid any conflicts.
 </p>

 <div id="mysql.installation.linux" class="section">
  <h2 class="title">Installation on Linux Systems</h2>
  <div class="section">
   <h2 class="title">PHP 4</h2>
   <p class="para">
    The option <span class="option">--with-mysql</span> is
    enabled by default. This default behavior may be disabled with the
    <span class="option">--without-mysql</span> configure option. 
    If MySQL is enabled without specifying the path to the
    MySQL install DIR, PHP will use the bundled MySQL client libraries.
   </p>
   <p class="para">
    Users who run other applications that use MySQL (for example,
    <i>auth-mysql</i>) should not use the bundled library, but rather specify the
    path to MySQL&#039;s install directory, like so:
    <span class="option">--with-mysql=/path/to/mysql</span>.
    This will force PHP to use the client libraries installed by MySQL, thus
    avoiding any conflicts.
   </p>
  </div>
  <div class="section">
   <h2 class="title">PHP 5+</h2>
   <p class="para">
    MySQL is not enabled by default, nor is the MySQL library
    bundled with PHP. Read this <a href="faq.databases.php#faq.databases.mysql.php5" class="link">
    FAQ</a> for details on why. Use the
    <span class="option">--with-mysql[=DIR]</span> configure option
    to include MySQL support.
    You can download <em class="emphasis">headers and libraries</em> from
    <a href="http://www.mysql.com/" class="link external">&raquo; MySQL</a>.
   </p>
  </div>
 </div>

 <div id="mysql.installation.windows" class="section">
  <h2 class="title">Installation on Windows Systems</h2>
  <div class="section">
   <h2 class="title">PHP 4</h2>
   <p class="para">
    The PHP MySQL extension is compiled into PHP.
   </p>
  </div>
  <div class="section">
   <h2 class="title">PHP 5+</h2>
   <p class="para">
    MySQL is no longer enabled by default, so the
    <var class="filename">php_mysql.dll</var> DLL must be enabled inside of
    <var class="filename">php.ini</var>. Also, PHP needs access to the MySQL client library. A file
    named <var class="filename">libmysql.dll</var> is included in the Windows PHP
    distribution and in order for PHP to talk to MySQL this file needs to be
    available to the Windows systems <span class="envar">PATH</span>. See the FAQ
    titled &quot;<a href="faq.installation.php#faq.installation.addtopath" class="link">How do I add my PHP
    directory to the <var class="varname">PATH</var> on Windows</a>&quot; for information on how to do
    this. Although copying <var class="filename">libmysql.dll</var> to the Windows
    system directory also works (because the system directory is by default in
    the system&#039;s <span class="envar">PATH</span>), it&#039;s not recommended.
   </p>
   <p class="para">
    As with enabling any PHP extension (such as
    <var class="filename">php_mysql.dll</var>), the PHP directive
    <a href="ini.core.php#ini.extension-dir" class="link">extension_dir</a> should be set to
    the directory where the PHP extensions are located. See also the
    <a href="install.windows.manual.php" class="link">Manual Windows Installation
    Instructions</a>. An example extension_dir value for PHP 5 is
    <i>c:\php\ext</i>
   </p>
   <blockquote><p><b class="note">Note</b>:
   
     If when starting the web server an error similar to the following occurs:
     <i>&quot;Unable to load dynamic library &#039;./php_mysql.dll&#039;&quot;</i>,
     this is because <var class="filename">php_mysql.dll</var> and/or
     <var class="filename">libmysql.dll</var> cannot be found by the system.
    <br />
   </p></blockquote>
  </div>
 </div>

 <div id="mysql.installation.notes" class="section">
  <h2 class="title">MySQL Installation Notes</h2>
   <div class="warning"><b class="warning">Warning</b>
    <p class="para">
     Crashes and startup problems of PHP may be encountered
     when loading this extension in conjunction with the recode extension.
     See the <a href="ref.recode.php" class="link">recode</a> extension for more
     information.
    </p>
   </div>
   <blockquote><p><b class="note">Note</b>:
   
     If you need charsets other than <em class="emphasis">latin</em> (default), you
     have to install external (not bundled) libmysql with compiled charset
     support.
    <br />
   </p></blockquote>
 </div>
</div><?php manual_footer(); ?>
 
show source | credits | sitemap | contact | advertising | mirror sites