DirectAdmin把php从CLI调整为suPhp(php-cgi)

公司的机器上突然apache的cpu一直跑高,但是php是跑在php-cli模式下,需要调整为suphp(php-cgi)
默认cli是让php跑在apache上,调整php跑在用户上代替原本的apache,不调整的话看不到具体是哪个用户出问题

以下为directadmin重新编译的方法

  1. cd /usr/local/directadmin
  2. mv custombuild custombuild.old
  3. wget http://files.directadmin.com/services/custombuild/1.1/cu
  4. stombuild.tar.gz
  5. tar xvzf custombuild.tar.gz
  6. cd custombuild
  7. ./build suphp
  8. ./build all d #这个过程比较久
  9. ./build rewrite_confs
  10.  
  11. *************************************
  12. *                                   *
  13. *   All parts have been installed   *
  14. *                                   *
  15. *************************************
  16.  
  17. Type: /sbin/service httpd restart
  18.  
  19.  
  20. 更改配置文件 /usr/local/directadmin/custombuild/options.conf
  21. php5_cli=yes
  22. php5_cgi=no
  23. 改成
  24. php5_cli=no
  25. php5_cgi=yes
  26.  
  27. 更改配置文件 /usr/local/suphp/etc/suphp.conf
  28. 把日志的level改为info
  29. ;Loglevel
  30. ;loglevel=warn
  31. loglevel=error
  32.  
  33.  
  34. 然后重启apache
  35. 测试phpinfo页面下
  36. Server API     CGI/FastCGI 
  37. 就是成功了。
  38.  
  39. 这样在top里就能找出哪个虚拟主机用户跑高apachecpu或内存了!
  40.  
  41.   PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIMECOMMAND                                                         
  42. 30855 xxx    17   0 25236  10m 4464 S 52.5  0.3   0:00.31 /usr/local/php5/bin/php-cgi
  43.  
  44. suPhp日志 /var/log/suphp.log
  45.  
  46. Note: 如果发生Internal Server Error (http500) 大多数为文件宿主不正确
  47. 则继续运行
  48. ./build roundcube
  49. ./build squirrelmail
  50. ./build phpmyadmin

DirectAdmin_如何安装suphp

1 1