版本:ver 1.18      最后修改:2010-7-25 20:40     原创文章,转载请注明出处:http://blog.jiqila.com/


本系列文章已有最新版:FreeBSD上搭建nginx 0.8.x + PHP 5.3.x(FastCGI) + MySQL 5.1.x)(第三版)



  前言:在网上Linux环境下搭建nginx+php的文章已经比较多也比较完善了,而在FreeBSD环境下搭建的文章并不多,且都使用的是 ports方式安装。本文的目的就是形成一个比较完整的、可操作强的FreeBSD环境下以编译源码方式搭建nginx+php+mysql的手册。本文将尽量详细地描述每一个操作步骤,使初学者也能迅速搭建一个FEMP环境。

  Nginx简介:Nginx  ("engine x") 是一个高性能的 HTTP 和 反向代理 服务器,也是一个 IMAP/POP3/SMTP 代理服务器 。 Nginx 是由 Igor Sysoev 为俄罗斯访问量第二的Rambler.ru 站点开发的,它已经在该站点运行超过六年了。Igor 将源代码以类BSD许可证的形式发布。自Nginx 发布六年来,Nginx 已经因为它的稳定性、丰富的功能集、示例配置文件和低系统资源的消耗而闻名了。目前国内各大门户网站已经部署了Nginx,如新浪、网易、腾讯等;国内几个重要的视频分享网站也部署了Nginx,如六房间、酷6等。新近发现Nginx 技术在国内日趋火热,越来越多的网站开始部署Nginx。



FreeBSD系统分区的时候,根据自己的需要来做。以下的安装,我都是以我的分区为例。
引用
硬盘总大小:250GB
/ 20G
swap 8GB
/var 10GB
/usr 40GB
/data 112GB
/home 40GB




  FreeBSD不同于Linux,我们最小化安装FreeBSD后,系统中并没有wget(可能完全安装也没有,呵呵),因为我已经习惯了使用wget进行下载,所以为了可以在FreeBSD中使用wget,我们需要安装wget,方法如下:
引用
cd /usr/ports/ftp/wget
make install clean
#在出现的对话框中去掉IPV6前面的选择

  刚刚安装完后,wget并未能使用,需要执行下面的命令后方可生效。
引用
rehash





  〇、前期准备(适用于CD1安装或DVD最小化安装)和内核优化

  对于使用CD1安装FreeBSD的网友,我们需要安装以下支持。

引用
################ 安装pcre ##################
cd /usr/ports/devel/pcre
make install clean
rehash

################ 安装xml ##################
cd /usr/ports/textproc/libxml
make install clean

cd /usr/ports/textproc/libxml2
make install clean

################ 安装curl ##################
cd /usr/ports/ftp/curl
make install clean

################ 安装jpeg ##################
cd /usr/ports/graphics/jpeg
make install clean

################ 安装png ##################
cd /usr/ports/graphics/png
make install clean

################ 安装freetype ##################
cd /usr/ports/print/freetype
make install clean

cd /usr/ports/print/freetype2
make install clean

################ 安装autoconf ##################
cd /usr/ports/devel/autoconf262
make install clean


  为了避免nginx在大负载量下可能出现500 Internal Server Error,我们需要对内核参数进行一下设置,如下:

引用
vi /etc/sysctl.conf

  在文件末尾增加如下内容:
引用
kern.maxfiles=65535  #同时打开文件的最大数量


  完成以上的前期准备工作,就可以进行下面的操作了。



  一、首先,我们来安装nginx。

  1、下载与解压nginx
引用
wget http://sysoev.ru/nginx/nginx-0.7.67.tar.gz
tar zxvf nginx-0.7.67.tar.gz
cd nginx-0.7.67

  2、修改nginx原文件。如果不进行修改,nginx编译会以debug方式编译,编译后的文件有3兆之巨。经以下修改后,文件减小到500KB左右。
引用
cd auto/cc
vi gcc

  将文件最后的
引用
# debug
CFLAGS="$CFLAGS -g"

  修改为
引用
# debug
#CFLAGS="$CFLAGS -g"

  3、编译安装nginx。因为在安装FreeBSD的时候,已经内建了www用户和www用户组,因此不需要再自己建立了。这是与在Linux上安装的一个小小区别。
引用
cd ../../
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module
make
make install


  如果要开机后自动启动nginx,那么需要在/etc/rc.local中加入一行命令:
