SDpower

Gearman 不一樣的用法~~

by on 五月.10, 2012, under PHP & MYSQL

Gearman

你所知道的Gearman

可以導入大量數據、發送許多電子郵件、編碼視頻文件、挖據數據並構建一個中央日誌設施 — 所有這些均不會影響站點的體驗和響應性。可以並行地處理數據。而且,由於 Gearman 協議是獨立於語言和平台的,所以您可以在解決方案中混合編程語言。比如,可以用 PHP 編寫一個 producer,用 C、Ruby 或其他任何支持 Gearman 庫的語言編寫 worker。

你所應用Gearman


(continue reading…)

Fork me on GitHub
Leave a Comment more...

Phalcon !! 以C開發的php freamwork!!

by on 五月.06, 2012, under 未分類

Phalcon is a C extension so you need to download a binary for your platform or compile it from source code.

看完這句,再去看 官方的數據. Framework Benchmark
這完全拋開PHP!!!的包袱.

安裝方式

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
##Ubuntu必須先確認 安裝下列套件
# sudo apt-get install php5-dev php5-mysql gcc
cd /tmp
# git clone git://github.com/phalcon/cphalcon.git
Cloning into 'cphalcon'...
remote: Counting objects: 1856, done.
remote: Compressing objects: 100% (700/700), done.
remote: Total 1856 (delta 1277), reused 1552 (delta 973)
Receiving objects: 100% (1856/1856), 1.76 MiB | 460 KiB/s, done.
Resolving deltas: 100% (1277/1277), done.
# cd /tmp/cphalcon/release
# ./configure
# make;make install;
/usr/local/etc/php/extensions.ini
extension=phalcon.so

待續…

Leave a Comment more...

PHP extension Redis 安裝使用

by on 三月.19, 2012, under PHP & MYSQL

PHP extension Redis 安裝使用

安裝 PHP extension for Redis 使PHP可以與Redis運作.

安裝

1
2
3
4
5
6
7
8
9
$ cd /tmp
$ git clone git://github.com/nicolasff/phpredis.git
$ cd /tmp/phpredis
$ phpize
$ ./configure
$ make
$ make install clean
#編輯 php.ini加入
extension=redis.so

(continue reading…)

Leave a Comment more...

Redis Key-Value資料庫建置實測

by on 三月.14, 2012, under FreeBSD, Mac OSX, PHP & MYSQL, 未分類

reids

Redis是一個開源的使用ANSI C語言編寫、支援網路、可基於記憶體亦可持久化的日誌型、Key-Value資料庫,並提供多種語言的API。從2010年3月15日起,Redis的開發工作由VMware主持。

通常,Redis將數據存儲於記憶體,或被配置為使用虛擬記憶體。通過兩種方式可以實現數據持久:使用快照的方式,將內存中的數據不斷寫入磁碟;或使用類似MySQL的日誌方式,記錄每次更新的日誌。前者性能較高,但是可能會引起一定程度的數據遺失(後者相反)。

Mac 使用brew安裝reids

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
-> % brew install redis
==> Downloading http://redis.googlecode.com/files/redis-2.4.8.tar.gz
######################################################################## 100.0%
==> make -C src
==> Caveats
If this is your first install, automatically load on login with:
    mkdir -p ~/Library/LaunchAgents
    cp /usr/local/Cellar/redis/2.4.8/homebrew.mxcl.redis.plist ~/Library/LaunchAgents/
    launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
 
If this is an upgrade and you already have the homebrew.mxcl.redis.plist loaded:
    launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
    cp /usr/local/Cellar/redis/2.4.8/homebrew.mxcl.redis.plist ~/Library/LaunchAgents/
    launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
 
  To start redis manually:
    redis-server /usr/local/etc/redis.conf
 
  To access the server:
    redis-cli
==> Summary
/usr/local/Cellar/redis/2.4.8: 9 files, 424K, built in 5 seconds

(continue reading…)

Leave a Comment more...

FreeBSD 9.0 架設安裝 redmine

by on 二月.18, 2012, under FreeBSD

之前有介紹過FreeBSD 架設 redmine.
不過現在因為版本關係不相容,以無法使用.

$ cd /usr/ports/www/redmine
$ make install clean
===>  redmine-1.3.1 is marked as broken: Does not work with RubyGems 1.8.
*** Error code 1
 
Stop in /usr/ports/www/redmine.
$

(continue reading…)

Leave a Comment more...

FuelPHP FrameWork 進入! Enter~~

by on 一月.05, 2012, under PHP & MYSQL

安裝之前有說過哩:請參考 FuelPHP FrameWork 初體驗~~
之前說過 作者將APP 整個包在FrameWork 內的蠢話. 我可以不承認嗎XDD
其實算是給開發人員快速進入,實作體驗FrameWork用的.
如果要自行快速分離請先參考 同事強做:【程式筆記】建立一個FuelPHP的應用程式Git Repository

如果這樣不能滿足你,接下來江示範如何調整.
(continue reading…)

Leave a Comment : more...

FuelPHP FrameWork 初體驗~~

by on 十二月.27, 2011, under PHP & MYSQL

FuelPHP is a simple, flexible, community driven PHP 5.3 web framework based on the best ideas of other frameworks with a fresh start.
FuelPHP 衝著他以php 5.3 並以namespace 方式開發,輕量化FrameWork趕快來試用看看吧.

安裝

安裝方式不免俗來了,快速按裝.(不錯唷)

