Search

'oauth'에 해당되는 글 1건

  1. 2013.04.18 php에서 api 인증을 위한 oauth 모듈 추가 방법

API 인증을 위한 php 모듈 oauth 추가 설치 방법입니다.


모듈 직접 다운로드 시 필요한 좌표는 아래와 같습니다.

http://pecl.php.net/package/oauth



아래는 우리 메일서버에 설치한 내역입니다.

 

 [root@mail bin]#cd /usr/local/php/bin        <-- php 소스 설치 위치 bin 디렉토리로 이동합니다

 

[root@mail bin]# ./pecl download oauth        <-- oauth 모듈을 다운로드 받습니다

WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update

downloading oauth-1.2.3.tgz ...

Starting to download oauth-1.2.3.tgz (45,531 bytes)

.............done: 45,531 bytes

File /usr/local/php/bin/oauth-1.2.3.tgz downloaded

 

[root@mail bin]# ls

channel.xml  oauth-1.2.3.tgz  pear  peardev  pecl  phar  phar.phar  php  php-config  phpize

 

[root@mail bin]# tar xvzf oauth-1.2.3.tgz        <-- 압축 해제를 합니다

package.xml

oauth-1.2.3/examples/config.inc.php

oauth-1.2.3/examples/request_signing.php

oauth-1.2.3/examples/request_token.php

oauth-1.2.3/examples/access_token.php

oauth-1.2.3/examples/exec_api.php

oauth-1.2.3/examples/README

oauth-1.2.3/examples/yahoo/config.inc.php

oauth-1.2.3/examples/yahoo/request_signing.php

oauth-1.2.3/examples/yahoo/request_token.php

oauth-1.2.3/examples/yahoo/access_token.php

oauth-1.2.3/examples/yahoo/exec_yql.php

oauth-1.2.3/examples/yahoo/exec_yql_refresh_token.php

oauth-1.2.3/examples/fireeagle/config.inc.php

oauth-1.2.3/examples/fireeagle/request_signing.php

oauth-1.2.3/examples/fireeagle/request_token.php

oauth-1.2.3/examples/fireeagle/access_token.php

oauth-1.2.3/examples/fireeagle/exec_update_user.php

oauth-1.2.3/examples/netflix/config.inc.php

oauth-1.2.3/examples/netflix/request_token.php

oauth-1.2.3/examples/netflix/access_token.php

oauth-1.2.3/examples/netflix/feeds.php

oauth-1.2.3/examples/netflix/rental_history_atom.php

oauth-1.2.3/examples/twitter/README

oauth-1.2.3/examples/twitter/constants.php

oauth-1.2.3/examples/twitter/fetchTimeline.php

oauth-1.2.3/examples/twitter/updateStatus.php

oauth-1.2.3/examples/google/README

oauth-1.2.3/examples/google/config.inc.php

oauth-1.2.3/examples/google/request_token.php

oauth-1.2.3/examples/google/access_token.php

oauth-1.2.3/examples/google/getContactInfo.php

oauth-1.2.3/examples/wepay/README

oauth-1.2.3/examples/wepay/config.inc.php

oauth-1.2.3/examples/wepay/request_token.php

oauth-1.2.3/examples/wepay/access_token.php

oauth-1.2.3/examples/wepay/balances.php

oauth-1.2.3/examples/digg/config.inc.php

oauth-1.2.3/examples/digg/digg_a_story.php

oauth-1.2.3/config.m4

oauth-1.2.3/config.w32

oauth-1.2.3/oauth.c

oauth-1.2.3/provider.c

oauth-1.2.3/php_oauth.h

oauth-1.2.3/provider.h

oauth-1.2.3/LICENSE

 

[root@mail bin]# ls

channel.xml  oauth-1.2.3.tgz  pear     pecl  phar.phar  php-config

oauth-1.2.3  package.xml      peardev  phar  php        phpize

 

[root@mail bin]# cd oauth-1.2.3        <-- 압축 해제한 디렉토리로 이동합니다

 

[root@mail oauth-1.2.3]# pwd

/usr/local/php/bin/oauth-1.2.3

   

[root@mail oauth-1.2.3]# ../phpize        <-- 상위 디렉토리의 phpize 를 실행하여 확장 모듈 추가를 위한 환경을 구성(configure 생성)하여 줍니다

Configuring for:

PHP Api Version:         20090626

Zend Module Api No:      20090626

Zend Extension Api No:   220090626

 

[root@mail oauth-1.2.3]# ls

LICENSE          autom4te.cache  config.m4   configure.in  missing        provider.c

Makefile.global  build           config.sub  examples      mkinstalldirs  provider.h

acinclude.m4     config.guess    config.w32  install-sh    oauth.c        run-tests.php

aclocal.m4       config.h.in     configure   ltmain.sh     php_oauth.h

 

[root@mail oauth-1.2.3]# pwd

/usr/local/php/bin/oauth-1.2.3

 

