doufei2662 2016-07-06 01:02
浏览 75

Linux:为Monkey Server设置PHP FastCGI

I'm trying to get PHP installed on my Linux device which already has Monkey Server installed, I do not have Apache installed. I want to be able to use FastCGI. I've downloaded and installed PHP7 according to these and these instructions and made sure the files are setup correctly; for the second link I did not install all of the packages listed at the beginning but most are already installed. The problem I am having is when I execute /etc/init.d/php-fpm start I get a list of errors which are generated from the script trying to run /sbin/php-fpm, the errors are as follows:

  1. Starting php-fpm
  2. /sbin/php-fpm: line 1: [Unit]: command not found
  3. /sbin/php-fpm: line 2: PHP: command not found
  4. /sbin/php-fpm: line 3: network.target: command not found
  5. /sbin/php-fpm: line 5: [Service]: command not found
  6. /sbin/php-fpm: line 8: --nodaemonize: command not found
  7. /sbin/php-fpm: line 9: -USR2: command not found
  8. /sbin/php-fpm: line 11: [Install]:
  9. command not found ................................... failed

The /sbin/php-fpm file is as follows:

[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

Lastly, I am running on a Yocto build of Linux so I do not have the luxury of sudo apt-get install <package>. The second hyperlink from above I couldn't complete the instructions involving the commands insserv and systemctl because those two commands are not present. Any help is appreciated, I just want FastCGI on a lightweight server for embedded Linux. If there are better options I am open to them but Apache is too big.

Edit:

I believe now my issues may be because I do not have systemd on my Linux distrubution which is why it is not handling items like [Unit]. Could someone please comment on this? I'm not familiar with systemd.

  • 写回答

1条回答 默认 最新

  • dougou2937 2016-07-12 09:56
    关注

    Default Yocto build does not use systemd as init. For a lightweight server, I did recommend the lighttpd server and it has FastCGI support. Using Yocto you should build php and lighttpd and then transfer the php-cgi and lighttpd-module-fastcgi ipk's generated to the module. php and lighttpd can be included in the image by having

    IMAGE_INSTALL_append = " php lighttpd"
    

    in your local.conf file. The links that you refer to in your post are useless for Yocto.

    评论

报告相同问题?

悬赏问题

  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥30 自适应 LMS 算法实现 FIR 最佳维纳滤波器matlab方案
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥15 Python3.5 相关代码写作
  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动