Home  >  Article  >  Backend Development  >  Solution to garbled php-fpm executable file

Solution to garbled php-fpm executable file

WBOY
WBOYOriginal
2016-07-25 08:53:291323browse
  1. cp/usr/local/php/etc/php-fpm.conf.default->/usr/local/php/etc/php-fpm.conf
复制代码

vi/usr/local/php/etc/php-fpm.conf

制作fpm启动服务 vi/etc/init.d/php-fpm,保存

  1. #!/bin/bash

  2. #php-fpmStartupscriptforphp-fpm,aFastCGIimplementation
  3. #thisscriptwascreatedbytonyat2010.07.21,basedonjackbillow'snginxscript.
  4. #itisv.0.0.1version.
  5. #ifyoufindanyerrorsonthisscripts,pleasecontacttony.
  6. #bysendingmailtotonytzhouatgmaildotcom.
  7. #
  8. #chkconfig:-8515
  9. #description:php-fpmisanalternativeFastCGIimplementation,withsomeadditionalfeaturesusefulforsitesofanysize,especiallybusiersites.
  10. #
  11. #processname:phpfpm
  12. #pidfile:/usr/local/php/var/run/phpfpm.pid
  13. #config:/usr/local/php/etc/phpfpm.conf
  14. phpfpm=/usr/local/php/sbin/php-fpm
  15. config=/usr/local/php/lib/php.ini
  16. pid=/usr/local/php/var/run/php-fpm.pid
  17. RETVAL=0
  18. prog="phpfpm"
  19. #Sourcefunctionlibrary.
  20. ./etc/rc.d/init.d/functions
  21. #Sourcenetworkingconfiguration.
  22. ./etc/sysconfig/network
  23. #Checkthatnetworkingisup.
  24. [${NETWORKING}="no"]&&exit0
  25. [-x$phpfpm]||exit0
  26. #Startphpfpmdaemonsfunctions.
  27. start(){
  28. if[-e$pid];then
  29. echo"phpfpmisalreadyrunning...."
  30. exit1
  31. fi
  32. echo-n$"Starting$prog:"
  33. daemon$phpfpm-c${config}
  34. RETVAL=$?
  35. echo
  36. [$RETVAL=0]&&touch/var/lock/subsys/phpfpm
  37. return$RETVAL
  38. }
  39. #Stopphpfpmdaemonsfunctions.
  40. stop(){
  41. echo-n$"Stopping$prog:"
  42. killproc$phpfpm
  43. RETVAL=$?
  44. echo
  45. [$RETVAL=0]&&rm-f/var/lock/subsys/phpfpm/var/run/phpfpm.pid
  46. }
  47. #reloadphpfpmservicefunctions.
  48. reload(){
  49. echo-n$"Reloading$prog:"
  50. #kill-HUP`cat${pid}`
  51. killproc$phpfpm-HUP
  52. RETVAL=$?
  53. echo
  54. }
  55. #Seehowwewerecalled.
  56. case"$1"in
  57. start)
  58. start
  59. ;;
  60. stop)
  61. stop
  62. ;;
  63. reload)
  64. reload
  65. ;;
  66. restart)
  67. stop
  68. start
  69. ;;
  70. status)
  71. status $prog
  72. RETVAL=$?

  73. *)

  74. echo $"Usage:$prog{start|stop|restart|reload|status|help}"
  75. exit 1
  76. esac
  77. exit $RETVAL

复制代码

后续操作步骤: 添加执行权限 chmod+x/etc/rc.d/init.d/php-fpm# 设置开机启动 chkconfigphp-fpmon# 启动/etc/init.d/php-fpmstart 停止/etc/init.d/php-fpmstop 重启/etc/init.d/php-fpmrestart



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn