PHP 手冊
上一頁 | 章 3.安裝 | 下一頁

# Installation on Unix systems

This section will guide you through the general configuration and installation of PHP on Unix systems. Be sure to investigate any sections specific to your platform or web server before you begin the process.

Prerequisite knowledge and software:

- Basic Unix skills (being able to operate "make" and a C compiler, if compiling)

- An ANSI C compiler (if compiling)

- flex (for compiling)

- bison (for compiling)

- A web server

- Any module specific components (such as gd, pdf libs, etc.)

There are several ways to install PHP for the Unix platform, either with a compile and configure process, or through various pre-packaged methods. This documentation is mainly focused around the process of compiling and configuring PHP.

The initial PHP setup and configuration process is controlled by the use of the commandline options of the `configure` script. This page outlines the usage of the most common options, but there are many others to play with. Check out the chapter on configure options for more details. There are several ways to install PHP:

- As an Apache 1.x module or an Apache 2.x module.

- As an Pike module for Caudium

- For use with AOLServer, NSAPI, phttpd, Pi3Web, Roxen, thttpd, or Zeus.

- As a CGI executable

## Apache Module Quick Reference

PHP can be compiled in a number of different ways, but one of the most popular is as an Apache module. The following is a quick installation overview.

示範 3-2. Quick Installation Instructions for PHP 4 (Apache Module Version)

    1.  gunzip apache_1.3.x.tar.gz
    2.  tar xvf apache_1.3.x.tar
    3.  gunzip php-x.x.x.tar.gz
    4.  tar xvf php-x.x.x.tar
    5.  cd apache_1.3.x
    6.  ./configure --prefix=/www
    7.  cd ../php-x.x.x
    8.  ./configure --with-mysql --with-apache=../apache_1.3.x --enable-ftp
    9.  make
    10. make install
    11. cd ../apache_1.3.x
    12. ./configure --activate-module=src/modules/php4/libphp4.a
    13. make
    14. make install
    15. cd ../php-x.x.x
    16. cp php.ini-dist /usr/local/lib/php.ini
    17. Edit your httpd.conf or srm.conf file and add:
          AddType application/x-httpd-php .php

    18. Use your normal procedure for restarting the Apache server. (You must
        stop and restart the server, not just cause the server to reload by
        use a HUP or USR1 signal.)

## Building

When PHP is configured, you are ready to build the CGI executable. The command make should take care of this. If it fails and you can't figure out why, see the Problems section.

上一頁 | 最開頭 | 下一頁
Unix/Solaris installs | 上一層 | Installation on Windows systems