【问题标题】:Service php-fpm does not support chkconfig服务 php-fpm 不支持 chkconfig
【发布时间】:2021-03-27 06:19:16
【问题描述】:

一切正常。

只是当我 chkconfig --add php-fpm

它给我一个错误 服务 php-fpm 不支持 chkconfig

php-5.2.13 php-5.2.13-fpm-0.5.13.diff.gz

以下是我使用的配置 ./configure --enable-fastcgi --enable-fpm --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --target=x86_64-redhat-linux-gnu --program- prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir= /usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr /share/info --cache-file=../config.cache --with-libdir=lib64 --with-config-file-path=/etc --with-config-file-scan-dir=/etc/ php.d --disable-debug --with-pic --disable-rpath --with-pear --with-bz2 --with-curl --with-exec-dir=/usr/bin --with-freetype -dir=/usr --with-png-dir=/usr --enable-gd-native-ttf --without-gdbm --with-gettext --with-gmp --with-iconv --with-jpeg- dir=/usr --with-openssl --with-png --with-expat-dir=/usr --with-pcre-regex=/usr --with-zlib --with-layout=GNU --enable- exif --enable-ftp --enable-magic-quotes --enable-sockets --enable-sysvsem --enable-sysvshm - -enable-sysvmsg --enable-track-vars --enable-trans-sid --enable-yp --enable-wddx --with-kerberos --enable-ucd-snmp-hack --with-unixODBC=shared, /usr --enable-memory-limit --enable-shmop --enable-calendar --enable-dbx --enable-dio --with-mime-magic=/usr/share/file/magic.mime --without -sqlite --with-libxml-dir=/usr --with-xml --with-system-tzdata --without-mysql --without-gd --without-odbc --disable-dom --disable-dba - -without-unixODBC --disable-pdo --disable-xmlreader --disable-xmlwriter

【问题讨论】:

    标签: php http nginx fastcgi


    【解决方案1】:

    /etc/init.d 中是否有 php-fpm 脚本?这就是 chkconfig 的作用。它在脚本中查找注释:

     # chkconfig: 345 26 74
    

    确定应该配置哪些运行级别。如果没有 php-fpm init 脚本,或者该脚本不包含该 chkconfig 注释,则 chkconfig 没有任何作用。

    【讨论】:

      【解决方案2】:

      在 PHP 5.3.x 中,源发行版中已经有一个文件 php-5.3.3/sapi/fpm/init.d.php-fpm,必须将其移动到 /etc/rc.d/init.d 文件夹。通过 chmod +x 使其可执行,您就完成了,现在可以对其进行 chkconfig 了。

      【讨论】:

        【解决方案3】:
        1. vi /etc/init.d/php-fpm

          在顶部添加这些行(根据需要修改路径):

          # chkconfig: - 85 15
          # processname: php-cgi
          # config:      /usr/local/php-fpm/etc/php-fpm.conf
          # config:      /etc/sysconfig/php-fpm
          # pidfile:     /usr/local/php-fpm/logs/php-fpm.pid
          
        2. vi /etc/sysconfig/php-fpm

          粘贴:

          PHP-FPM_CONF_FILE=/usr/local/php-fpm/etc/php-fpm.conf
          

        【讨论】:

          【解决方案4】:

          脚本必须有 2 行:

          # chkconfig: <levels> <start> <stop>
          

          例如:

          # chkconfig: 345 99 01
          
          345 - levels to configure
          99 - startup order
          01 - stop order
          After you add the above headers you can run chkconfig --add <service>.
          

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 2013-01-28
            • 1970-01-01
            • 2013-08-17
            • 1970-01-01
            • 2014-01-18
            • 1970-01-01
            • 2017-09-12
            • 2016-11-14
            相关资源
            最近更新 更多