1. Example of installing Apache 2 In Debian
# apt-get install libapache2-mod-php5 |
|
APT will automatically install and activate the PHP 5 module of Apache 2 and all dependent libraries. If you are not required to restart Apache during installation, you must manually:
2. stop and start Apache after installing PHP 5
# /etc/init.d/apache2 stop# /etc/init.d/apache2 start |
|
The above PHP only installs the core module. But it may not be enough. Users will soon find more activation modules, such as MySQL, cURL, and GD.
When you compile PHP from the source code, you needConfigureCommand to activate the module. With APT, you only need to install the additional software package. These packages are named "php4-*" (or "php5-*", if a third-party PHP 5 is installed ).
3. Obtain the list of additional PHP software packages.
|
As you can see from the output above, there are also many PHP modules that can be installed (except for php5-cgi, php5-cli, or php5-pear, these special software packages ). Carefully check and install what you need. If a module is selected without a corresponding library, APT will automatically install all dependent libraries.
If you choose to add MySQL, cURL, and gd to PHP, the command is similar:
4. Install MySQL, cURL, and gd support for PHP.
# apt-get install php5-mysql php5-curl php5-gd |
|
APT automatically adds the appropriate rows to differentPhp. ini(/Etc/php5/apache2/php. ini,/Etc/php5/cgi/php. ini.
5. Activate MySQL, cURL, and gd configuration lines in PHP.
extension=mysql.soextension=curl.soextension=gd.so |
|
Restart Apache to activate these modules as before.