php-doc-en/install/unix/debian.xml
2021-09-23 11:45:22 +09:00

153 lines
5.4 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<sect1 xml:id="install.unix.debian" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Debian GNU/Linux installation notes</title>
<para>
This section contains notes and hints specific to installing
PHP on <link xlink:href="&url.debian;">Debian GNU/Linux</link>.
</para>
<warning>
<para>
Unofficial builds from third-parties are not supported here. Any bugs
should be reported to the Debian team unless they can be reproduced using
the latest builds from our <link xlink:href="&url.php.downloads;">download
area</link>.
</para>
</warning>
<para>
While the instructions for building PHP on Unix apply to Debian as well,
this manual page contains specific information for other options, such as
using either the <literal>apt</literal> or <literal>aptitude</literal>
commands. This manual page uses these two commands interchangeably.
</para>
<sect2 xml:id="install.unix.debian.apt">
<title>Using APT</title>
<simpara>
First, note that other related packages may be desired like
<literal>libapache-mod-php</literal> to integrate with Apache 2, and
<literal>php-pear</literal> for PEAR.
</simpara>
<simpara>
Second, before installing a package, it's wise to ensure the package list
is up to date. Typically, this is done by running the command
<command>apt update</command>.
</simpara>
<example xml:id="install.unix.debian.apt.example">
<title>Debian Install Example with Apache 2</title>
<programlisting role="shell">
<![CDATA[
# apt install php-common libapache2-mod-php php-cli
]]>
</programlisting>
</example>
<simpara>
APT will automatically install the PHP module for Apache 2 and all of its
dependencies, and then activate it. Apache should be restarted in order for
the changes take place. For example:
</simpara>
<example xml:id="install.unix.debian.apt.example2">
<title>Stopping and starting Apache once PHP is installed</title>
<programlisting role="shell">
<![CDATA[
# /etc/init.d/apache2 stop
# /etc/init.d/apache2 start
]]>
</programlisting>
</example>
</sect2>
<sect2 xml:id="install.unix.debian.config">
<title>Better control of configuration</title>
<simpara>
In the last section, PHP was installed with only core modules. It's
very likely that additional modules will be desired, such as
<link linkend="book.mysql">MySQL</link>,
<link linkend="book.curl">cURL</link>,
<link linkend="book.image">GD</link>,
etc. These may also be installed via the <literal>apt</literal> command.
</simpara>
<example xml:id="install.unix.debian.config.example">
<title>Methods for listing additional PHP packages</title>
<programlisting role="shell">
<![CDATA[
# apt-cache search php
# apt search php | grep -i mysql
# aptitude search php
]]>
</programlisting>
</example>
<simpara>
The examples will show a lot of packages including several PHP specific ones
like php-cgi, php-cli and php-dev. Determine which are needed
and install them like any other with either <literal>apt</literal>
or <literal>aptitude</literal>. And because Debian performs
dependency checks, it'll prompt for those so for example to install
MySQL and cURL:
</simpara>
<example xml:id="install.unix.debian.config.example2">
<title>Install PHP with MySQL, cURL</title>
<programlisting role="shell">
<![CDATA[
# apt install php-mysql php-curl
]]>
</programlisting>
</example>
<simpara>
APT will automatically add the appropriate lines to the
different &php.ini; related files like
<filename>/etc/php/7.4/php.ini</filename>,
<filename>/etc/php/7.4/conf.d/*.ini</filename>, etc. and depending on
the extension will add entries similar to <literal>extension=foo.so</literal>.
However, restarting the web server (like Apache) is required before these
changes take affect.
</simpara>
</sect2>
<sect2 xml:id="install.unix.debian.faq">
<title>Common Problems</title>
<itemizedlist>
<listitem>
<simpara>
If the PHP scripts are not parsing via the web server, then it's
likely that PHP was not added to the web server's configuration
file, which on Debian may be <filename>/etc/apache2/apache2.conf</filename>
or similar. See the Debian manual for further details.
</simpara>
</listitem>
<listitem>
<simpara>
If an extension was seemingly installed yet the functions are undefined,
be sure that the appropriate ini file is being loaded and/or the web
server was restarted after installation.
</simpara>
</listitem>
<listitem>
<simpara>
There are two basic commands for installing packages on Debian (and other
linux variants): <literal>apt</literal> and <literal>aptitude</literal>.
However, explaining the subtle differences between these commands goes
beyond the scope of this manual.
</simpara>
</listitem>
</itemizedlist>
</sect2>
</sect1>
<!-- 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
-->