<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->

<chapter xml:id="fann.setup" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
 &reftitle.setup;

 <section xml:id="fann.requirements">
  &reftitle.required;
  <para>
   PHP &gt;= 5.2.0 and libfann &gt;= 2.1.0
  </para>
 </section>

 <section xml:id="fann.installation">
  &reftitle.install;
  <para>
   The FANN PHP extension should work on all Linux systems.
 </para>

  <simplelist>
   <member>
    <xref linkend="fann.installation.lib" />
   </member>
   <member>
    <xref linkend="fann.installation.pecl" />
   </member>
   <member>
    <xref linkend="fann.installation.manual" />
   </member>
  </simplelist>

  <section xml:id="fann.installation.lib">

   <title>FANN Library Installation</title>

   <para>
    Before you start installation make sure that <emphasis>libfann</emphasis> is installed
    on your system. It's part of the main repository in the most Linux distributions
    (search for <emphasis>fann</emphasis>). You need a development version.
   </para>
   <para>
    If it is not installed, you need to install it first. Either download it from the
    <link xlink:href="&url.fann.lib;">official site</link> or get it from your distro
    repository. For example on Fedora:
    <programlisting>
<![CDATA[

$ sudo yum install fann-devel

]]>
    </programlisting>
    or Ubuntu:
    <programlisting>
<![CDATA[

$ sudo apt-get install libfann-dev

]]>
    </programlisting>
   </para>
   <para>
    If the library is re-installed manually, then all old library file should be removed
    before re-installing otherwise the old library version could be linked.
   </para>
  </section>

  <section xml:id="fann.installation.pecl">

   <title>PECL Installation</title>

   <para>
    This extension is available on PECL. The installation is very simple. Just run:
    <programlisting>
<![CDATA[

$ sudo pecl install fann

]]>
    </programlisting>
   </para>
  </section>

  <section xml:id="fann.installation.manual">

   <title>Manual Installation</title>

   <para>
    For developers and people interested in the latest changes, you
    can compile the driver from the latest source code on
    <link xlink:href="&url.fann.github;">Github</link>.
    Go to Github and click the "Download ZIP" button. Then run:

    <programlisting>
<![CDATA[

$ unzip php-fann-master.zip
$ cd php-fann-master
$ phpize
$ ./configure
$ make all
$ sudo make install

]]>
    </programlisting>
   </para>

   <para>
    Make the following changes to php.ini:
   </para>
   <itemizedlist>
    <listitem>
     <para>
      Make sure the <emphasis>extension_dir</emphasis> variable is pointing to
      the directory containing <emphasis>fann.so</emphasis>. The build will display where
      it is installing the PHP driver with output that looks something like:
      <programlisting>
<![CDATA[

Installing '/usr/lib/php/extensions/no-debug-non-zts-20060613/fann.so'

]]>
      </programlisting>

      Make sure that it is the same as the PHP extension directory by running:

      <programlisting>
<![CDATA[

$ php -i | grep extension_dir
  extension_dir => /usr/lib/php/extensions/no-debug-non-zts-20060613 =>
                   /usr/lib/php/extensions/no-debug-non-zts-20060613

]]>
      </programlisting>

      If it's not, change the <emphasis>extension_dir</emphasis> in php.ini or
      move <emphasis>fann.so</emphasis>.
     </para>
    </listitem>
    <listitem>
     <para>
      To load the extension on PHP startup, add a line:

      <programlisting>
<![CDATA[

extension=fann.so

]]>
      </programlisting>

     </para>
   </listitem>

   </itemizedlist>
  </section>
 </section>

 <section xml:id="fann.configuration">
  &reftitle.runtime;
  &no.config;
 </section>

 <section xml:id="fann.resources">
  &reftitle.resources;
  <para>

  </para>
 </section>

</chapter>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