引用
/usr/local/nginx/sbin/nginx


  二、接下来,我们来安装MySQL,因为安装PHP需要用到MySQL支持,所以要先于PHP安装。
引用
wget http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.49.tar.gz/from/http://mysql.he.net/
tar zxvf mysql-5.1.49.tar.gz
cd mysql-5.1.49
./configure --prefix=/usr/local/mysql/ --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=innobase --with-mysqld-user=mysql --without-ndb-debug --without-debug --with-charset=utf8 --localstatedir=/data/mysql/data --with-collation=utf8_general_ci
make
make install


  如果你希望在这台服务器上运行MySQL数据库服务端,那么执行以下步骤。

  1、创建mysql 的用户及用户组(这点与Linux稍有不同)
引用
pw groupadd mysql
pw useradd mysql -g mysql -d /data/mysql -s /usr/sbin/nologin

  2、创建MySQL数据存放目录
引用
mkdir -p /data/mysql/data/
chown -R mysql:mysql /data/mysql/

  3、以mysql用户的身份建立数据表
引用
/usr/local/mysql/bin/mysql_install_db --basedir=/usr/local/mysql --datadir=/data/mysql/data --user=mysql

  4、创建配置文件
引用
cd /usr/local/mysql/share/mysql
cp my-large.cnf /etc/my.cnf
cp mysql.server /usr/local/mysql/mysqld
chmod 755 /usr/local/mysql/mysqld

  5、打开/etc/rc.local,如果不存在的话,就新建一个,输入以下内容:
引用
/usr/local/mysql/mysqld start

  6、创建一个可以远程登录的root账户,密码是123456,这样我们就可以使用mysql连接工具进行远程管理了。
引用
/usr/local/mysql/mysqld start
/usr/local/mysql/bin/mysql -u root -p -S /tmp/mysql.sock
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456';
quit



  三、编译安装PHP(FastCGI)

  1、编译安装PHP 5.2.14所需的支持库
引用
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.tar.gz
tar zxvf libiconv-1.13.tar.gz
cd libiconv-1.13/
./configure --prefix=/usr
make
make install
cd ..

引用
wget "http://downloads.sourceforge.net/mcrypt/libmcrypt-2.5.8.tar.gz?modtime=1171868460&big_mirror=0"
tar zxvf libmcrypt-2.5.8.tar.gz  
cd libmcrypt-2.5.8
./configure --prefix=/usr
make
make install
cd ..

引用
wget "http://downloads.sourceforge.net/mhash/mhash-0.9.9.9.tar.gz?modtime=1175740843&big_mirror=0"
tar zxvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9
./configure --prefix=/usr
make
make install
cd ..

引用
wget "http://downloads.sourceforge.net/mcrypt/mcrypt-2.6.8.tar.gz?modtime=1194463373&big_mirror=0"
tar zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8
cd src
vi rfc2440.c

  FreeBSD与Linux的不同点,造成需要对 mcrypt 的源码进行一下小小的修改,才能在FreeBSD下编译通过。将其中的
引用
#include <malloc.h>

  修改为
引用
#include <stdlib.h>

  然后继续编译
引用
./configure --prefix=/usr
make
make install
cd ..


  2、编译安装PHP 5.2.14
引用
wget http://www.php.net/get/php-5.2.14.tar.gz/from/this/mirror
wget http://php-fpm.org/downloads/php-5.2.14-fpm-0.5.14.diff.gz
tar zxvf php-5.2.14.tar.gz
gzip -cd php-5.2.14-fpm-0.5.14.diff.gz | patch -d php-5.2.14 -p1
cd php-5.2.14
./buildconf --force
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir=/usr --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr/local --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --disable-ipv6 --without-pear
make ZEND_EXTRA_LIBS='-liconv'
make install
cp php.ini-dist /usr/local/php/etc/php.ini


  3、安装PHP扩展

引用
wget http://pecl.php.net/get/memcache-2.2.5.tgz
tar zxvf memcache-2.2.5.tgz
cd memcache-2.2.5
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install
cd ..

引用
wget http://bart.eaccelerator.net/source/0.9.5.3/eaccelerator-0.9.5.3.tar.bz2
tar jxvf eaccelerator-0.9.5.3.tar.bz2
cd eaccelerator-0.9.5.3
/usr/local/php/bin/phpize
./configure --enable-eaccelerator=shared --with-php-config=/usr/local/php/bin/php-config
make
make install
cd ..

