Guest User

Untitled

a guest
Jun 18th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. ## ABSOLUTE path to the PHP binary
  4. PHPFCGI="/usr/local/bin/php"
  5.  
  6. ## tcp-port to bind on
  7. FCGIPORT="1234"
  8.  
  9. ## IP to bind on
  10. FCGIADDR="127.0.0.1"
  11.  
  12. ## number of PHP children to spawn
  13. PHP_FCGI_CHILDREN=5
  14.  
  15. ## number of request before php-process will be restarted
  16. PHP_FCGI_MAX_REQUESTS=1000
  17.  
  18. # allowed environment variables sperated by spaces
  19. ALLOWED_ENV="ORACLE_HOME PATH USER"
  20.  
  21. ## if this script is run as root switch to the following user
  22. USERID=www-data
  23.  
  24. ################## no config below this line
  25. if test x$PHP_FCGI_CHILDREN = x; then
  26. PHP_FCGI_CHILDREN=5
  27. fi
  28.  
  29. ALLOWED_ENV="$ALLOWED_ENV PHP_FCGI_CHILDREN"
  30. ALLOWED_ENV="$ALLOWED_ENV PHP_FCGI_MAX_REQUESTS"
  31. ALLOWED_ENV="$ALLOWED_ENV FCGI_WEB_SERVER_ADDRS"
  32.  
  33. if test x$UID = x0; then
  34. EX="/bin/su -m -c \"$PHPFCGI -q -b $FCGIADDR:$FCGIPORT\" $USERID"
  35. else
  36. EX="$PHPFCGI -b $FCGIADDR:$FCGIPORT"
  37. fi
  38.  
  39. echo $EX
  40.  
  41. # copy the allowed environment variables
  42. E=
  43.  
  44. for i in $ALLOWED_ENV; do
  45. E="$E $i=${!i}"
  46. done
  47.  
  48. # clean environment and set up a new one
  49. nohup env - $E sh -c "$EX" &> /dev/null &
Add Comment
Please, Sign In to add comment