天堂1111 发表于 2018-11-8 09:47:34

安装nginx0.7x+php5.2.8(Fastcgi)小结

  本文是在http://blog.s135.com/post/366.htm基础上安装的,在此记录些有用的东东...我会在这个平台下,做一些个人感觉有意义的
  学习,并将其记录下来,以供路人学习...
  (1)软件说明
  PDO_MYSQL-1.0.2.tgz
  什么是PDO?
  PHP Data Object(PDO)是PHP一个扩展. 它定义了一个简便持久访问数据库的方法. 我们可以方便地使用一组定义好的函数来访问每个实现了PDO的数据库.
  PDO提供了一组访问数据库的抽象方法, 也就是说, 不论访问何种类型的数据库, 我们只用同样名称的方法访问就可以了, 这样就大大简便了数据库操作。
  eaccelerator-0.9.5.3.tar.bz2
  eaccelerator是一个自由开放源码php加速器,优化和动态内容缓存,提高了性能php脚本的缓存性能,使得PHP脚本在编译的状态下,对服务器的开销几
  乎完全消除。 它还有对脚本起优化作用,以加快其执行效率。使您的PHP程序代码执效率能提高1-10倍
  pcre-7.8.tar.gz
  The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5.
  PCRE has its own native API, as well as a set of wrapper functions that correspond to the POSIX regular expression API.
  The PCRE library is free, even for building commercial software.
  mhash-0.9.9.tar.gz
  简单的说就是一个加密函数(与mcrypt-2.6.7.tar.gz,libmcrypt-2.5.8.tar.gz相仿)
  memcache-2.2.4.tgz
  一个分布式内存缓存系统
  libiconv-1.12.tar.gz
  字元集编码转化
  (2)mysql启动报错
  # /bin/sh /usr/local/webserver/mysql/bin/mysqld_safe --defaults-file=/usr/local/webserver/mysql/my.cnf &
   21524
  # 090105 18:19:50 mysqld_safe Logging to '/usr/local/webserver/mysql/data/study.centos.com.err'.
  090105 18:19:50 mysqld_safe Starting mysqld daemon with databases from /usr/local/webserver/mysql/data
  有提示:090105 18:19:50 mysqld_safe Logging to '/usr/local/webserver/mysql/data/study.centos.com.err'
  那就看日志
  # more study.centos.com.err
  090105 18:19:50 mysqld_safe Starting mysqld daemon with databases from /usr/local/webserver/mysql/data
  InnoDB: The first specified data file ./ibdata1 did not exist:
  InnoDB: a new database to be created!

  090105 18:19:50InnoDB: Setting file ./ibdata1>  InnoDB: Database physically writes the file full: wait...
  090105 18:19:50InnoDB: Log file ./ib_logfile0 did not exist: new to be created

  InnoDB: Setting log file ./ib_logfile0>  InnoDB: Database physically writes the file full: wait...
  090105 18:19:50InnoDB: Log file ./ib_logfile1 did not exist: new to be created

  InnoDB: Setting log file ./ib_logfile1>  InnoDB: Database physically writes the file full: wait...
  InnoDB: Doublewrite buffer not found: creating new
  InnoDB: Doublewrite buffer created
  InnoDB: Creating foreign key constraint system tables
  InnoDB: Foreign key constraint system tables created
  090105 18:19:50InnoDB: Started; log sequence number 0 0
  090105 18:19:50 /usr/local/webserver/mysql/libexec/mysqld: unknown option '--skip-federated'
  090105 18:19:50 Aborting
  090105 18:19:50InnoDB: Starting shutdown...
  090105 18:19:52InnoDB: Shutdown completed; log sequence number 0 46409
  090105 18:19:52 /usr/local/webserver/mysql/libexec/mysqld: Shutdown complete
  090105 18:19:52 mysqld_safe mysqld from pid file /usr/local/webserver/mysql/data/study.centos.com.pid ended
  又有提示:090105 18:19:50 /usr/local/webserver/mysql/libexec/mysqld: unknown option '--skip-federated'
  修改:vi my.cnf,将其这个选项注解掉
  #--skip-federated
  重新启动下ok。
  [为什么,要这样做?]
  答:
  --skip-federated 也是mysql的一种存储引擎。在mysql 5.0.3中就被支持,在mysql 5.0.64默认编译是不开启的,在mysql5.1.29中你编译时需用--with-plugins指定,
  你的编译参数中没有指定该存储引擎,而在 mysql的随带的配置文件中,该项是存在的,如果不需要,在配置文件中注释就好了。
  # ./configure --help|grep plugins
  --with-plugins=PLUGIN[[[,PLUGIN..]]]
  list of plugins.
  Available plugins are: partition daemon_example
  Otherwise, for plugins which are not selected for
  Description of plugins:
  哈哈,果真是要指定的,看来张宴兄,在编译时,没帮暂指定哟!如果大家需要这种存储引擎,就不妨试试用--with-plugins
  (3)
  /usr/local/webserver/php/bin/phpize执行这个干嘛?
  phpize 是属于 php-devel 中的东西,主要是设定 php 外挂模块的一些设定
  详细的可以到http://www.linuxsense.cn/phpize-summary-and-examples.html这看。
  (4)php-fpm干嘛的?
  使用 PHP 的朋友对于 FastCGI 进程的管理估计都很头疼,比如 Nginx 下的 FastCGI 就有不少人用的 Lighttpd 的 spawn-fcgi 来对进程进行管理。
  但这样存在不少缺点。php-fpm(php fastcgi process manager)
  如何确定 Worker 的数量。PHP-FPM 作者 Andrei Nigmatulin 在新闻组里提到的小技巧如下:
  1) 用 Linux top 命令观察 (这个方式比较土)
  2) 用 'netstat -np | grep 127.0.0.1:9000' 收集数据。
  设置php-fpm.conf 中的 max_children 的数值使 等待的数量变为最小。
  目前使用 PHP-FPM 还只是通过 Patch 方式
  (5)PHP-CGI进程达到148M
  我用top看了下php-cgi进程,竟然达到了148M,和张宴说的20M相差那么多,怎么回事呢?就想是不是与我加载的一些模块有关,便着手去试验了,
  修改php.ini,将其新加的模块注释掉,再看下,哈哈,和张宴说的一样了。原来是这么一回事,问题解决!
  (6)提供一个查看web连接数量的工具
  netstat -n | grep ':80'| awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S}'
  (7)文件描述
  文件描述符是一个简单的整数,用以标明每一个被进程所打开的文件和socket。第一个打开的文件是0,第二个是1,依此类推。Unix 操作系统通常给每个进程能打开的文件数量强加一个限制。更甚的是,unix 通常有一个系统级的限制。
  如果想了解更多,请关注我们的公众号
  公众号ID:opdevos
  扫码关注


页: [1]
查看完整版本: 安装nginx0.7x+php5.2.8(Fastcgi)小结