引用
wget http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz
tar zxvf PDO_MYSQL-1.0.2.tgz
cd PDO_MYSQL-1.0.2
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql
make
make install
cd ..

引用
wget ftp://mirror.aarnet.edu.au/pub/imagemagick/ImageMagick-6.5.5-6.tar.gz
tar zxvf ImageMagick-6.5.5-6.tar.gz
cd ImageMagick-6.5.5-6
./configure
make
make install
cd ..

引用
有网友提示,按照以上方法安装ImageMagick后,有可能会遇到PHP加载imagick.so后运行错误,解决方法是在编译ImageMagick时关掉openmp: –disable-openmp。在此感谢网友Sonic热心提示,谢谢。如果还不行的话,请更换ImageMagick至低版本,比如:6.5.4-2。

引用
wget http://pecl.php.net/get/imagick-2.2.2.tgz
tar zxvf imagick-2.2.2.tgz
cd imagick-2.2.2
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install
cd ..


  4、修改php.ini
引用
vi /usr/local/php/etc/php.ini
查找output_buffering = Off
修改为output_buffering = On

再查找extension_dir = "./"
修改为extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"
并在此行后增加以下几行,然后保存:
extension = "memcache.so"
extension = "pdo_mysql.so"
extension = "imagick.so"
extension = "eaccelerator.so"


  5、配置eAccelerator,加速PHP
引用
mkdir -p /data/php/eaccelerator_cache
vi /usr/local/php/etc/php.ini

  在文件末尾增加下面的内容。
引用
[eaccelerator]
eaccelerator.shm_size="64"
eaccelerator.cache_dir="/data/php/eaccelerator_cache"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="3600"
eaccelerator.shm_prune_period="3600"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"

  6、开机启动php-fpm
引用
vi /etc/rc.local
增加下面语句
/usr/local/php/sbin/php-fpm start


  四、配置nginx使其支持PHP
  1、创建网站根目录
引用
mkdir -p /data/www
chmod +w /data/www
chown -R www:www /data/www

  2、创建PHP测试页
引用
vi /data/www/index.php
在文件中输入以下内容
<?php
phpinfo();
?>

  3、修改 /usr/local/nginx/conf/nginx.conf 如下:
引用
user  www www;
worker_processes  8;

