©
이 문서에서는 PHP 중국어 웹사이트 매뉴얼 풀어 주다
本节包含了在 » Debian GNU/Linux 下安装 PHP 的说明和提示。
这里不支持非官方的第三方发行包。任何错误应报告给 Debian 开发组,除非该错误在使用从官方» 下载的最新版时仍能重现。
尽管在 Unix 下编译 PHP 的指示也适用于 Debian,本节包含有一些特定信息,例如使用 apt-get 或者 aptitude 命令。本节中这两条命令可以互换。
首先,注意其它有关的包可能需要 libapache2-mod-php5 集成入 Apache 2,以及 PEAR 的 php-pear。
其次,在安装一个包之前,最好先确定该包是最新版。通常可以运行命令 apt-get update。
Example #1 Debian 下将 PHP 安装入 Apache 2 的例子
# apt-get install php5-common libapache2-mod-php5 php5-cli
APT 将自动安装 Apache 2 的 PHP 5 模块以及所有依赖的库并激活之。应重启动 Apache 以使更改生效,例如:
Example #2 安装完 PHP 后停止并启动 Apache
# /etc/init.d/apache2 stop # /etc/init.d/apache2 start
上一节中 PHP 仅安装了核心模块。很可能还需要更多模块,例如 MySQL,cURL,GD 等。这些模块也可以通过 apt-get 命令安装。
Example #3 取得 PHP 附加软件包的列表
# apt-cache search php5 # aptitude search php5 # aptitude search php5 |grep -i mysql
以上命令的输出中列出了很多的包,其中有几个针对 PHP 的模块例如 php5-cgi,php5-cli 以及 php5-dev。决定好要安装哪些之后可以用 apt-get 或者 aptitude 来安装。Debian 会进行倚赖性检查,会给出提示,例如安装 MySQL 和 cURL:
Example #4 安装 PHP 的 MySQL 和 cURL 支持
# apt-get install php5-mysql php5-curl
APT 会自动把适当的行添加到不同的 php.ini 相关文件中去,例如 /etc/php5/apache2/php.ini,/etc/php5/conf.d/pdo.ini 等,并且根据扩展,还会添加类似 extension=foo.so 的内容。不过还是需要重新启动 web 服务器(例如 Apache)以使这些改动生效。
[#1] marin at sagovac dot com [2014-03-23 13:10:09]
To install LAMP stack on Ubuntu (+Server) from 10.04 you need first install taskel and then lamp-server for example:
Install taskel, follow terminal guides:
sudo apt-get install tasksel
Install LAMP stack package from Ubuntu repository:
sudo tasksel install lamp-server
[#2] thumbs at apache dot org [2013-06-27 17:50:35]
To refresh this document, perhaps it would be worth mentioning more modern methods to serve php content under apache httpd.
Specifically, the preferred method is now fastcgi, using either of those recipes:
(mod_fastcgi, httpd 2.2)
http://wiki.apache.org/httpd/php-fastcgi
(mod_fcgid, httpd 2.2)
http://wiki.apache.org/httpd/php-fcgid
(mod_proxy_fcgi, httpd 2.4)
http://wiki.apache.org/httpd/PHP-FPM
While the legacy mod_php approach is still applicable for some older installations, the fastcgi method is much faster, and require much less RAM to operate, based on similar traffic patterns.
Thank you!
[#3] juraj at jurajsplayground dot com [2009-05-08 17:59:37]
On Ubuntu (since 7.04), rather do:
sudo tasksel install lamp-server
Details:
https://help.ubuntu.com/community/ApacheMySQLPHP
[#4] tranzbit at yahoo dot com [2009-05-02 13:59:32]
On Ubuntu:
sudo apt-get install apache2 php5 mysql-client-5.0 mysql-server-5.0 phpmyadmin libapache2-mod-php5 libapache2-mod-auth-mysql php5-mysql
then restart the computer/start mysql manually
From:
http://ubuntuforums.org/showthread.php?t=186492
[#5] John Fisher [2007-02-08 16:53:55]
With Apache2 and Php4 under Debian Sarge there is an extra configuration file : /etc/apache2/sites-available/default
This file is not clearly documented, at least not for noobs, in Apache docs.
It overrides the conf file in the way you expect the /etc/apache2/conf.d/apache2-doc to do according to the README.
Add ExecCGI to it to get rid of "Options ExecCGI is off in this directory" errors.