[root@mail oauth-1.2.3]# ls

LICENSE          autom4te.cache  config.m4   configure.in  missing        provider.c

Makefile.global  build           config.sub  examples      mkinstalldirs  provider.h

acinclude.m4     config.guess    config.w32  install-sh    oauth.c        run-tests.php

aclocal.m4       config.h.in     configure   ltmain.sh     php_oauth.h

 

[root@mail oauth-1.2.3]# ./configure --with-php-config=/usr/local/php/bin/php-config    <-- 기존 php설치 디렉토리의 php-config를 사용합니다

checking for egrep... grep -E

checking for a sed that does not truncate output... /bin/sed

checking for cc... cc

checking for C compiler default output file name... a.out

checking whether the C compiler works... yes

checking whether we are cross compiling... no

checking for suffix of executables...

checking for suffix of object files... o

checking whether we are using the GNU C compiler... yes

checking whether cc accepts -g... yes

checking for cc option to accept ANSI C... none needed

checking how to run the C preprocessor... cc -E

checking for icc... no

checking for suncc... no

checking whether cc understands -c and -o together... yes

checking for system library directory... lib

checking if compiler supports -R... no

checking if compiler supports -Wl,-rpath,... yes

checking build system type... i686-pc-linux-gnu

checking host system type... i686-pc-linux-gnu

checking target system type... i686-pc-linux-gnu

checking for PHP prefix... /usr/local/php

checking for PHP includes... -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib

checking for PHP extension directory... /usr/local/php/lib/php/extensions/no-debug-zts-20090626

checking for PHP installed headers prefix... /usr/local/php/include/php

checking if debug is enabled... no

checking if zts is enabled... no

checking for re2c... no

configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.

checking for gawk... gawk

checking for oauth support... yes, shared

checking for cURL in default path... found in /usr

checking for ld used by cc... /usr/bin/ld

checking if the linker (/usr/bin/ld) is GNU ld... yes

checking for /usr/bin/ld option to reload object files... -r

checking for BSD-compatible nm... /usr/bin/nm -B

checking whether ln -s works... yes

checking how to recognize dependent libraries... pass_all

checking for ANSI C header files... yes

checking for sys/types.h... yes

checking for sys/stat.h... yes

checking for stdlib.h... yes

checking for string.h... yes

checking for memory.h... yes

checking for strings.h... yes

checking for inttypes.h... yes

checking for stdint.h... yes

checking for unistd.h... yes

checking dlfcn.h usability... yes

checking dlfcn.h presence... yes

checking for dlfcn.h... yes

checking the maximum length of command line arguments... 98304

checking command to parse /usr/bin/nm -B output from cc object... ok

checking for objdir... .libs

checking for ar... ar

checking for ranlib... ranlib

checking for strip... strip

checking if cc supports -fno-rtti -fno-exceptions... no

checking for cc option to produce PIC... -fPIC

checking if cc PIC flag -fPIC works... yes

checking if cc static flag -static works... yes

checking if cc supports -c -o file.o... yes

checking whether the cc linker (/usr/bin/ld) supports shared libraries... yes

checking whether -lc should be explicitly linked in... no

checking dynamic linker characteristics... GNU/Linux ld.so

checking how to hardcode library paths into programs... immediate

checking whether stripping libraries is possible... yes

checking if libtool supports shared libraries... yes

checking whether to build shared libraries... yes

checking whether to build static libraries... no

 

creating libtool

appending configuration tag "CXX" to libtool

configure: creating ./config.status

config.status: creating config.h

 

[root@mail oauth-1.2.3]# make && make install        <-- 컴파일 진행해줍니다

/bin/sh /usr/local/php/bin/oauth-1.2.3/libtool --mode=compile cc  -I. -I/usr/local/php/bin/oauth-1.2.3 -DPHP_ATOM_INC -I/usr/local/php/bin/oauth-1.2.3/include -I/usr/local/php/bin/oauth-1.2.3/main -I/usr/local/php/bin/oauth-1.2.3 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2 -Wall -g   -c /usr/local/php/bin/oauth-1.2.3/oauth.c -o oauth.lo

mkdir .libs

cc -I. -I/usr/local/php/bin/oauth-1.2.3 -DPHP_ATOM_INC -I/usr/local/php/bin/oauth-1.2.3/include -I/usr/local/php/bin/oauth-1.2.3/main -I/usr/local/php/bin/oauth-1.2.3 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -Wall -g -c /usr/local/php/bin/oauth-1.2.3/oauth.c  -fPIC -DPIC -o .libs/oauth.o

/usr/local/php/bin/oauth-1.2.3/oauth.c: In function 'oauth_http_build_query':

/usr/local/php/bin/oauth-1.2.3/oauth.c:630: warning: dereferencing type-punned pointer will break strict-aliasing rules