events {
    use kqueue;
    worker_connections  51200;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    server_names_hash_bucket_size 128;
    client_header_buffer_size 32k;
    large_client_header_buffers 4 32k;
    client_max_body_size 8m;

    sendfile        on;
    tcp_nopush     on;
    keepalive_timeout  65;

    fastcgi_connect_timeout 300;
    fastcgi_send_timeout 300;
    fastcgi_read_timeout 300;
    fastcgi_buffer_size 64k;
    fastcgi_buffers 4 64k;
    fastcgi_busy_buffers_size 128k;
    fastcgi_temp_file_write_size 128k;

    gzip  on;
    gzip_min_length  1k;
    gzip_buffers     4 16k;
    gzip_http_version 1.0;
    gzip_comp_level 2;
    gzip_types       text/plain application/x-javascript text/css application/xml;
    gzip_vary on;

    tcp_nodelay on;

    server {
        listen      80;
        server_name  192.168.1.3;
        root  /data/www;
        index index.html index.php;

        location ~ .*\.(php|php5)?$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            include        fastcgi.conf;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}


  4、修改/usr/local/nginx/conf/fastcgi.conf文件,在其最前面加入如下代码:
引用
if ($request_filename ~* (.*)\.php) {
    set $php_url $1;
}
if (!-e $php_url.php) {
    return 404;
}


  5、修改/usr/local/php/etc/php-fpm.conf文件如下:
引用
<?xml version="1.0" ?>
<configuration>

  All relative paths in this config are relative to php's install prefix

  <section name="global_options">

    Pid file
    <value name="pid_file">/usr/local/php/logs/php-fpm.pid</value>

    Error log file
    <value name="error_log">/usr/local/php/logs/php-fpm.log</value>

    Log level
    <value name="log_level">notice</value>

    When this amount of php processes exited with SIGSEGV or SIGBUS ...
    <value name="emergency_restart_threshold">10</value>

    ... in a less than this interval of time, a graceful restart will be initiated.
    Useful to work around accidental curruptions in accelerator's shared memory.
    <value name="emergency_restart_interval">1m</value>

    Time limit on waiting child's reaction on signals from master
    <value name="process_control_timeout">5s</value>

    Set to 'no' to debug fpm
    <value name="daemonize">yes</value>

  </section>

  <workers>

    <section name="pool">

      Name of pool. Used in logs and stats.
      <value name="name">default</value>

      Address to accept fastcgi requests on.
      Valid syntax is 'ip.ad.re.ss:port' or just 'port' or '/path/to/unix/socket'
      <value name="listen_address">127.0.0.1:9000</value>

      <value name="listen_options">

        Set listen(2) backlog
        <value name="backlog">-1</value>

        Set permissions for unix socket, if one used.
        In Linux read/write permissions must be set in order to allow connections from web server.
        Many BSD-derrived systems allow connections regardless of permissions.
        <value name="owner"></value>
        <value name="group"></value>
        <value name="mode">0666</value>
      </value>

      Additional php.ini defines, specific to this pool of workers.
      <value name="php_defines">
    <!--    <value name="sendmail_path">/usr/sbin/sendmail -t -i</value>    -->
        <value name="display_errors">0</value>
      </value>

      Unix user of processes
      <value name="user">www</value>

      Unix group of processes
      <value name="group">www</value>

      Process manager settings
      <value name="pm">

        Sets style of controling worker process count.
        Valid values are 'static' and 'apache-like'
        <value name="style">static</value>

        Sets the limit on the number of simultaneous requests that will be served.
        Equivalent to Apache MaxClients directive.
        Equivalent to PHP_FCGI_CHILDREN environment in original php.fcgi
        Used with any pm_style.
        <value name="max_children">8</value>

        Settings group for 'apache-like' pm style
        <value name="apache_like">

          Sets the number of server processes created on startup.
          Used only when 'apache-like' pm_style is selected
          <value name="StartServers">20</value>

          Sets the desired minimum number of idle server processes.
          Used only when 'apache-like' pm_style is selected
          <value name="MinSpareServers">5</value>

          Sets the desired maximum number of idle server processes.
          Used only when 'apache-like' pm_style is selected
          <value name="MaxSpareServers">35</value>

        </value>

      </value>

      The timeout (in seconds) for serving a single request after which the worker process will be terminated
      Should be used when 'max_execution_time' ini option does not stop script execution for some reason
      '0s' means 'off'
      <value name="request_terminate_timeout">0s</value>

      The timeout (in seconds) for serving of single request after which a php backtrace will be dumped to slow.log file
      '0s' means 'off'
      <value name="request_slowlog_timeout">0s</value>

      The log file for slow requests
      <value name="slowlog">logs/slow.log</value>

      Set open file desc rlimit
      <value name="rlimit_files">51200</value>

      Set max core size rlimit
      <value name="rlimit_core">0</value>

      Chroot to this directory at the start, absolute path
      <value name="chroot"></value>

      Chdir to this directory at the start, absolute path
      <value name="chdir"></value>

      Redirect workers' stdout and stderr into main error log.
      If not set, they will be redirected to /dev/null, according to FastCGI specs
      <value name="catch_workers_output">yes</value>

      How much requests each process should execute before respawn.
      Useful to work around memory leaks in 3rd party libraries.
      For endless request processing please specify 0
      Equivalent to PHP_FCGI_MAX_REQUESTS
      <value name="max_requests">102400</value>

      Comma separated list of ipv4 addresses of FastCGI clients that allowed to connect.
      Equivalent to FCGI_WEB_SERVER_ADDRS environment in original php.fcgi (5.2.2+)
      Makes sense only with AF_INET listening socket.
      <value name="allowed_clients">127.0.0.1</value>

      Pass environment variables like LD_LIBRARY_PATH
      All $VARIABLEs are taken from current environment
      <value name="environment">
        <value name="HOSTNAME">$HOSTNAME</value>
        <value name="PATH">/usr/local/bin:/usr/bin:/bin</value>
        <value name="TMP">/tmp</value>
        <value name="TMPDIR">/tmp</value>
        <value name="TEMP">/tmp</value>
        <value name="OSTYPE">$OSTYPE</value>
        <value name="MACHTYPE">$MACHTYPE</value>
        <value name="MALLOC_CHECK_">2</value>
      </value>

    </section>

  </workers>

</configuration>


  至此,环境已经搭建完毕。重启机器后打开浏览器,在地址栏输入:http://192.168.1.3/,应该可以正确显示PHP信息页。


引用
修改历史:
ver 1.0:2009-6-23 0:34,本文创建。
ver 1.1:2009-7-1 23:02,PHP支持库安装中为configure增加参数--prefix=/usr。
ver 1.2:2009-7-2 13:21,1、增加nginx源代码修改部分;2、修改MySQL安装,设置utf8为缺省编码;3、增加分区参考;4、修改用户创建的命令,之前的命令在FreeBSD下无效。
ver 1.3:2009-7-2 23:36,1、增加wget的安装;2、增加了对mcrypt源码的修改,以使其可以在FreeBSD下编译通过。
ver 1.4:2009-7-3 21:26,1、增加PHP扩展的安装;2、增加eAccelerator配置;3、增加nginx的PHP支持配置。
ver 1.5:2009-7-10 15:57,1、升级php-5.2.10-fpm版本到0.5.13;2、升级MySQL到5.1.36
ver 1.6:2009-7-16 18:51,1、增加php-fpm.conf 的配置。
ver 1.7:2009-11-6 10:23,1、增加有关ImageMagick的安装补充。
ver 1.8:2009-11-27 17:51,1、升级nginx版本到0.7.64;2、升级mysql到5.1.41;3、升级php到5.2.11。
ver 1.9:2009-12-11 16:00,1、修改了eaccelerator.so的加载方式。
ver 1.10:2010-1-1 0:05,1、升级MySQL到5.1.42。
ver 1.11:2010-1-29 10:31,1、升级PHP到PHP 5.2.12;2、升级php-fpm到php-5.2.12-fpm-0.5.13。
ver 1.12:2010-5-25 18:03,1、升级nginx版本到0.7.65;2、升级mysql到5.1.47;3、升级php到5.2.13;4、升级php-fpm到php-5.2.13-fpm-0.5.13。
ver 1.13:2010-6-3 10:52,1、修改nginx.conf,将include fastcgi_params改为include fastcgi.conf;2、修改fastcgi.conf,增加防止非法php解析的相关配置。
ver 1.14:2010-6-10 12:18,1、升级nginx版本到0.7.66,0.7.66修补的bug较多,建议升级;2、nginx编译时增加--with-http_sub_module,Substitution模块,点击查看详情
ver 1.15:2010-6-21 14:45,1、升级nginx版本到0.7.67。
ver 1.16:2010-7-12 13:47,1、升级mysql版本到5.1.48。
ver 1.17:2010-7-24 19:56,1、升级mysql版本到5.1.49;2、升级php版本到5.2.14;3、升级php-fpm版本到0.5.14。
ver 1.18:2010-7-25 20:40,1、增加CD1安装后,前期准备工作;2、增加修改FreeBSD内核参数设置;3、修改硬盘分区示例。


  本文主要参考了:《LEMP构建高性能WEB服务器(第三版)》和《Nginx 0.7.x + PHP 5.2.10(FastCGI)搭建胜过Apache十倍的Web服务器(第5版)》,还有很多FreeBSD相关文章。在此对所有参考文章的作者表示感谢。

Tags: , , , ,
纯技术分类 » Web服务器 | 评论(17) | 引用(0) | 阅读(11835)
菜鸟
2011/03/04 10:20
在./buildconf --force出现的信息是:
Forcing buildconf
buildconf: checking installation...
buildconf: autoconf version 2.62 (ok)
buildconf: Your version of autoconf likely contains buggy cache code.
           Running vcsclean for you.
           To avoid this, install autoconf-2.13.
Can't figure out your VCS, not cleaning.
rebuilding configure
aclocal.m4:2099: PHP_PROG_LEX is expanded from...
ext/pdo_dblib/config.m4:55: warning: AC_CACHE_VAL(pdo_inc_path, ...): suspicious cache-id, must contain _cv_ to be cached
../../lib/autoconf/general.m4:1973: AC_CACHE_VAL is expanded from...
../../lib/autoconf/general.m4:1993: AC_CACHE_CHECK is expanded from...
aclocal.m4:2741: PHP_CHECK_PDO_INCLUDES is expanded from...
ext/pdo_firebird/config.m4:43: warning: AC_CACHE_VAL(pdo_inc_path, ...): suspicious cache-id, must contain _cv_ to be cached
ext/pdo_mysql/config.m4:135: warning: AC_CACHE_VAL(pdo_inc_path, ...): suspicious cache-id, must contain _cv_ to be cached
ext/pdo_oci/config.m4:231: warning: AC_CACHE_VAL(pdo_inc_path, ...): suspicious cache-id, must contain _cv_ to be cached
ext/pdo_odbc/config.m4:42: warning: AC_CACHE_VAL(pdo_inc_path, ...): suspicious cache-id, must contain _cv_ to be cached
ext/pdo_pgsql/config.m4:109: warning: AC_CACHE_VAL(pdo_inc_path, ...): suspicious cache-id, must contain _cv_ to be cached
ext/pdo_sqlite/config.m4:14: warning: AC_CACHE_VAL(pdo_inc_path, ...): suspicious cache-id, must contain _cv_ to be cached
ext/sqlite/config.m4:50: warning: AC_CACHE_VAL(pdo_inc_path, ...): suspicious cache-id, must contain _cv_ to be cached
rebuilding main/php_config.h.in
autoheader-2.62: WARNING: Using auxiliary files such as `acconfig.h', `config.h.bot'
autoheader-2.62: WARNING: and `config.h.top', to define templates for `config.h.in'
autoheader-2.62: WARNING: is deprecated and discouraged.
autoheader-2.62:
autoheader-2.62: WARNING: Using the third argument of `AC_DEFINE' and
autoheader-2.62: WARNING: `AC_DEFINE_UNQUOTED' allows one to define a template without
autoheader-2.62: WARNING: `acconfig.h':
autoheader-2.62:
autoheader-2.62: WARNING:   AC_DEFINE([NEED_FUNC_MAIN], 1,
autoheader-2.62:                [Define if a function `main' is needed.])
autoheader-2.62:
autoheader-2.62: WARNING: More sophisticated templates can also be produced, see the
autoheader-2.62: WARNING: documentation.
aclocal.m4:2099: PHP_PROG_LEX is expanded from...
ext/pdo_dblib/config.m4:55: warning: AC_CACHE_VAL(pdo_inc_path, ...): suspicious cache-id, must contain _cv_ to be cached
../../lib/autoconf/general.m4:1973: AC_CACHE_VAL is expanded from...
../../lib/autoconf/general.m4:1993: AC_CACHE_CHECK is expanded from...
aclocal.m4:2741: PHP_CHECK_PDO_INCLUDES is expanded from...
ext/pdo_firebird/config.m4:43: warning: AC_CACHE_VAL(pdo_inc_path, ...): suspicious cache-id, must contain _cv_ to be cached
ext/pdo_mysql/config.m4:135: warning: AC_CACHE_VAL(pdo_inc_path, ...): suspicious cache-id, must contain _cv_ to be cached
ext/pdo_oci/config.m4:231: warning: AC_CACHE_VAL(pdo_inc_path, ...): suspicious cache-id, must contain _cv_ to be cached
ext/pdo_odbc/config.m4:42: warning: AC_CACHE_VAL(pdo_inc_path, ...): suspicious cache-id, must contain _cv_ to be cached
ext/pdo_pgsql/config.m4:109: warning: AC_CACHE_VAL(pdo_inc_path, ...): suspicious cache-id, must contain _cv_ to be cached
ext/pdo_sqlite/config.m4:14: warning: AC_CACHE_VAL(pdo_inc_path, ...): suspicious cache-id, must contain _cv_ to be cached
ext/sqlite/config.m4:50: warning: AC_CACHE_VAL(pdo_inc_path, ...): suspicious cache-id, must contain _cv_ to be cached

Zend官网上只有Zend Guard Loader for PHP 5.3.0,没ZendOptimizer呢~
袁旭东 回复于 2011/03/09 09:01
如果方便,你测试一下低版本PHP 5.2.x。我没有在最新版本的PHP 5.2.x上试过。直接转到PHP 5.3.x了。
菜鸟
2011/03/03 13:17
手动启动php-fpm提示是一样的,就一句话:Starting php_fpm Segmentation fault (core dumped) failed 。度娘也不知道是咋回事~我想装的那个PHP程序必须要用ZendOptimizer,所以被迫选择了PHP5.2……
就是在安装PHP的时候,在./buildconf --force时会出一串警告,不知道是什么……
袁旭东 回复于 2011/03/03 20:39
你把警告贴出来,看看是什么内容。对了,Zend应该已经出了ZendOptimizer for PHP 5.3了吧。就是不知道兼容性如何。
菜鸟
2011/03/03 09:28
我装的 PHP 版本是 5.2.17 ,php-fpm 是 php-5.2.17-fpm-0.5.14 ,不会是这个有错吧?
袁旭东 回复于 2011/03/03 10:48
应该没有错的,你手动启动一下php-fpm,看看有什么错误提示。我现在一直在用PHP 5.3.x了,集成php-fpm。只是有些应用对5.3支持不好,比如discuz,就不能同时支持eAccelerator和PHP 5.3.x。
菜鸟
2011/03/03 08:48
袁大哥~我又来啦~嘿嘿~着您的方法把nginx配置文件改了之后,出现了 400 Bed Requst 错误了……
还有就是在重启机器的时候,我发现有一行提示:Starting php_fpm Segmentation fault (Core dumped) failed,这个是不是说php-fpm没起来呀?安装PHP的时候也没提示什么错误,这个重新装一下能好么?重新装PHP的话,那些PHP扩展是不是也要重新装呀?
袁旭东 回复于 2011/03/03 09:13
只要PHP的版本不变化,扩展不需要重新编译安装的。nginx的错误就是因为php-fpm没有启动造成的,php-fpm启动后应该就没问题了。另外你安装的PHP是什么版本?
菜鸟
2011/03/02 12:50
袁大哥~请教您个问题:按照您这里的这种方法配置Nginx后,可以运行内容管理程序么?据说Nginx只支持静态html,内容管理程序都是动态网页,需要在Nginx上设置什么代理才能正常使用cms程序。这个Nginx的代理怎么设置呀?
袁旭东 回复于 2011/03/02 13:15
如果你的程序是PHP的,那么上面的安装步骤已经包含了PHP的安装与nginx的配置。如果是其他程序,也可以使用FastCGI模式或者代理模式。代理设置方法如下:

server {
        listen 80;
        server_name 192.168.0.10;

        location / {
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_pass http://192.168.1.10:80;
        }
    }
菜鸟
2011/03/02 08:09
袁大哥!在Nginx的配置文件最前面里面,Nginx0.7的 worker_processes 是 8; Nginx0.8的 worker_processes 是 4; 请问袁大哥,这两个必须这么设置么?有什么区别么?
袁旭东 回复于 2011/03/02 12:34
这个表示开启多少个nginx进程,两次写的不一致,是因为当时机器不一样,所以写的不一样了。我一般都写CPU总内核数量的1倍或2倍。如果系统是Linux的话,还支持设置具体某个进程使用某个CPU内核。
菜鸟
2011/03/02 07:55
谢谢楼主的回复!我的FreeBSD版本是8.1Relace,最小安装同时勾选了doc、info、man和src。昨天下午已经通过Ports安装了ImageMagick。Ports实在太慢了……
袁旭东 回复于 2011/03/02 09:46
是啊,ports安装ImageMagick是需要耐心的。我在FreeBSD 8.1上安装某个版本的ImageMagick是正常的,忘记是哪个版本了,而在FreeBSD 8.2上安装不成功,又不想去掉任何一个支持,所以选择了ports方式。比如我在FreeBSD 8.2上编译ImageMagick最新版本,因为freetype的问题编译不过去,所以configure时,加上--without-freetype就可以编译过去了。具体有哪些参数,可以参考./configure --help
菜鸟
2011/03/01 15:49
楼主,我在安装ImageMagick的时候出错:
coders/png.c: In function 'PNGErrorHandler':
coders/png.c:1414: warning: 'jmpbuf' is deprecated (declared at /usr/local/include/png.h:1096)
coders/png.c: In function 'ReadOnePNGImage':
coders/png.c:1737: warning: 'jmpbuf' is deprecated (declared at /usr/local/include/png.h:1096)
coders/png.c:1815: warning: 'bit_depth' is deprecated (declared at /usr/local/include/png.h:651)
coders/png.c:1817: warning: 'color_type' is deprecated (declared at /usr/local/include/png.h:653)
……省略非常长多
coders/png.c:7269: warning: 'bit_depth' is deprecated (declared at /usr/local/include/png.h:651)
coders/png.c:7274: warning: 'color_type' is deprecated (declared at /usr/local/include/png.h:653)
coders/png.c:7278: warning: 'bit_depth' is deprecated (declared at /usr/local/include/png.h:651)
coders/png.c:7280: warning: 'color_type' is deprecated (declared at /usr/local/include/png.h:653)
coders/png.c:7289: warning: 'bit_depth' is deprecated (declared at /usr/local/include/png.h:651)
coders/png.c:7296: warning: 'color_type' is deprecated (declared at /usr/local/include/png.h:653)
coders/png.c:7453: warning: 'bit_depth' is deprecated (declared at /usr/local/include/png.h:651)
coders/png.c:7461: warning: 'color_type' is deprecated (declared at /usr/local/include/png.h:653)
coders/png.c:7495: warning: 'color_type' is deprecated (declared at /usr/local/include/png.h:653)
coders/png.c:7504: warning: 'color_type' is deprecated (declared at /usr/local/include/png.h:653)
coders/png.c:7520: warning: 'color_type' is deprecated (declared at /usr/local/include/png.h:653)
coders/png.c:7521: warning: 'color_type' is deprecated (declared at /usr/local/include/png.h:653)
coders/png.c:7537: warning: 'color_type' is deprecated (declared at /usr/local/include/png.h:653)
coders/png.c:7540: warning: 'color_type' is deprecated (declared at /usr/local/include/png.h:653)
coders/png.c:7564: warning: 'width' is deprecated (declared at /usr/local/include/png.h:639)
coders/png.c:7564: warning: format '%lu' expects type 'long unsigned int', but argument 6 has type 'png_uint_32'
coders/png.c:7566: warning: 'height' is deprecated (declared at /usr/local/include/png.h:640)
coders/png.c:7566: warning: format '%lu' expects type 'long unsigned int', but argument 6 has type 'png_uint_32'
coders/png.c:7573: warning: 'bit_depth' is deprecated (declared at /usr/local/include/png.h:651)
coders/png.c:7580: warning: 'color_type' is deprecated (declared at /usr/local/include/png.h:653)
coders/png.c:7582: warning: 'interlace_type' is deprecated (declared at /usr/local/include/png.h:660)
coders/png.c:7665: warning: 'width' is deprecated (declared at /usr/local/include/png.h:639)
coders/png.c:7666: warning: 'height' is deprecated (declared at /usr/local/include/png.h:640)
coders/png.c:7687: warning: 'width' is deprecated (declared at /usr/local/include/png.h:639)
coders/png.c:7690: warning: 'height' is deprecated (declared at /usr/local/include/png.h:640)
coders/png.c:7708: warning: 'bit_depth' is deprecated (declared at /usr/local/include/png.h:651)
coders/png.c: In function 'WriteMNGImage':
coders/png.c:9047: warning: format '%lu' expects type 'long unsigned int', but argument 6 has type 'unsigned int'
coders/png.c:9050: warning: format '%lu' expects type 'long unsigned int', but argument 6 has type 'unsigned int'
*** Error code 1
版本是6.5.4-2,本来是为了避免您说的那个问题的,没想到出错了……
是不是我的png支持没装上啊?
袁旭东 回复于 2011/03/01 18:15
你的FreeBSD版本是多少?建议你参考此系列文章的最新版:http://blog.jiqila.com/post/223/,可以尝试使用ports方式安装ImageMagick。
菜鸟
2011/03/01 07:49
envy袁大哥啊,看到您的博文,小弟佩服得五体投地啊zan
我是个菜鸟,很菜很菜的,请教您一个只有菜鸟才会问的问题,这个eAccelerator是PHP的加速器吧?那ZendOptimizer和这个eAccelerator是啥关系呀?这两个是不是能相互替换的、只装一个就行?还是各有各的作用,不能通用的啊?请袁大哥赐教啊!
袁旭东 回复于 2011/03/01 13:11
两者的作用是类似的,ZendOptimizer没有缓存功能。eAccelerator的加速要明显得多。只装eAccelerator也够用了,不过有时候有些php应用需要ZendOptimizer,那就两者都装上吧。
2010/07/15 01:59
您好袁老师,想问下在Freebsd跟Centos下使用nginx哪个效率更高,安全性更好,还有您用的Freebsd是64位的吗?
袁旭东 回复于 2010/07/15 21:25
我用的是FreeBSD 8.0 x64的。效率我没有测试过,不好说。但就两个系统来说,我倾向于FreeBSD。还可以举个例子,nginx官方网站就是用的FreeBSD。
分页: 1/2 第一页 1 2 下页 最后页
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]