【问题标题】:Linux: Setup PHP FastCGI for Monkey ServerLinux:为 Monkey Server 设置 PHP FastCGI
【发布时间】:2016-11-07 23:22:29
【问题描述】:

我正在尝试在我已经安装了 Monkey Server 的 Linux 设备上安装 PHP,但我没有安装 Apache。我希望能够使用 FastCGI。我已经按照thesethese 的说明下载并安装了PHP7,并确保文件设置正确;对于第二个链接,我没有安装开头列出的所有软件包,但大多数已经安装。我遇到的问题是,当我执行 /etc/init.d/php-fpm start 时,我得到了一个错误列表,这些错误是由试图运行的脚本生成的 /sbin/php-fpm,报错如下:

  1. 启动 php-fpm
  2. /sbin/php-fpm: line 1: [Unit]: command not found
  3. /sbin/php-fpm:第 2 行:PHP:找不到命令
  4. /sbin/php-fpm:第 3 行:network.target:找不到命令
  5. /sbin/php-fpm: line 5: [Service]: command not found
  6. /sbin/php-fpm:第 8 行:--nodaemonize:找不到命令
  7. /sbin/php-fpm:第 9 行:-USR2:找不到命令
  8. /sbin/php-fpm:第 11 行:[安装]:
  9. 找不到命令.......................失败

/sbin/php-fpm文件如下:

[Unit]
Description=The PHP FastCGI Process Manager
After=syslog.target network.target

[Service]
Type=@php_fpm_systemd@
PIDFile=@localstatedir@/run/php-fpm.pid
ExecStart=@sbindir@/php-fpm --nodaemonize --fpm-config @sysconfdir@/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID

[Install]
WantedBy=multi-user.target

最后,我在 Linux 的 Yocto 版本上运行,所以我没有 sudo apt-get install <package> 的奢侈。上面的第二个超链接我无法完成涉及命令insservsystemctl 的说明,因为这两个命令不存在。 感谢任何帮助,我只希望在嵌入式 Linux 的轻量级服务器上使用 FastCGI。如果有更好的选择,我愿意接受,但 Apache 太大了。

编辑:

我相信现在我的问题可能是因为我的 Linux 发行版上没有 systemd,这就是它不处理像 [Unit] 这样的项目的原因。有人可以对此发表评论吗?我不熟悉systemd

【问题讨论】:

    标签: php linux embedded webserver fastcgi


    【解决方案1】:

    默认 Yocto 构建不使用 systemd 作为 init。对于轻量级服务器,我确实推荐了 lighttpd 服务器,它支持 FastCGI。使用 Yocto 您应该构建 php 和 lighttpd,然后将生成的 php-cgi 和 lighttpd-module-fastcgi ipk 传输到模块。 php 和 lighttpd 可以包含在图像中

    IMAGE_INSTALL_append = " php lighttpd"
    

    在您的 local.conf 文件中。您在帖子中引用的链接对 Yocto 毫无用处。

    【讨论】:

    • 我已经通过 FastCGI 获得了带有 Lighttpd 的 PHP...它需要的不仅仅是您列出的包,例如 php-cgilighttpd-module-fastcgi。更不用说让两者一起工作的大量配置了。这就是我想使用 Monkey 的原因,因为它更容易设置(至少在 Ubuntu 中)。
    • 是的,我提到您必须将 php-cgi 和 lighttpd-module-fastcgi ipk 转移到模块中。我已经使用它们并且不需要做很多配置。但我不是专家。
    • 是的,我看到了……第一次错过了。但我有兴趣让 Monkey Server 运行而不是 Lighttpd(如标题所述)。我很感激你的努力,但我很快就会删除这个问题,并在我有时间的时候重新审视它。现在是systemd 问题。
    猜你喜欢
    • 2014-03-09
    • 1970-01-01
    • 2016-11-25
    • 2011-05-19
    • 1970-01-01
    • 2021-10-25
    • 2018-10-15
    • 1970-01-01
    • 2012-07-28
    相关资源
    最近更新 更多