[08254fc] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[ff769b8c] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
---|
[08254fc] | 4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 |
|
---|
| 7 | <!ENTITY php-download-http "http://us2.php.net/distributions/php-&php-version;.tar.bz2">
|
---|
| 8 | <!ENTITY php-download-ftp "ftp://ftp.isu.edu.tw/pub/Unix/Web/PHP/distributions/php-&php-version;.tar.bz2">
|
---|
[b9d1118] | 9 | <!ENTITY php-md5sum "fb1aac107870f897d26563a9cc5053c0">
|
---|
| 10 | <!ENTITY php-size "4.7 MB">
|
---|
[b84326b7] | 11 | <!ENTITY php-buildsize "138 MB">
|
---|
| 12 | <!ENTITY php-time "1.9 SBU">
|
---|
[08254fc] | 13 | ]>
|
---|
| 14 |
|
---|
[6683a00] | 15 | <sect1 id="php" xreflabel="PHP-&php-version;">
|
---|
[db81e4cb] | 16 | <?dbhtml filename="php.html"?>
|
---|
| 17 |
|
---|
| 18 | <sect1info>
|
---|
| 19 | <othername>$LastChangedBy$</othername>
|
---|
| 20 | <date>$Date$</date>
|
---|
| 21 | </sect1info>
|
---|
| 22 |
|
---|
| 23 | <title>PHP-&php-version;</title>
|
---|
| 24 |
|
---|
| 25 | <indexterm zone="php">
|
---|
| 26 | <primary sortas="a-PHP">PHP</primary>
|
---|
| 27 | </indexterm>
|
---|
| 28 |
|
---|
| 29 | <sect2 role="package">
|
---|
| 30 | <title>Introduction to PHP</title>
|
---|
| 31 |
|
---|
[7cd76d62] | 32 | <para><application>PHP</application> is the PHP Hypertext Preprocessor.
|
---|
| 33 | Primarily used in dynamic web sites, it allows for programming code to be
|
---|
[db81e4cb] | 34 | directly embedded into the HTML markup.</para>
|
---|
| 35 |
|
---|
| 36 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
| 37 | <itemizedlist spacing="compact">
|
---|
| 38 | <listitem>
|
---|
| 39 | <para>Download (HTTP): <ulink url="&php-download-http;"/></para>
|
---|
| 40 | </listitem>
|
---|
| 41 | <listitem>
|
---|
| 42 | <para>Download (FTP): <ulink url="&php-download-ftp;"/></para>
|
---|
| 43 | </listitem>
|
---|
| 44 | <listitem>
|
---|
| 45 | <para>Download MD5 sum: &php-md5sum;</para>
|
---|
| 46 | </listitem>
|
---|
| 47 | <listitem>
|
---|
| 48 | <para>Download size: &php-size;</para>
|
---|
| 49 | </listitem>
|
---|
| 50 | <listitem>
|
---|
| 51 | <para>Estimated disk space required: &php-buildsize;</para>
|
---|
| 52 | </listitem>
|
---|
| 53 | <listitem>
|
---|
| 54 | <para>Estimated build time: &php-time;</para>
|
---|
| 55 | </listitem>
|
---|
| 56 | </itemizedlist>
|
---|
| 57 |
|
---|
| 58 | <bridgehead renderas="sect3">Additional Downloads</bridgehead>
|
---|
| 59 | <itemizedlist spacing="compact">
|
---|
| 60 | <listitem>
|
---|
[7cd76d62] | 61 | <para>Required patch for Berkeley DB: <ulink
|
---|
[db81e4cb] | 62 | url="&patch-root;/php-&php-version;-db43-1.patch"/></para>
|
---|
| 63 | </listitem>
|
---|
[b84326b7] | 64 | <listitem>
|
---|
| 65 | <para>Pre-built documentation (optional): <ulink
|
---|
| 66 | url="http://www.php.net/download-docs.php"/></para>
|
---|
| 67 | </listitem>
|
---|
[db81e4cb] | 68 | </itemizedlist>
|
---|
| 69 |
|
---|
| 70 | <bridgehead renderas="sect3">PHP Dependencies</bridgehead>
|
---|
| 71 |
|
---|
| 72 | <bridgehead renderas="sect4">Required</bridgehead>
|
---|
| 73 | <para><xref linkend="apache"/></para>
|
---|
| 74 |
|
---|
[b84326b7] | 75 | <bridgehead renderas="sect4">Optional System Utilities and Libraries</bridgehead>
|
---|
[db81e4cb] | 76 | <para><xref linkend="libxml2"/>,
|
---|
| 77 | <xref linkend="libxslt"/>,
|
---|
| 78 | <xref linkend="fam"/>,
|
---|
[b84326b7] | 79 | <xref linkend="gmp"/>,
|
---|
[db81e4cb] | 80 | <xref linkend="pcre"/>,
|
---|
| 81 | <xref linkend="aspell"/>,
|
---|
| 82 | <xref linkend="pkgconfig"/>,
|
---|
[b84326b7] | 83 | <xref linkend="expat"/>,
|
---|
[b3799be4] | 84 | <ulink url="http://www.ossp.org/pkg/lib/mm/">OSSP mm</ulink>,
|
---|
[db81e4cb] | 85 | <ulink url="http://www.net-snmp.org/">Net-SNMP</ulink>,
|
---|
| 86 | <ulink url="http://dmalloc.com/">Dmalloc</ulink>,
|
---|
[b84326b7] | 87 | <ulink url="http://www.gnu.org/software/recode/">recode</ulink> and
|
---|
| 88 | an <ulink url="../server/mail.html">MTA</ulink></para>
|
---|
| 89 |
|
---|
| 90 | <bridgehead renderas="sect4">Optional Graphics Utilities and Libraries</bridgehead>
|
---|
| 91 | <para><xref linkend="libjpeg"/>,
|
---|
| 92 | <xref linkend="libtiff"/>,
|
---|
| 93 | <xref linkend="libpng"/>,
|
---|
| 94 | <xref linkend="freetype2"/>,
|
---|
| 95 | X (<xref linkend="xorg"/> or <xref linkend="xfree86"/>),
|
---|
| 96 | <ulink url="http://www.fastio.com/">ClibPDF</ulink>,
|
---|
| 97 | <ulink url="http://www.boutell.com/gd/">GD</ulink>,
|
---|
| 98 | <ulink url="http://gd.tuwien.ac.at/visual/ibiblio/libs/graphics/t1lib-5.1.0.tar.gz">
|
---|
| 99 | t1lib</ulink> and
|
---|
| 100 | <ulink url="http://partners.adobe.com/asn/acrobat/forms.jsp">FDF Toolkit</ulink></para>
|
---|
| 101 |
|
---|
| 102 | <bridgehead renderas="sect4">Optional Web Utilities</bridgehead>
|
---|
| 103 | <para><xref linkend="curl"/>,
|
---|
| 104 | <xref linkend="html-tidy"/>,
|
---|
[db81e4cb] | 105 | <ulink url="http://www.mnogosearch.org/">mnoGoSearch</ulink>,
|
---|
[b84326b7] | 106 | <ulink url="http://www.hyperwave.com/">Hyperwave</ulink>,
|
---|
| 107 | <ulink url="http://caudium.net/">Caudium</ulink> and
|
---|
| 108 | <ulink url="http://www.openwddx.org/">WDDX</ulink></para>
|
---|
| 109 |
|
---|
| 110 | <bridgehead renderas="sect4">Optional Data Management Utilities and Libraries</bridgehead>
|
---|
| 111 | <para><xref linkend="openldap"/>,
|
---|
| 112 | <xref linkend="gdbm"/>,
|
---|
| 113 | <xref linkend="db"/>,
|
---|
| 114 | <xref linkend="mysql"/>,
|
---|
| 115 | <xref linkend="postgresql"/>,
|
---|
[76b19ad] | 116 | <xref linkend="unixodbc"/>,
|
---|
[b84326b7] | 117 | <ulink url="http://qdbm.sourceforge.net/">QDBM</ulink>,
|
---|
| 118 | <ulink url="http://cr.yp.to/cdb.html">cdb</ulink>,
|
---|
| 119 | <ulink url="http://www.sqlite.org/">SQLite</ulink>,
|
---|
[db81e4cb] | 120 | <ulink url="http://www.hughes.com.au/products/msql/">Mini SQL</ulink>,
|
---|
| 121 | <ulink url="http://www.empress.com/">Empress</ulink>,
|
---|
| 122 | <ulink url="http://www.birdstep.com/">Birdstep</ulink>,
|
---|
| 123 | <ulink url="http://www.dbmaker.com/">DBMaker</ulink>,
|
---|
| 124 | <ulink url="http://www.softwareag.com/">Adabas</ulink>,
|
---|
[b84326b7] | 125 | <ulink url="http://www.frontbase.com/">FrontBase</ulink> and
|
---|
| 126 | <ulink url="http://www.mainstreetsoftworks.com/">Monetra</ulink></para>
|
---|
| 127 |
|
---|
| 128 | <bridgehead renderas="sect4">Optional Security/Encryption Utilities and Libraries</bridgehead>
|
---|
| 129 | <para><xref linkend="openssl"/>,
|
---|
| 130 | <xref linkend="cyrus-sasl"/>,
|
---|
| 131 | <xref linkend="mitkrb"/> or <xref linkend="heimdal"/>,
|
---|
| 132 | <ulink url="http://mcrypt.sourceforge.net/">libmcrypt</ulink> and
|
---|
| 133 | <ulink url="http://mhash.sourceforge.net/">mhash</ulink></para>
|
---|
[db81e4cb] | 134 |
|
---|
| 135 | </sect2>
|
---|
| 136 |
|
---|
| 137 | <sect2 role="installation">
|
---|
| 138 | <title>Installation of PHP</title>
|
---|
| 139 |
|
---|
| 140 | <note>
|
---|
| 141 | <para>You can use <application>PHP</application>
|
---|
| 142 | for server-side scripting, command line scripting or client-side
|
---|
| 143 | GUI applications. The book provides instructions for
|
---|
| 144 | setting up <application>PHP</application> for
|
---|
| 145 | server-side scripting as it is the most common form.</para>
|
---|
| 146 | </note>
|
---|
| 147 |
|
---|
[7cd76d62] | 148 | <para>If you have <application>Berkeley DB</application> installed and
|
---|
[db81e4cb] | 149 | wish to utilize it, apply the following patch:</para>
|
---|
| 150 |
|
---|
| 151 | <screen><userinput>patch -Np1 -i ../php-&php-version;-db43-1.patch</userinput></screen>
|
---|
| 152 |
|
---|
[b84326b7] | 153 | <note>
|
---|
| 154 | <para><application>PHP</application> has many more
|
---|
| 155 | <command>configure</command> options that will enable support for certain
|
---|
| 156 | things. You can use <command>./configure --help</command> to see a full
|
---|
| 157 | list of the available options. Also, use of the
|
---|
| 158 | <ulink url="http://www.php.net/">PHP web site</ulink>
|
---|
| 159 | is highly recommended, as their online docs are very good.</para>
|
---|
| 160 | </note>
|
---|
| 161 |
|
---|
| 162 | <para>Remove the <option>--disable-libxml</option> switch if you
|
---|
| 163 | have <xref linkend="libxml2"/> installed otherwise
|
---|
| 164 | <command>pear</command> will not be built.</para>
|
---|
| 165 |
|
---|
[db81e4cb] | 166 | <para>Install <application>PHP</application> by
|
---|
| 167 | running the following commands:</para>
|
---|
| 168 |
|
---|
| 169 | <screen><userinput>./configure --prefix=/usr \
|
---|
[4a93a3c] | 170 | --sysconfdir=/etc \
|
---|
| 171 | --with-apxs2 \
|
---|
| 172 | --with-config-file-path=/etc \
|
---|
| 173 | --with-zlib \
|
---|
[5056a3b] | 174 | --enable-bcmath \
|
---|
[4a93a3c] | 175 | --with-bz2 \
|
---|
[990f983] | 176 | --enable-calendar \
|
---|
[dfb9157] | 177 | --enable-dba \
|
---|
[5056a3b] | 178 | --enable-exif \
|
---|
[4a93a3c] | 179 | --enable-ftp \
|
---|
| 180 | --with-gettext \
|
---|
[fbbf93e] | 181 | --enable-mbstring \
|
---|
[36c668d] | 182 | --with-ncurses \
|
---|
[c1e05756] | 183 | --with-readline \
|
---|
[36c668d] | 184 | --disable-libxml &&
|
---|
[db81e4cb] | 185 | make</userinput></screen>
|
---|
| 186 |
|
---|
[b84326b7] | 187 | <para>To test the results, issue: <command>make test</command>. Note that
|
---|
| 188 | many of the tests are known to fail.</para>
|
---|
[1f01e7e7] | 189 |
|
---|
[db81e4cb] | 190 | <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
|
---|
| 191 |
|
---|
| 192 | <screen role="root"><userinput>make install &&
|
---|
[5cc1126a] | 193 | cp -v php.ini-recommended /etc/php.ini</userinput></screen>
|
---|
[db81e4cb] | 194 |
|
---|
[b84326b7] | 195 | <para>The pre-built HTML documentation is packaged in two forms: a tarball
|
---|
| 196 | containing many individual files, useful for quick loading into your
|
---|
| 197 | browser, and a tarball of one large file, which is useful for using the
|
---|
| 198 | search utility of your browser. If you downloaded any of the documentation,
|
---|
| 199 | the instructions below can be issued by the
|
---|
| 200 | <systemitem class='username'>root</systemitem> user to install it (note
|
---|
| 201 | these instructions assume English docs, modify the tarball names below if
|
---|
| 202 | necessary).</para>
|
---|
[db81e4cb] | 203 |
|
---|
[b84326b7] | 204 | <para>For the <quote>Single HTML</quote> tarball:</para>
|
---|
| 205 |
|
---|
| 206 | <screen role="root"><userinput>install -v -m644 ../php_manual_en.html.gz \
|
---|
| 207 | /usr/share/doc/php-&php-version; &&
|
---|
| 208 | gunzip -v /usr/share/doc/php-&php-version;/php_manual_en.html.gz</userinput></screen>
|
---|
| 209 |
|
---|
| 210 | <para>For the <quote>Many HTML files</quote> tarball:</para>
|
---|
| 211 |
|
---|
| 212 | <screen role="root"><userinput>install -v -m755 -d /usr/share/doc/php-&php-version; &&
|
---|
| 213 | tar -xvf ../php_manual_en.tar.gz -C /usr/share/doc/php-&php-version; &&
|
---|
| 214 | chown -v -R root:root /usr/share/doc/php-&php-version;/html</userinput></screen>
|
---|
[db81e4cb] | 215 |
|
---|
| 216 | </sect2>
|
---|
[b84326b7] | 217 |
|
---|
[934c9b26] | 218 | <sect2 role="commands">
|
---|
| 219 | <title>Command Explanations</title>
|
---|
[db81e4cb] | 220 |
|
---|
[934c9b26] | 221 | <para><parameter>--with-apxs2</parameter>: This parameter
|
---|
[b84326b7] | 222 | builds the Apache HTTPD 2.0 module.</para>
|
---|
[934c9b26] | 223 |
|
---|
| 224 | <para><parameter>--with-config-file-path=/etc</parameter>: This parameter
|
---|
| 225 | puts the <filename>php.ini</filename> configuration file in <filename
|
---|
| 226 | class='directory'>/etc</filename>.</para>
|
---|
| 227 |
|
---|
| 228 | <para><parameter>--with-zlib</parameter>: This parameter adds
|
---|
[3239e36] | 229 | support for <application>Zlib</application> compression.</para>
|
---|
[934c9b26] | 230 |
|
---|
[b84326b7] | 231 | <para><parameter>--enable-bcmath</parameter>: Enables
|
---|
| 232 | <command>bc</command> style precision math functions.</para>
|
---|
[934c9b26] | 233 |
|
---|
[b84326b7] | 234 | <para><parameter>--with-bz2</parameter>: Add support for
|
---|
| 235 | <application>Bzip2</application> compression functions.</para>
|
---|
[934c9b26] | 236 |
|
---|
| 237 | <para><parameter>--enable-calendar</parameter>: This parameter
|
---|
| 238 | provides support for calendar conversion.</para>
|
---|
| 239 |
|
---|
| 240 | <para><parameter>--enable-dba</parameter>: This parameter enables
|
---|
[3239e36] | 241 | numerous database support including Berkeley DB functions.</para>
|
---|
[934c9b26] | 242 |
|
---|
| 243 | <para><parameter>--enable-exif</parameter>: Enables functions
|
---|
| 244 | to access metadata from images.</para>
|
---|
| 245 |
|
---|
| 246 | <para><parameter>--enable-ftp</parameter>: This parameter
|
---|
[3239e36] | 247 | enables FTP functions.</para>
|
---|
[934c9b26] | 248 |
|
---|
| 249 | <para><parameter>--with-gettext</parameter>: Enables functions
|
---|
[3239e36] | 250 | that use <application>Gettext</application> text translation.</para>
|
---|
[934c9b26] | 251 |
|
---|
| 252 | <para><parameter>--enable-mbstring</parameter>: This parameter
|
---|
| 253 | enables multibyte string support.</para>
|
---|
| 254 |
|
---|
| 255 | <para><parameter>--with-ncurses</parameter>: Provides ncurses
|
---|
| 256 | terminal independent cursor handling.</para>
|
---|
| 257 |
|
---|
| 258 | <para><parameter>--with-readline</parameter>: This parameter
|
---|
[b84326b7] | 259 | enables command line <application>Readline</application> support.</para>
|
---|
[934c9b26] | 260 |
|
---|
| 261 | <para><parameter>--disable-libxml</parameter>: This parameter
|
---|
[b84326b7] | 262 | disables XML support functions. This should be removed if you have
|
---|
| 263 | <application>Libxml2</application> installed.</para>
|
---|
[934c9b26] | 264 |
|
---|
| 265 | </sect2>
|
---|
| 266 |
|
---|
[db81e4cb] | 267 | <sect2 role="configuration">
|
---|
| 268 | <title>Configuring PHP</title>
|
---|
| 269 |
|
---|
| 270 | <sect3 id="php-config">
|
---|
| 271 | <title>Config Files</title>
|
---|
| 272 |
|
---|
| 273 | <para><filename>/etc/php.ini</filename>,
|
---|
| 274 | <filename>/etc/pear.conf</filename></para>
|
---|
| 275 |
|
---|
| 276 | <indexterm zone="php php-config">
|
---|
| 277 | <primary sortas="e-etc-php.ini">/etc/php.ini</primary>
|
---|
| 278 | </indexterm>
|
---|
| 279 |
|
---|
| 280 | <indexterm zone="php php-config">
|
---|
| 281 | <primary sortas="e-etc-pear.conf">/etc/pear.conf</primary>
|
---|
| 282 | </indexterm>
|
---|
| 283 |
|
---|
| 284 | </sect3>
|
---|
| 285 |
|
---|
| 286 | <sect3>
|
---|
| 287 | <title>Configuration Information</title>
|
---|
| 288 |
|
---|
[b84326b7] | 289 | <para>You may have noticed the following from the output of the
|
---|
| 290 | <command>make install</command> command:</para>
|
---|
| 291 |
|
---|
| 292 | <screen><computeroutput>You may want to add: /usr/lib/php to your php.ini include_path</computeroutput></screen>
|
---|
| 293 |
|
---|
| 294 | <para>If desired, add the entry using the following command as the
|
---|
| 295 | <systemitem class="username">root</systemitem> user:</para>
|
---|
| 296 |
|
---|
| 297 | <screen role="root"><userinput>sed -i 's@php/includes"@&\ninclude_path = ".:/usr/lib/php"@' \
|
---|
| 298 | /etc/php.ini</userinput></screen>
|
---|
| 299 |
|
---|
[0619e6d] | 300 | <para>To enable PHP support in the <application>Apache</application>
|
---|
[db81e4cb] | 301 | web server, a new LoadModule (which should be handled automatically by the
|
---|
[7cd76d62] | 302 | <command>make install</command> command) and AddType directives
|
---|
[db81e4cb] | 303 | must be added to the <filename>httpd.conf</filename> file:</para>
|
---|
| 304 |
|
---|
| 305 | <screen><literal>LoadModule php5_module lib/apache/libphp5.so
|
---|
| 306 | AddType application/x-httpd-php .php</literal></screen>
|
---|
| 307 |
|
---|
[7cd76d62] | 308 | <para>Also, it can be useful to add an entry for
|
---|
| 309 | <filename>index.php</filename> to the DirectoryIndex directive of the
|
---|
[db81e4cb] | 310 | <filename>httpd.conf</filename> file.</para>
|
---|
| 311 |
|
---|
[7cd76d62] | 312 | <para>You'll need to restart the <application>Apache</application> web server
|
---|
[0619e6d] | 313 | after making any modifications to the <filename>httpd.conf</filename>
|
---|
[db81e4cb] | 314 | file.</para>
|
---|
| 315 |
|
---|
| 316 | </sect3>
|
---|
| 317 |
|
---|
| 318 | </sect2>
|
---|
| 319 |
|
---|
| 320 | <sect2 role="content">
|
---|
| 321 | <title>Contents</title>
|
---|
| 322 |
|
---|
| 323 | <segmentedlist>
|
---|
| 324 | <segtitle>Installed Programs</segtitle>
|
---|
| 325 | <segtitle>Installed Library</segtitle>
|
---|
| 326 | <segtitle>Installed Directories</segtitle>
|
---|
| 327 |
|
---|
| 328 | <seglistitem>
|
---|
| 329 | <seg>pear, php, php-config, phpextdist, and phpize</seg>
|
---|
| 330 | <seg>libphp5.so</seg>
|
---|
| 331 | <seg>/usr/include/php and /usr/lib/php</seg>
|
---|
| 332 | </seglistitem>
|
---|
| 333 | </segmentedlist>
|
---|
| 334 |
|
---|
| 335 | <variablelist>
|
---|
| 336 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 337 | <?dbfo list-presentation="list"?>
|
---|
| 338 | <?dbhtml list-presentation="table"?>
|
---|
| 339 |
|
---|
| 340 | <varlistentry id="php-prog">
|
---|
| 341 | <term><command>php</command></term>
|
---|
| 342 | <listitem>
|
---|
[7cd76d62] | 343 | <para>is a command line interface that enables you to parse and
|
---|
[db81e4cb] | 344 | execute PHP code.</para>
|
---|
| 345 | <indexterm zone="php php-prog">
|
---|
| 346 | <primary sortas="b-php">php</primary>
|
---|
| 347 | </indexterm>
|
---|
| 348 | </listitem>
|
---|
| 349 | </varlistentry>
|
---|
| 350 |
|
---|
| 351 | <varlistentry id="pear">
|
---|
| 352 | <term><command>pear</command></term>
|
---|
| 353 | <listitem>
|
---|
[7cd76d62] | 354 | <para>is the PHP Extension and Application
|
---|
[db81e4cb] | 355 | Repository (PEAR) package manager.</para>
|
---|
| 356 | <indexterm zone="php pear">
|
---|
| 357 | <primary sortas="b-pear">pear</primary>
|
---|
| 358 | </indexterm>
|
---|
| 359 | </listitem>
|
---|
| 360 | </varlistentry>
|
---|
| 361 |
|
---|
| 362 | </variablelist>
|
---|
| 363 |
|
---|
| 364 | </sect2>
|
---|
[f45b1953] | 365 |
|
---|
| 366 | </sect1>
|
---|