1
2
3
4
5
6
7
$ curl get.fuelphp.com/oil | sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   244  100   244    0     0    240      0  0:00:01  0:00:01 --:--:--  1257
Password:
 
$

(continue reading…)

Leave a Comment more...

ZFS on MAC OSX

by on 十一月.23, 2011, under Mac OSX

ZFS 是很好檔案系統,可惜因為種種原因…沒有機會在OSX 上面使用.
MACZFS
是好心人porting到MAC OSX上面,只要下載安裝包下來就可以直接使用.
以下是實際使用方式:
先查看目前磁碟使用狀況.

1
2
3
4
5
6
7
8
#  diskutil list
/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.1 GB   disk0
   1:                        EFI                         209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            300.9 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
   4:                  Apple_HFS data                    198.2 GB   disk0s4

(continue reading…)

Leave a Comment : more...

Gearman Install OSX

by on 十一月.18, 2011, under 未分類

安裝Gearman 在OSX上面

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
$ sudo -s
$ cd /tmp
$ wget https://github.com/downloads/libevent/libevent/libevent-2.0.15-stable.tar.gz
$ tar zxvf libevent-2.0.15-stable.tar.gz
$ cd libevent-2.0.15-stable
$ ./configure
$ make
$ make install
$ cd ..
$ wget https://launchpad.net/ubuntu/lucid/+source/libdrizzle/0.7-1/+files/libdrizzle_0.7.orig.tar.gz
$ tar libdrizzle_0.7.orig.tar.gz
$ cd libdrizzle-0.7/
$ ./configure
$ make
$ make install
$ cd ..
$ wget http://launchpad.net/gearmand/trunk/0.14/+download/gearmand-0.14.tar.gz
$ tar zxvf gearmand-0.14.tar.gz
$ cd gearmand-0.14/
$ ./configure
$ make
$ make install
$ cd ..
$ wget http://pecl.php.net/get/gearman-0.8.0.tgz
$ tar zxvf gearman-0.8.0.tgz
$ cd gearman-0.8.0
$ phpize
$ ./configure
$ make
$ sudo make install
/bin/sh /tmp/gearman-0.8.0/libtool --mode=install cp ./gearman.la /tmp/gearman-0.8.0/modules
cp ./.libs/gearman.so /tmp/gearman-0.8.0/modules/gearman.so
cp ./.libs/gearman.lai /tmp/gearman-0.8.0/modules/gearman.la
----------------------------------------------------------------------
Libraries have been installed in:
   /tmp/gearman-0.8.0/modules
 
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `DYLD_LIBRARY_PATH' environment variable
     during execution
 
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
Installing shared extensions:     /usr/lib/php/extensions/no-debug-non-zts-20090626/
 
$ which php
/usr/bin/php
 
$ php --info | grep -i configuration                                                                                                  (11-17 13:30)
Configuration File (php.ini) Path => /etc
Loaded Configuration File => /private/etc/php.ini
Configuration
$ vi /private/etc/php.ini
======= 加入以下資訊 ======
extension_dir = " /usr/lib/php/extensions/no-debug-non-zts-20090626/"  <~~這不一定要
extension="gearman.so"
========================
$ php --info | egrep -i "(configuration|gearman)"
Configuration File (php.ini) Path => /etc
Loaded Configuration File => /private/etc/php.ini
Configuration
gearman
gearman support => enabled
libgearman version => 0.14
Leave a Comment more...

Gearman Install on Ubuntu

by on 十一月.18, 2011, under PHP & MYSQL

gearman 在ubuntu 上不知哪個版本已無提供libdrizzlea模組.
導致要使用myql作為資料源已無法使用.
以下是自行編譯安裝方式:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
$ sudo -s
$ add-apt-repository ppa:gearman-developers/ppa
$ apt-get update
$ apt-get install libevent-dev gearman libgearman4 libgearman-dev libdrizzle0 libboost-program-options-dev libboost1.46-dev libboost-program-options-dev uuid-dev g++ libmemcache-dev libcloog-ppl0
$ wget https://launchpad.net/ubuntu/lucid/+source/libdrizzle/0.7-1/+files/libdrizzle_0.7.orig.tar.gz
$ tar zxvf libdrizzle_0.7.orig.tar.gz
$ cd libdrizzle-0.7/
$ ./configure
$ make
$ make install
$ cd..
$ wget http://launchpad.net/gearmand/trunk/0.14/+download/gearmand-0.14.tar.gz
$ tar zxvf gearmand-0.14.tar.gz
$ cd gearmand-0.14/
 
$ ./configure libdrizzle_CFLAGS="-I/usr/local/include" libdrizzle_LIBS="-L/usr/local/lib -ldrizzle"
$ make
$ make install
$ cd ..
$ wget http://pecl.php.net/get/gearman-0.8.0.tgz
$ pecl install gearman-0.8.0.tgz
$ vi /etc/php5/conf.d/gearman.ini
==== 加入 ====
extension=gearman.so
$ vi /etc/init.d/gearman-job-server
=====編輯====
prefix=/usr/local
PARAMS="--queue-type=libdrizzle --libdrizzle-host=mysql主機ip --libdrizzle-user=mysql帳號 --libdrizzle-password=mysql主機ip --libdrizzle-db=gearman --libdrizzle-table=gearman_queue --libdrizzle-mysql"
====加上註解====
#test -f /etc/default/gearman-job-server && . /etc/default/gearman-job-server
========================
DB gearman  要自行在mysql新增 資料表他自行會建立
$ service gearman-job-server start
Leave a Comment more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!