/bin/sh /usr/local/php/bin/oauth-1.2.3/libtool --mode=compile cc  -I. -I/usr/local/php/bin/oauth-1.2.3 -DPHP_ATOM_INC -I/usr/local/php/bin/oauth-1.2.3/include -I/usr/local/php/bin/oauth-1.2.3/main -I/usr/local/php/bin/oauth-1.2.3 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2 -Wall -g   -c /usr/local/php/bin/oauth-1.2.3/provider.c -o provider.lo

 cc -I. -I/usr/local/php/bin/oauth-1.2.3 -DPHP_ATOM_INC -I/usr/local/php/bin/oauth-1.2.3/include -I/usr/local/php/bin/oauth-1.2.3/main -I/usr/local/php/bin/oauth-1.2.3 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -Wall -g -c /usr/local/php/bin/oauth-1.2.3/provider.c  -fPIC -DPIC -o .libs/provider.o

/usr/local/php/bin/oauth-1.2.3/provider.c: In function 'oauth_provider_remove_required_param':

/usr/local/php/bin/oauth-1.2.3/provider.c:67: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c: In function 'oauth_provider_add_required_param':

/usr/local/php/bin/oauth-1.2.3/provider.c:88: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c: In function 'oauth_provider_apply_custom_param':

/usr/local/php/bin/oauth-1.2.3/provider.c:109: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c: In function 'oauth_provider_check_required_params':

/usr/local/php/bin/oauth-1.2.3/provider.c:171: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c: In function 'oauth_provider_set_std_params':

/usr/local/php/bin/oauth-1.2.3/provider.c:189: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:190: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:191: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:192: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:193: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:194: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:195: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:196: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:197: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c: In function 'oauth_provider_parse_auth_header':

/usr/local/php/bin/oauth-1.2.3/provider.c:254: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:265: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:267: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:268: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c: In function 'oauth_provider_get_http_verb':

/usr/local/php/bin/oauth-1.2.3/provider.c:404: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:404: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c: In function 'oauth_provider_get_current_uri':

/usr/local/php/bin/oauth-1.2.3/provider.c:418: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:419: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:420: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:421: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:422: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c: In function 'zim_oauthprovider___construct':

/usr/local/php/bin/oauth-1.2.3/provider.c:525: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:528: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:537: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:556: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:559: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:583: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c: In function 'zim_oauthprovider_checkOAuthRequest':

/usr/local/php/bin/oauth-1.2.3/provider.c:745: warning: dereferencing type-punned pointer will break strict-aliasing rules

/bin/sh /usr/local/php/bin/oauth-1.2.3/libtool --mode=link cc -DPHP_ATOM_INC -I/usr/local/php/bin/oauth-1.2.3/include -I/usr/local/php/bin/oauth-1.2.3/main -I/usr/local/php/bin/oauth-1.2.3 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2 -Wall -g   -o oauth.la -export-dynamic -avoid-version -prefer-pic -module -rpath /usr/local/php/bin/oauth-1.2.3/modules  oauth.lo provider.lo -lcurl

cc -shared  .libs/oauth.o .libs/provider.o  -lcurl  -Wl,-soname -Wl,oauth.so -o .libs/oauth.so

creating oauth.la

(cd .libs && rm -f oauth.la && ln -s ../oauth.la oauth.la)

/bin/sh /usr/local/php/bin/oauth-1.2.3/libtool --mode=install cp ./oauth.la /usr/local/php/bin/oauth-1.2.3/modules

cp ./.libs/oauth.so /usr/local/php/bin/oauth-1.2.3/modules/oauth.so

cp ./.libs/oauth.lai /usr/local/php/bin/oauth-1.2.3/modules/oauth.la

PATH="$PATH:/sbin" ldconfig -n /usr/local/php/bin/oauth-1.2.3/modules

----------------------------------------------------------------------

Libraries have been installed in:

   /usr/local/php/bin/oauth-1.2.3/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 `LD_LIBRARY_PATH' environment variable

     during execution

   - add LIBDIR to the `LD_RUN_PATH' environment variable

     during linking

   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag

   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

 

See any operating system documentation about shared libraries for

more information, such as the ld(1) and ld.so(8) manual pages.

----------------------------------------------------------------------

 

Build complete.

Don't forget to run 'make test'.

 

Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-zts-20090626/

 

[root@mail oauth-1.2.3]# cd modules/

[root@mail modules]# ls

oauth.so

[root@mail modules]#

 

 

설치가 완료 되면 php.ini 파일에 모듈 위치를 절대 경로로 삽입해주면 됩니다.

extension=/usr/local/php/bin/oauth-1.2.3/modules/oauth.so



- 지메이트시스템즈 이정식 -

'OS > Linux' 카테고리의 다른 글

Clusterssh 설치  (0) 2013.04.22
LVS HA 구성  (0) 2013.04.19
fail2ban  (0) 2013.04.04
GlusterFS  (0) 2013.02.05
rsync를 이용한 미러링  (0) 2013.01.16