首页 > 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. 2018年5月29日11:02 | #1

    Learn about working at Lively Tree Providers.

  2. 2018年5月30日22:58 | #2

    canadian online pharmacy
    online canadian pharmacies
    aarp approved canadian online pharmacies

  3. 2018年6月1日02:21 | #3

    Many roadside repair providers promote towing.

  4. 2018年6月1日04:52 | #4

    These drivers may also change tires on automobiles.

  5. 2018年6月7日05:01 | #5

    Garage doorways can and do freeze to the garage floor.

  6. 2018年6月7日11:40 | #6

    Garage door repairs shouldn’t be chosen haphazardly.

  7. 2018年6月7日13:19 | #7

    One other area when deciding on truck is the
    drivers.

  8. 2018年6月7日18:39 | #8

    One other space when deciding on truck is the drivers.

  9. 2018年6月12日17:16 | #9

    Your way of describing everything in this piece of writing is in fact good, every one be able to without difficulty know it, Thanks a lot.

  10. 2018年6月12日23:51 | #10

    Hi! Thіs is my first visit to your blog! We aгe a groᥙp of vokunteers аnd starting a new initiative in a community inn
    tthe ѕame niche. Үour blog procided uus vapuable
    іnformation tto wⲟrk ⲟn. Уou havе done a marvellous job!

  11. 2018年6月13日00:09 | #11

    Erfahrungen 777 Tablets Levitra Online Drugstore [url=http://cheapciali.com]cialis 5 mg[/url] Cephalexin Lawsuit

  12. 2018年6月13日21:43 | #12

    Sharing some thing is superior than keeping up-to our self, thus the YouTube video that is posted at this place I am going to share by my family and friends.

  13. 2018年6月13日21:59 | #13

    Genuinely programming is nothing but it’s a logic, if you obtain grip on it after that you are the professional else nil.

  14. 2018年6月16日13:36 | #14

    I just likе tһe helpfu info you provide t᧐ yοur articles.
    Ι will bookmark yߋur weblog аnd take a look at agɑin herre regularly.

    Ӏ am somеwhat sure I’ll bе informed many new stuff right һere!
    Βest of luck ffor tһe next!

  15. 2018年6月21日12:30 | #15

    Well rounded individuals often make good actors.

  16. 2018年6月21日13:34 | #16

    What Do Expertise Agents Look For In Actors?

  17. 2018年6月21日14:02 | #17

    Most actors make investments their time and efforts poorly.

  18. 2018年6月21日15:18 | #18

    Most actors make investments their time and efforts poorly.

  19. 2018年6月21日16:35 | #19

    What Do Expertise Agents Look For In Actors?

  20. 2018年6月21日18:11 | #20

    Head turns enable the eyes to comment on a situation.

  21. 2018年6月21日21:44 | #21

    What Do Expertise Brokers Look For In Actors?

  22. 2018年6月22日10:52 | #22

    Most actors make investments their time and efforts poorly.

  23. 2018年6月22日16:52 | #23

    Head turns enable the eyes to comment on a situation.

  24. 2018年6月22日18:31 | #24

    Effectively rounded individuals often make good actors.

  25. 2018年6月22日18:36 | #25

    Properly rounded individuals normally make good actors.

  26. 2018年6月22日22:18 | #26

    Most actors make investments their time and efforts poorly.

  27. 2018年6月22日23:31 | #27

    Head turns enable the eyes to touch upon a state of affairs.

  28. 2018年6月23日03:26 | #28

    What Do Expertise Agents Look For In Actors?

  29. 2018年6月23日07:20 | #29

    Head turns enable the eyes to comment on a situation.

  30. 2018年6月24日01:13 | #30

    Most actors make investments their time and efforts poorly.

  31. 2018年6月24日05:35 | #31

    Most actors invest their time and efforts poorly.

  32. 2018年6月24日08:50 | #32

    What Do Talent Agents Look For In Actors?

  33. 2018年6月24日16:26 | #33

    Well rounded folks often make good actors.

  34. 2018年6月24日20:31 | #34

    Nicely rounded individuals usually make good actors.

  35. 2018年6月24日23:12 | #35

    What Do Expertise Brokers Look For In Actors?

  36. 2018年6月25日00:48 | #36

    Most actors invest their time and efforts poorly.

  37. 2018年7月4日22:04 | #37

    If you desire to grow your experience simply keep visiting this web page and be updated with the most up-to-date news posted here.

  38. 2018年7月4日22:21 | #38

    I am actually glad to read this weblog posts which carries plenty of helpful data, thanks for providing such data.

  39. 2018年7月5日07:33 | #39

    What’s up it’s me, I am also visiting this website daily, this web site is really nice and the users are in fact sharing fastidious thoughts.

  40. 2018年7月5日08:10 | #40

    buy medicine online https://www.ning.com/?p=13704 Where to buy in uae.

  41. 2018年7月16日06:04 | #41

    You must spend time on Twitter and get to know folks.

评论分页
1 2 3 357
订阅评论
0+4= (必填)