首页 > nginx > FastDFS nginx 模块 php_client使用。

FastDFS nginx 模块 php_client使用。

2010年12月7日 eric 发表评论 阅读评论

由于本人对PHP了解有限,读起 README来有些慢·不过还是看明白了点·先写下上传,和得到文件的fileid,同理也可以下载·呵呵。其实很简单函数有说明的。接上文的安装完毕后,在nginx 上编译php-fpm,让其支持php.

1.编译php-fpm

nginx $> wget http://cn2.php.net/get/php-5.2.14.tar.bz2/from/cn.php.net/mirror
nginx $> wget http://php-fpm.org/downloads/php-5.2.14-fpm-0.5.14.diff.gz
nginx $> tar jxvf php-5.2.14.tar.bz2
nginx $> gzip -cd php-5.2.14-fpm-0.5.14.diff.gz | patch -d php-5.2.14 -p1
nginx $> cd php-5.2.14
nginx $> ./configure --prefix=/usr/local/php --enable-fastcgi --enable-fpm --enable-force-cgi-redirect
nginx $> make
nginx $> make install
nginx $> cp php.ini-dist /usr/local/php/etc/

2.编译fastdfs_client.so php扩展模块

nginx $> cd /root/FastDFS/php_client
nginx $> /usr/local/php/bin/phpize
nginx $> ./configure --with-php-config=/usr/local/php/bin/php-config --with-fastdfs_client
nginx $> make
nginx $> make install

3.修改 php.ini 让 php-fpm 支持fastdfs_client 扩展模块

nginx $> vim /usr/local/php/etc/php.ini
修改extension_dir = "./" 改为:
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"
extension = fastdfs_client.so
fastdfs_client.base_path = /home/yuqing/fastdfs
fastdfs_client.connect_timeout = 2
fastdfs_client.network_timeout = 60
fastdfs_client.log_level = info
fastdfs_client.log_filename =
fastdfs_client.http.anti_steal_secret_key =
fastdfs_client.tracker_group_count = 1
fastdfs_client.tracker_group0 = /etc/fdfs/client.conf

4.修改 nginx.conf 配置文件。让其支持 php-fpm解析php

nginx $> vim /usr/local/nginx/conf/nginx.conf
# 添加如下

     location ~ .*\.(php|php5)?$
     {
      fastcgi_pass  127.0.0.1:9000;
      fastcgi_index index.php;
      include fastcgi.conf;
     }
      location /M00 {
            alias /home/eric/data;
            ngx_fastdfs_module;
        }

5. 启动所有服务,创建上传代码

nginx $> /usr/local/nginx/sbin/nginx
nginx $> /usr/local/php/sbin/php-fpm start
# 创建测试代码:
nginx $> vim /usr/local/nginx/html/test.php
< ?php
$filename = "/usr/include/stdio.h";             //所上传的文件
$fdfs = new FastDFS();                           //调用FastDFS类
$file_info = $fdfs->storage_upload_by_filename($filename,html);         //上传文件 $filename 是所上传的文件,html是上传后的更名后缀名为.html
echo $file_info['filename'];                       //输出上传文件目录和文件名
?>

6.测试打开IE看图:

转载请注明:文章转载自:Eric's linux and nginx! (http://www.nginxs.com)
本文地址:http://www.nginxs.com/linux/357.html

分类: nginx 标签: , ,
  1. 2017年12月16日01:24 | #1

    I’ve been exploring for a little bit for any high-quality articles
    or weblog posts in this kind of area . Exploring in Yahoo I at last stumbled
    upon this website. Studying this information So i am glad
    to exhibit that I’ve a very excellent uncanny feeling I
    discovered just what I needed. I most indubitably will make certain to don?t disregard this
    web site and give it a glance on a continuing basis.

  2. 2017年12月16日06:12 | #2

    payday loans no credit check
    payday loans no credit check
    payday loans
    payday loans no credit check
    payday loans online

  3. 2017年12月17日11:57 | #3

    This is a topic that’s close to my heart…
    Cheers! Where are your contact details though?

  4. 2017年12月19日02:39 | #4

    online casino
    online casino games
    online casino
    casino games list
    casino online usa

  5. 2017年12月23日05:56 | #5

    payday loans no credit
    payday loans no credit
    payday loans online no credit check
    payday loans online no credit check
    payday loans online no credit check

  6. 2017年12月26日16:08 | #6

    Asking questions are truly nice thing if you are not understanding anything entirely, however this piece of writing provides fastidious
    understanding even.

  7. 2017年12月30日15:19 | #7

    online casino
    casino online
    real money casino
    real money casino
    online casino

  8. 2018年1月2日06:12 | #8

    casino open usa
    casino
    legal online gambling sites us

  9. 2018年1月3日21:12 | #9

    Venta costa rica http://farmaciaenlinea.life/deksamet.html donde puedo comprar en el salvador.

  10. 2018年1月3日22:43 | #10

    Precios en colombia http://farmacia-en-linea.life/rosvel.html comprar generico en internet.

  11. 2018年1月4日01:26 | #11

    loans for bad credit
    payday loans online
    payday loans no credit
    payday loans online
    payday loans

  12. 2018年1月7日23:29 | #12

    online casino games
    casino free games
    free slot games
    slots games
    free casino games

  13. 2018年1月8日05:26 | #13

    Ordering from mexico http://keep.pk/user/profile/17170 Cost of in canada.

  14. 2018年1月8日10:29 | #14
  15. 2018年1月8日12:45 | #15

    Order next day delivery http://www.sbe60.org/node/147350 online shopping.

  16. 2018年1月9日03:24 | #16

    best place to buy in canada https://www.sayar.com.mm/?option=com_k2&view=itemlist&task=user&id=72366 price south africa.

  17. 2018年1月9日22:07 | #17

    Acheter suisse http://medicamentsonline.life/venex.html prix pas cher.

  18. 2018年1月10日01:01 | #18

    Kopen in nederland den haag, http://onlinemedicijnenbestellen.life/periactin.html , prijzen rotterdam.

  19. 2018年1月12日06:04 | #19
  20. 2018年1月13日21:42 | #20

    payday loans online no credit check
    loans no credit
    loans for bad credit
    loans no credit
    payday loans no credit

  21. 2018年1月21日13:12 | #21

    Hello! I know this is kind of off topic but I was wondering which blog platform are you using for this site?
    I’m getting tired of WordPress because I’ve had issues with hackers and I’m looking at options for
    another platform. I would be awesome if you could point me in the direction of
    a good platform.

  22. 2018年1月22日01:29 | #22

    absolutely free slots for fun
    slots for money online
    free slots vegas world
    heart of vegas free slots
    online casinos for us players

评论分页
1 ... 3 4 5 357
订阅评论
4+6= (必填)