php.init 568 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/sh
  2. #PKG php
  3. #INIT 80
  4. . /etc/rc.conf
  5. export PHP_FCGI_CHILDREN='2'
  6. case $1 in
  7. autostop) ;;
  8. autostart)
  9. test x"${php:-NO}" = x"NO" && exit 0
  10. test x"$php" = x"DAEMON" && test -x /bin/mksh && exec mksh -T- $0 start
  11. exec sh $0 start
  12. ;;
  13. start)
  14. if [ -x /usr/bin/php-cgi ];then
  15. su -m www -c "/usr/bin/php-cgi -b /var/run/php5.sock"
  16. else
  17. /usr/bin/php-fpm -D
  18. fi
  19. ;;
  20. stop)
  21. if [ -x /usr/bin/php-cgi ];then
  22. pkill php-cgi
  23. else
  24. pkill php-fpm
  25. fi
  26. ;;
  27. restart)
  28. sh $0 stop
  29. sh $0 start
  30. ;;
  31. *)
  32. echo "Usage: $0 {start | stop | restart}"
  33. exit 1
  34. ;;
  35. esac
  36. exit $?