<!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>Debian GNU/Linux installation notes</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="install.unix.solaris.html">Solaris specific installation tips</a></div> <div class="next" style="text-align: right; float: right;"><a href="install.macosx.html">Installation on Mac OS X</a></div> <div class="up"><a href="install.unix.html">Installation on Unix systems</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="install.unix.debian" class="sect1"> <h2 class="title">Debian GNU/Linux installation notes</h2> <p class="para"> This section contains notes and hints specific to installing PHP on <a href="http://www.debian.org/" class="link external">» Debian GNU/Linux</a>. </p> <div class="warning"><strong class="warning">Warning</strong> <p class="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 <a href="http://www.php.net/downloads.php" class="link external">» download area</a>. </p> </div> <p class="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 <em>apt-get</em> or <em>aptitude</em> commands. This manual page uses these two commands interchangeably. </p> <div class="sect2" id="install.unix.debian.apt"> <h3 class="title">Using APT</h3> <p class="simpara"> First, note that other related packages may be desired like <em>libapache2-mod-php5</em> to integrate with Apache 2, and <em>php-pear</em> for PEAR. </p> <p class="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 <strong class="command">apt-get update</strong>. </p> <div class="example" id="install.unix.debian.apt.example"> <p><strong>Example #1 Debian Install Example with Apache 2</strong></p> <div class="example-contents"> <div class="shellcode"><pre class="shellcode"># apt-get install php5-common libapache2-mod-php5 php5-cli</pre> </div> </div> </div> <p class="simpara"> APT will automatically install the PHP 5 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: </p> <div class="example" id="install.unix.debian.apt.example2"> <p><strong>Example #2 Stopping and starting Apache once PHP is installed</strong></p> <div class="example-contents"> <div class="shellcode"><pre class="shellcode"># /etc/init.d/apache2 stop # /etc/init.d/apache2 start</pre> </div> </div> </div> </div> <div class="sect2" id="install.unix.debian.config"> <h3 class="title">Better control of configuration</h3> <p class="simpara"> In the last section, PHP was installed with only core modules. It's very likely that additional modules will be desired, such as <a href="book.mysql.html" class="link">MySQL</a>, <a href="book.curl.html" class="link">cURL</a>, <a href="book.image.html" class="link">GD</a>, etc. These may also be installed via the <em>apt-get</em> command. </p> <div class="example" id="install.unix.debian.config.example"> <p><strong>Example #3 Methods for listing additional PHP 5 packages</strong></p> <div class="example-contents"> <div class="shellcode"><pre class="shellcode"># apt-cache search php5 # aptitude search php5 # aptitude search php5 |grep -i mysql</pre> </div> </div> </div> <p class="simpara"> The examples will show a lot of packages including several PHP specific ones like php5-cgi, php5-cli and php5-dev. Determine which are needed and install them like any other with either <em>apt-get</em> or <em>aptitude</em>. And because Debian performs dependency checks, it'll prompt for those so for example to install MySQL and cURL: </p> <div class="example" id="install.unix.debian.config.example2"> <p><strong>Example #4 Install PHP with MySQL, cURL</strong></p> <div class="example-contents"> <div class="shellcode"><pre class="shellcode"># apt-get install php5-mysql php5-curl</pre> </div> </div> </div> <p class="simpara"> APT will automatically add the appropriate lines to the different <var class="filename">php.ini</var> related files like <var class="filename">/etc/php5/apache2/php.ini</var>, <var class="filename">/etc/php5/conf.d/pdo.ini</var>, etc. and depending on the extension will add entries similar to <em>extension=foo.so</em>. However, restarting the web server (like Apache) is required before these changes take affect. </p> </div> <div class="sect2" id="install.unix.debian.faq"> <h3 class="title">Common Problems</h3> <ul class="itemizedlist"> <li class="listitem"> <span class="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 <var class="filename">/etc/apache2/apache2.conf</var> or similar. See the Debian manual for further details. </span> </li> <li class="listitem"> <span class="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. </span> </li> <li class="listitem"> <span class="simpara"> There are two basic commands for installing packages on Debian (and other linux variants): <em>apt-get</em> and <em>aptitude</em>. However, explaining the subtle differences between these commands goes beyond the scope of this manual. </span> </li> </ul> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="install.unix.solaris.html">Solaris specific installation tips</a></div> <div class="next" style="text-align: right; float: right;"><a href="install.macosx.html">Installation on Mac OS X</a></div> <div class="up"><a href="install.unix.html">Installation on Unix systems</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>