在已安装的apache2服务器上安装php

时间:2014-04-16 06:42:13

标签: php linux apache2 raspberry-pi raspbian

在设置svn服务器时,我已经在我的raspberry pi(raspbian OS)上安装了apache2。现在我想添加一个运行php和mysql的Web服务器。如果不弄乱我的apache2上的任何现有配置,最好的方法是什么?

在命令行执行是否可以,或者此程序包是否覆盖现有的apache2安装:

$ sudo apt-get install php5-common libapache2-mod-php5 php5-cli

有问题的软件包是' libapache2-mod-php5'。

干杯

3 个答案:

答案 0 :(得分:0)

首先,我从未使用过Raspberry Pi,但会尝试给出答案。因为你只是为apache安装一个模块而你正在使用prefork编译版本(如果我没弄错的话,它仍然是默认的)。我认为配置不会有任何改变,也许只会添加一些规则来处理PHP文件。

要检查您是否正在使用Prefork,请在命令行上运行(适用于常规Linux发行版):

apache2 -l

如果你能在列表中找到prefork.c,我想你是安全的。

请注意,这是基于默认unix发行版的个人经验!我从未使用过Raspberry Pi。

答案 1 :(得分:0)

如果运行以下命令,将解析所有依赖项(它还将安装libapache2-mod-php5)。您可以阅读Raspberry Pi中的LAMP安装,在第8章" A LAMP of Your Own",书中#34;了解Raspberry Pi with Linux",Peter Membrey和David Hows,Apress ,2012。

$ sudo apt-get install mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
heirloom-mailx libaio1 libdbd-mysql-perl libdbi-perl libhtml-template-perl
libmysqlclient16 libnet-daemon-perl libplrpc-perl mysql-client-5.5
mysql-common mysql-server-5.5 mysql-server-core-5.5
Suggested packages:
libipc-sharedcache-perl libterm-readkey-perl tinyca
The following NEW packages will be installed:
heirloom-mailx libaio1 libdbd-mysql-perl libdbi-perl libhtml-template-perl
libmysqlclient16 libnet-daemon-perl libplrpc-perl mysql-client-5.5
mysql-common mysql-server mysql-server-5.5 mysql-server-core-5.5
0 upgraded, 13 newly installed, 0 to remove and 84 not upgraded.
Need to get 9,770 kB of archives.
After this operation, 91.5 MB of additional disk space will be used.
Do you want to continue [Y/n]?
...
$ sudo apt-get install php5
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
apache2-mpm-prefork libapache2-mod-php5 libonig2 libqdbm14 php5-cli php5-common
Suggested packages:
php-pear
The following packages will be REMOVED:
apache2-mpm-worker
The following NEW packages will be installed:
apache2-mpm-prefork libapache2-mod-php5 libonig2 libqdbm14 php5 php5-cli php5-common
0 upgraded, 7 newly installed, 1 to remove and 84 not upgraded.
Need to get 5,707 kB of archives.
After this operation, 16.3 MB of additional disk space will be used.
Do you want to continue [Y/n]?

答案 2 :(得分:0)

我认为如果你安装php模块用于apache和php 5上面的apt-get命令将启用php支持apache但是这仍然取决于你正在使用的linux版本,因为似乎有一些bug关于ubuntu(v10.04)中apache集成的php.ini文件,但是ubuntu(v12.04)似乎很好