search

Home  >  Q&A  >  body text

How to install php-fpm (nginx) in centos7

need

Install nginx PHP on centos7 system, no need to install Apache.
But when I use yum install php php-fpm, it always pops up that Apache needs to be installed.

yum install php php-fpm

Prompt content:

Dependencies Resolved

================================================================================
 Package           Arch         Version                     Repository     Size
================================================================================
Installing:
 php               x86_64       5.4.16-23.el7_0.3           updates       1.3 M
 php-fpm           x86_64       5.4.16-23.el7_0.3           updates       1.4 M
Installing for dependencies:
 apr               x86_64       1.4.8-3.el7                 base          103 k
 apr-util          x86_64       1.5.2-6.el7                 base           92 k
 httpd             x86_64       2.4.6-18.el7.centos         updates       2.7 M
 httpd-tools       x86_64       2.4.6-18.el7.centos         updates        77 k
 libzip            x86_64       0.10.1-8.el7                base           48 k
 mailcap           noarch       2.1.41-2.el7                base           31 k
 php-cli           x86_64       5.4.16-23.el7_0.3           updates       2.7 M
 php-common        x86_64       5.4.16-23.el7_0.3           updates       561 k

Transaction Summary
================================================================================
Install  2 Packages (+8 Dependent packages)

Total download size: 9.1 M
Installed size: 32 M
Is this ok [y/d/N]: y
Downloading packages:
(1/10): apr-1.4.8-3.el7.x86_64.rpm                         | 103 kB   00:00
(2/10): libzip-0.10.1-8.el7.x86_64.rpm                     |  48 kB   00:00
(3/10): apr-util-1.5.2-6.el7.x86_64.rpm                    |  92 kB   00:00
(4/10): httpd-tools-2.4.6-18.el7.centos.x86_64.rpm         |  77 kB   00:00
(5/10): mailcap-2.1.41-2.el7.noarch.rpm                    |  31 kB   00:00
(6/10): httpd-2.4.6-18.el7.centos.x86_64.rpm               | 2.7 MB   00:00
(7/10): php-5.4.16-23.el7_0.3.x86_64.rpm                   | 1.3 MB   00:00
(8/10): php-cli-5.4.16-23.el7_0.3.x86_64.rpm               | 2.7 MB   00:00
(9/10): php-common-5.4.16-23.el7_0.3.x86_64.rpm            | 561 kB   00:00
(10/10): php-fpm-5.4.16-23.el7_0.3.x86_64.rpm              | 1.4 MB   00:00
--------------------------------------------------------------------------------
Total                                               16 MB/s | 9.1 MB  00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : apr-1.4.8-3.el7.x86_64                                      1/10
  Installing : apr-util-1.5.2-6.el7.x86_64                                 2/10
  Installing : httpd-tools-2.4.6-18.el7.centos.x86_64                      3/10
  Installing : libzip-0.10.1-8.el7.x86_64                                  4/10
  Installing : php-common-5.4.16-23.el7_0.3.x86_64                         5/10
  Installing : php-cli-5.4.16-23.el7_0.3.x86_64                            6/10
  Installing : mailcap-2.1.41-2.el7.noarch                                 7/10
  Installing : httpd-2.4.6-18.el7.centos.x86_64                            8/10
  Installing : php-5.4.16-23.el7_0.3.x86_64                                9/10
  Installing : php-fpm-5.4.16-23.el7_0.3.x86_64                           10/10
  Verifying  : php-common-5.4.16-23.el7_0.3.x86_64                         1/10
  Verifying  : apr-1.4.8-3.el7.x86_64                                      2/10
  Verifying  : mailcap-2.1.41-2.el7.noarch                                 3/10
  Verifying  : php-5.4.16-23.el7_0.3.x86_64                                4/10
  Verifying  : apr-util-1.5.2-6.el7.x86_64                                 5/10
  Verifying  : libzip-0.10.1-8.el7.x86_64                                  6/10
  Verifying  : php-cli-5.4.16-23.el7_0.3.x86_64                            7/10
  Verifying  : httpd-tools-2.4.6-18.el7.centos.x86_64                      8/10
  Verifying  : php-fpm-5.4.16-23.el7_0.3.x86_64                            9/10
  Verifying  : httpd-2.4.6-18.el7.centos.x86_64                           10/10

Installed:
  php.x86_64 0:5.4.16-23.el7_0.3       php-fpm.x86_64 0:5.4.16-23.el7_0.3

Dependency Installed:
  apr.x86_64 0:1.4.8-3.el7            apr-util.x86_64 0:1.5.2-6.el7
  httpd.x86_64 0:2.4.6-18.el7.centos  httpd-tools.x86_64 0:2.4.6-18.el7.centos
  libzip.x86_64 0:0.10.1-8.el7        mailcap.noarch 0:2.1.41-2.el7
  php-cli.x86_64 0:5.4.16-23.el7_0.3  php-common.x86_64 0:5.4.16-23.el7_0.3

Complete!

And it is not the latest version of PHP 5.6.

doubt

1)是不是安装了PHP-FPM就无需安装PHP?
2)如何才可以只安装PHP-FPM 而不安装APACHE
3)运行最简nginx+php,是否需要像Apache那样安装apr apr-util这样的组件?
给我你的怀抱给我你的怀抱2750 days ago766

reply all(5)I'll reply

  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-16 17:27:47

    php-fpm is just an interpreter for php. If you don’t install php and just follow php-fpm, it won’t work.
    Regarding the relationship between php and php-fpm, it is recommended that you install php from the source code, yum
    The installation method cannot well reflect the relationship between the two. You can also refer to this article

    Mud: php5.6 source code installation and php-fpm configuration integrated with nginx http://www.ilanni.com/?p=7609

    reply
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-16 17:27:47

    You can try the source code installation method. After yum installation, many installation locations are scattered and cannot be found

    reply
    0
  • 我想大声告诉你

    我想大声告诉你2017-05-16 17:27:47

    Through the source code, you can use the one-click installation package for quick deployment. If you want to learn, you can open the shell and take a look. The entire compilation and deployment process will be clear

    reply
    0
  • 淡淡烟草味

    淡淡烟草味2017-05-16 17:27:47

    Please refer to this article:
    https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-centos-7
    Under the official CentOS 7 source, yum installs PHP 5.4.16 version, because RH Enterprise Linux pursues software stability rather than new versions.
    If you want to yum install the latest versions of Nginx and PHP, you can use third-party sources: EPEL and Remi sources.
    My suggestion is to only enable the EPEL source, so that what is installed is PHP 5.4+Nginx 1.6.2
    Three parts done:
    yum -y install epel-release
    yum -y install nginx
    yum -y install php php-fpm
    If you want to pursue a new software version (test environment instead of production environment):
    You can choose the Fedora 21 Server release version, so that the software installed by yum will basically be the latest version.

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-05-16 17:27:47

    Installing PHP directly requires Apache. If you use nginx, you only need to install php-fpm and php-cli
    yum install php-cli

    reply
    0
  • Cancelreply