apt install 一行写两个软件,与一行写一个软件,有区别。

2022-12-17 17:52:29 +08:00
 documentzhangx66

Debian 11 ,已经更新到最新

写法 1:apt install -y php php-fpm ...... The following additional packages will be installed: libsodium23 php-common php7.4 php7.4-cli php7.4-common php7.4-fpm php7.4-json php7.4-opcache php7.4-readline psmisc Suggested packages: php-pear The following NEW packages will be installed: libsodium23 php php-common php-fpm php7.4 php7.4-cli php7.4-common php7.4-fpm php7.4-json php7.4-opcache php7.4-readline psmisc 0 upgraded, 12 newly installed, 0 to remove and 0 not upgraded.

对比写法 2:apt install -y php ...... The following additional packages will be installed: apache2 apache2-bin apache2-data apache2-utils libapache2-mod-php7.4 libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.3-0 libsodium23 php-common php7.4 php7.4-cli php7.4-common php7.4-json php7.4-opcache php7.4-readline psmisc ssl-cert Suggested packages: apache2-doc apache2-suexec-pristine | apache2-suexec-custom php-pear The following NEW packages will be installed: apache2 apache2-bin apache2-data apache2-utils libapache2-mod-php7.4 libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.3-0 libsodium23 php php-common php7.4 php7.4-cli php7.4-common php7.4-json php7.4-opcache php7.4-readline psmisc ssl-cert 0 upgraded, 21 newly installed, 0 to remove and 0 not upgraded.

我觉得奇怪的是:

写法 1 apt install -y php php-fpm ,不会安装 apache2.

而写法 2 apt install -y php 则会安装 apache2.

难道

apt install -y php php-fpm

不等于

apt install -y php + apt install -y php-fpm

3095 次点击
所在节点    Linux
7 条回复
eason1874
2022-12-17 17:56:30 +08:00
确实不一样,我也遇到过,同样一行,有时候后面的不会安装,有时候又会安装。我不知道打断的逻辑是什么,很少用,没细究
yaoyao1128
2022-12-17 17:56:38 +08:00
https://packages.ubuntu.com/bionic-updates/php7.2
你不指定默认用 libapache2-mod-php7.2
你置顶 fpm 了就变成 fpm 了
这和分不分开写没啥关系
LIPiston
2022-12-17 17:57:31 +08:00
apt 不应该得换行输入吗(虽然这是我的习惯
adoal
2022-12-17 18:16:32 +08:00
php-7.4 依赖[libapache2-mod-php7.4, php7.4-fpm, php7.4-cgi]之一,如果你在装 php7.4 的时候没同时指定这三个包之一,并且这三个包之一也没安装过,那 apt 会挑选一个“最合适的”来安装,这个最合适,默认是 libapache2-mod-php7.4 。如果你同时指定 php7.4-fpm ,条件满足了,自然不会再给你安装 libapache2-mod-php7.4 。
liaohongxing
2022-12-17 19:33:49 +08:00
php 两种组合 nginx+php-fpm , apache+mod-php 。默认给你装 apache 版本

只装 php-fpm 就是 nginx 组合
debuggerx
2022-12-17 20:56:36 +08:00
如果我没搞错
apt install -y php php-fpm
其实和
apt install -y php-fpm
效果一样

所以有时很讨厌某些教程和文档里啪啪啪写一堆依赖的,完全没有必要
codehz
2022-12-18 19:57:00 +08:00
@debuggerx 不一样,后者你卸载 fpm 之后再 autoremove 就会把 php 干掉(
当然你要觉得肯定不会卸载那当然没区别

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/903166

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX