728x90

원문을 보고 정리하였습니다.

https://macpaw.com/how-to/remove-anysearch-malware-from-mac

 

How to get rid of Any Search Manager on your Mac

Any Search Manager is a piece of malware that bundles itself with downloads and redirects your browser’s homepage. Here’s how to remove it.

macpaw.com

해당 블로그에서는 아래의 클리너를 추천하고 있습니다.

하지만 무료 평가판이라고 하지만 결국 바이러스 search 하고 나서 발견되어 치료할려고 하면 업그레이드를 유도합니다.

https://macpaw.com/ko/download/cleanmymac

 

CleanMyMac X 평가판 무료 다운로드 — Mac을 위한 스마트한 컴퓨터 클리너

CleanMyMac X를 무려로 내려받으세요. CleanMyMac X는 Mac을 청소하고 보호하며 성능을 올려주는 필수 유틸리티입니다. 매일 사용하여 수 GB의 여유 공간을 확보하고, 악성코드를 제거하며, macOS의 건강상태를 확인하세요. 지금 MacBook이나 iMac에 내려받아 직접 확인해보세요!

macpaw.com

Combo Cleaner 도 사용해봤는데 AntiVirus를 검색하니 3건이 나오네요.

그런데 그런데 역시나 Upgrade to Premium 으로 비용내고 업그레이드 받아서 삭제하라고 뜨네요.

 

Variant.Application.MAC.Adload.8

Variant.Adware.Mac.AdLoad.1

 

해당 파일을 찾아봤는데 전혀 못찾겠어요.

 

 

아래 수동 방식으로 삭제처리하고 나서 다시 CleanMyMac을 돌렸더니 CleanMyMac 에서는 나오지 않네요.


위의 클리너를 사용하지 않고 수동으로 할 수 있는 방법이 있으니 참고하시길 바랍니다.

 


핵심은 Launch Agents 와 Daemons 폴더에 의심되는 프로그램을 삭제해야 합니다.

그치만 해당 폴더에 들어가면 ".plist" 파일이 안보일 수 있습니다.

 

결국 terminal.app (터미널)로 들어가서 보시는게 더 좋습니다.

자 시작합니다.


1. /Libaray/LaunchAgents 살펴보기 

저 같은 경우에는 

cd /Libaray/LaunchAgents 로 이동하여  의심되는 파일을 삭제하였습니다.

 

2. 사용자 의 LaunchAgents 를 살펴보기 

root 의 LaunchAgents 를 살펴보고 의심되는 plist파일을 삭제하였습니다.

그 다음  사용자 의 LaunchAgents 를 살펴봐야 합니다.

 

"jaehonghan" 이라는 사용자 폴더의 Libaray 에서 똑같은 LaunchAgents 폴더를 살펴 봅니다.

다행히도 여기에는 의심되는 내용이 없네요.

 

 

 

 

 

3. 사용자 의 ~/Library/Application\ Support/ 살펴보기 

사용자의 어플레케이션 서포트 폴더로 가서 의심되는 프로그램이 설치되어 있는지 살펴봐야 합니다.

 

cd ~/Library/Application\ Support/

 

저 같은 경우에는 UltraSearchSystem 을 발견하여 삭제하였습니다.

 

4. 구글 브라우저의 설정에서 검색엔진 점검하기

구글 브라우저에서 chrome://settings 로 주소검색을 합니다.

검색엔진이 다른 것으로 변경된게 아니지 확인해봐야 합니다.

저의 경우에는 UltraSearch 라는 엔진으로 변경되어 있었습니다.

그래서 이를 Google검색엔진으로 다시 변경해줬습니다.

 

아래와 같이 검색엔진쪽으로 가보니 이상한 검색엔진이 선택되어 있었습니다.

해서 해당 선택엔진을 Google로 바꿔주기 위해서 "검색엔진 관리" 메뉴로 들어가서 Google을 제외하고 다 지웠습니다

 

저의 경우에는 기본 검색엔진에 Google, yahoo,  naver  가 존재했지만 Google을 빼고 삭제했습니다.

 

Google로 검색엔진을 바꾼 후의 화면입니다.

 

5. 구글 브라우저의 권한이 다른 프로그램에게도 줬는지 확인하기

구글 브라우저에서 chrome://policy 로 주소검색을 합니다.

구글 부라우저가 자신의 권한을 다른 프로그램에게도 줬는지를 파악하기 위해서 입니다.

 

 

 

다행히도 저의 경우에는 다른 프로그램에 넘어가지 않았어요.

하지만 위에서 언급했듯이 다른 프로그램에 구글이 자신의 권한을 넘겨주는 경우가 있기 때문에 꼭 찾아서 삭제해야 한다고 하네요.

 

6. 구글 브라우저에 대해 제대로 설정되어 있는지를 확인하기

defaults read com.google.Chrome

위의 명령어를 command line 에서 직접 타이핑 하시면 

{

    LastRunAppBundlePath = "/Applications/Google Chrome.app";

}

와 같이 뜨는지 확인해 보시길 바랍니다.

 


정  리

 

 

1. 관리자 폴더에 들어가서 의심되는 파일을 삭제합니다.

$ cd /Library/LaunchAgents/

$ cd /Library/LaunchDaemons/

 

2. 사용자 폴더에 들어가서 의심되는 파일을 삭제합니다.

$ cd ~/Library/LaunchAgents/

$ cd ~/Library/LaunchDaemons/

 

3. 어플리케이션 suppert파일로 가서 의심되는 파일을 삭제합니다.

$ cd ~/Library/Application\ Support/

 

4. Chrome 브라우저의 검색엔진중 원하시는 검색엔진을 선택하신 후에 다른 검색엔진은 삭제합니다.

구글 브라우저에서 chrome://settings 로 주소검색을 합니다.

검색엔진이 다른 것으로 변경된게 아니지 확인해봐야 합니다.

저의 경우에는 UltraSearch 라는 엔진으로 변경되어 있었습니다.

그래서 이를 Google검색엔진으로 다시 변경해줬습니다.

 

5. 구글 브라우저의 권한이 다른 프로그램에게도 줬는지 확인하기

구글 브라우저에서 chrome://policy 로 주소검색을 합니다.

구글 부라우저가 자신의 권한을 다른 프로그램에게도 줬는지를 파악하기 위해서 입니다.

 

6. 구글 브라우저에 대해 제대로 설정되어 있는지를 확인합니다.

$ defaults read com.google.Chrome

위의 명령어를 command line 에서 직접 타이핑 하시면 

{

    LastRunAppBundlePath = "/Applications/Google Chrome.app";

}

와 같이 뜨는지 확인해 보시길 바랍니다.

 


아래는 원문 입니다.

확인 해보시기 바랍니다.

 

How do I know if my Mac is infected?

When you launch a web browser like Safari, Chrome, or Firefox you will not see your regular homepage. Instead, you’ll see the Any Search page. You will then need to uninstall Any Search from your Mac, using the steps below.


How did I get infected?

When you give permission to the seemingly legitimate download to be installed, the bundled hijacker gets permission too. That’s why you should always be certain of what you’re downloading and double-check the website you’ve downloaded it from before you give permission for anything to be installed. Fortunately, it’s not too difficult to remove.

 

How to remove Any Search from your Mac

1. Go to the Apple menu and click on System Preferences

2. Look for a pane called Profiles. If it’s there, it will be next to Accessibility

3. If it’s there, click on it and look to see if there is a profile called AdminPrefs

4. If it’s there, unlock System Preferences by clicking the padlock and entering your login details, if necessary

5. Click on the AdminPrefs profile and click the ‘-‘ button at the bottom left of the window

 

Check your Startup items

Malware like the Any Search Manager virus sometimes inserts itself in your startup items so it launches every time you boot your Mac.

1. Go to System Preferences again and click the Users & Groups pane.

2. Unlock it using the padlock, then click on your user name in the left-hand pane.

3. Choose the Login items tab in the main window.

4. Look for anything that seems suspicious.

5. If you find anything, click on it then click the ‘-‘ button at the bottom of the window to remove it.

Alternatively, there is an easier way to remove login items, using CleanMyMac, which scans your Mac for startup processes and allows you to remove them with one click. CleanMyMac also allows you to quickly and easily remove browser extensions, uninstall apps, and reclaim tens of gigabytes of disk space.

 

Get CleanMyMac here. It's a free version that allows you to remove a few login items completely for free.

 

Remove Launch Agents and Daemons

1. In the Finder, click on the Go menu and choose Go to Folder.

 

2. Type /Library/LaunchDaemons

3. Scan the list of .plist files and look for anything with a name you don’t recognize.

4. If you find one, click on it and preview the file, looking for the name of a vendor you recognize.

5. If you don’t find one, drag the file to the Trash.

6. Repeat steps 1-5 for /Library/LaunchAgents and
~/Library/LaunchAgents

7. Once you’ve dragged all the files you want to remove to the Trash, empty it and restart your Mac.

 

Reset the default page in browser

How to remove Any Search from Safari

1. Once your Mac has restarted, launch Safari

2. Click on the Safari menu and then choose Preferences

3. Click on the Search tab and choose the search engine you want to use

4. Select the General tab and set the Homepage to your preferred home page and the options above it to your preference from the menu options

 

How to remove Any Search from Chrome

1. Launch Chrome.

2. Click the Settings menu icon (three horizontal lines) on the left of the window or type chrome://settings/  into the address bar.

3. Click On start-up and check the button next to “Open a specific page or set of pages”.

4. Click on the More icon (three vertical dots).

5. Choose Edit and type or paste the URL you want as your start-up page into the text box.

6. Click Save.

7. Click on the Settings icon again.

8. Choose Search Engine.

9. Click Manage search engines and press the More button next to the Any Search engine, then select Remove from list.

 

10. Click on the dropdown menu next to the “Search engine used in the address bar” and choose the search engine you want to use. Alternatively, click Manage search engines and either add one from the bigger list (by clicking on the More icon and choosing Make Default) or press Add and type in the URL of another search engine.

 

 

How to remove AnySearch from Firefox

1. Launch Firefox.

2. Press the settings button (three horizontal lines) on the right-hand side of the toolbar, or type about:preferences into the address bar.

3. Click the Home category and next to “Homepage and new windows” click on the dropdown menu and choose either Firefox Home or Custom URL. If you choose the Custom URL type the URL you want to open into the text box.

4. Click the Search category and in the main window, scroll down to “One-Click Search Engines”. Click on Any Search and press Remove.

5. Scroll back up and click on the menu under the Default Search engine and choose the one you want.

 

Remove suspicious browser extensions

 

The final steps for removal [Important]

So far we've cleaned the browser part — what's left is it to root out AnySearch from your system parts associated with Chrome and other browsers. First, we will need to check if AnySearch has seized your Chrome settings. 

 

 

STEP 1

Please open Chrome, paste this string into the URL field and press Return: chrome://policy/

You will see something like this:


See the Level and Policy value columns. What's written there?

"Recommended" means AnySearch has gained control over your Chrome settings — need to uninstall Chrome.

"Mandatory" means the malware is sitting deeper and is tied to your user account
— go to step 2 below.

For additional check:

Go to Applications/Terminal
Open Terminal, paste the following command and press Return:
defaults read com.google.Chrome

Now, look through the results. If you see anything related to Anysearch there, you can simply uninstall Chrome and reinstall it anew. The best way to uninstall Chrome along with all leftovers is CleanMyMac's Uninstaller tool.


STEP 2

If that is not the case, please open Finder, go up to the Go menu in the menubar -> Go to Folder, and paste this directory:
/Library/Managed Preferences/[your username]

You should enter [your username] as shown in System Preferences/Users & Groups

Open the folder. Now look for a “com.google.Chrome” file there. 

If you have found it in any of these locations, please open the file in any editor and check if you can find any Anysearch-related information there. Then, manually remove the info from the file and restart your computer.

The same logic applies to Firefox and Safari browsers. 

 
728x90

mcrypt.so 확장 모듈 추가하기

 

이것은 CBC에서 DES, TripleDES, Blowfish (기본값), 3-WAY, SAFER-SK64, SAFER-SK128, TWOFISH, TEA, RC2 및 GOST와 같은 다양한 블록 알고리즘을 지원하는 암호화 모듈입니다.

또한 "무료"로 사용할 수 있었던 RC6 및 IDEA를 지원합니다.

CFB / OFB는 기본적으로 8 비트입니다.

즉, mcrypt_encrypt함수를 통해 php의 양방향 암호화를 진행할 수 있는 모듈입니다

 


이 기능은 PHP 7.1.0에서 더 이상 사용되지 않으며 PHP 7.2.0에서 제거되었습니다.
이 기능의 대안으로 아래와 같은 것을 사용할 수 있습니다.
- Sodium (PHP 7.2.0 부터 사용가능)
- OpenSSL


 

들어가기전...

PHP를 소스(Source)로 설치한 경우 입니다.

PHP-5.3.9 버전을 기준으로 설명합니다.

PHP-5.3.9 압축파일을 /usr/local/src 폴더에서 풀어놓고 설치를 하였습니다.

/usr/local/src/php-5.3.29/ 입니다.

설치한 폴더 옵션인 prefix는 /usr/local/php 로 해뒀습니다.

/usr/local/php 에 설치가 되어 있습니다.

 

mongo.so 확장모듈을 설치하기 위해서는 pecl 툴을 사용합니다.

 


-- 설치된 폴더 이동

cd /usr/local/src/php-5.3.29/ext

 

-- /usr/local/php/bin/phpize 명령어 에러 발생!!

libmcrypt 라이브러리에서 mcrypt.h 가 없다는 에러가 발생하면서 컴파일이 안되는 경우 발생

configure: error: mcrypt.h not found. Please reinstall libmcrypt.

 

[root@national-pension-contents mcrypt]# /usr/local/php/bin/phpize 
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
configure.in:3: warning: prefer named diversions
configure.in:3: warning: prefer named diversions
[root@national-pension-contents mcrypt]# ./configure --with-php-config=/usr/local/php/bin/php-config 
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
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 ISO C89... 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... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-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 mcrypt support... yes, shared
configure: error: mcrypt.h not found. Please reinstall libmcrypt.

 

-- Please reinstall libmcrypt. 발생시 libmcrypt  라이브러리 설치

1. yum 설치 방법 

# yum list php-mcrypt

# yum install php-mcrypt

 

 

2. mcrypt 모듈 다운로드 소스 설치 방법

가. 소스 다운로드 https://ko.osdn.net/projects/sfnet_mcrypt/downloads/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz/

 

나. 설치하기 
# tar zxf libmcrypt-2.5.8.tar.gz 
# cd libmcrypt-2.5.8/

#  ./configure --prefix=/usr/local/
# make && make check && make install

 

libmcrypt-2.5.8.tar.gz  libssh2-1.8.1.tar.gz    
[root@national-pension-contents src]# tar zxf libmcrypt-2.5.8.tar.gz 
[root@national-pension-contents src]# cd libmcrypt-2.5.8/
[root@national-pension-contents libmcrypt-2.5.8]# ls
acinclude.m4    buildconf     config.log     COPYING.LIB  install-sh      libmcrypt.spec.in  Makefile.in    README
aclocal.m4      ChangeLog     config.status  depcomp      KNOWN-BUGS      libtool            missing        src
AUTHORS         config.guess  config.sub     doc          lib             ltmain.sh          mkinstalldirs  stamp-h1
autom4te.cache  config.h      configure      include      libltdl         Makefile           modules        THANKS
autoscan.log    config.h.in   configure.in   INSTALL      libmcrypt.spec  Makefile.am        NEWS           TODO
[root@national-pension-contents libmcrypt-2.5.8]# ./configure --prefix=/usr/local/


..............

*** Dynamic loading has been disabled
checking which algorithms to include into library... cbc cfb ctr ecb ncfb nofb ofb stream threeway cast-128 gost rijndael-128 safer-sk64 twofish  arcfour cast-256 loki97 rijndael-192 saferplus wake  blowfish-compat des rijndael-256 serpent xtea  blowfish enigma rc2 safer-sk128 tripledes
checking for dirent.h that defines DIR... yes
checking for library containing opendir... none required

..............


config.status: creating modules/Makefile
config.status: creating modules/modes/Makefile
config.status: creating modules/algorithms/Makefile
config.status: creating lib/libmcrypt-config
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing default-1 commands




[root@national-pension-contents libmcrypt-2.5.8]# make && make check && make install


............



/bin/install -c .libs/libmcrypt.lai /usr/local//lib/libmcrypt.la
PATH="$PATH:/sbin" ldconfig -n /usr/local//lib
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local//lib

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.
----------------------------------------------------------------------
test -z "/usr/local//share/aclocal" || mkdir -p -- "/usr/local//share/aclocal"
 /bin/install -c -m 644 'libmcrypt.m4' '/usr/local//share/aclocal/libmcrypt.m4'
make[2]: Leaving directory `/usr/local/src/libmcrypt-2.5.8/lib'
make[1]: Leaving directory `/usr/local/src/libmcrypt-2.5.8/lib'
Making install in src
make[1]: Entering directory `/usr/local/src/libmcrypt-2.5.8/src'
make[2]: Entering directory `/usr/local/src/libmcrypt-2.5.8/src'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/usr/local/src/libmcrypt-2.5.8/src'
make[1]: Leaving directory `/usr/local/src/libmcrypt-2.5.8/src'
Making install in doc
make[1]: Entering directory `/usr/local/src/libmcrypt-2.5.8/doc'
make[2]: Entering directory `/usr/local/src/libmcrypt-2.5.8/doc'
make[2]: Nothing to be done for `install-exec-am'.
test -z "/usr/local//man/man3" || mkdir -p -- "/usr/local//man/man3"
 /bin/install -c -m 644 './mcrypt.3' '/usr/local//man/man3/mcrypt.3'
make[2]: Leaving directory `/usr/local/src/libmcrypt-2.5.8/doc'
make[1]: Leaving directory `/usr/local/src/libmcrypt-2.5.8/doc'
make[1]: Entering directory `/usr/local/src/libmcrypt-2.5.8'
make[2]: Entering directory `/usr/local/src/libmcrypt-2.5.8'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/usr/local/src/libmcrypt-2.5.8'
make[1]: Leaving directory `/usr/local/src/libmcrypt-2.5.8'

 

 

-- ./configure --with-php-config=/usr/local/php/bin/php-config  재실행

#./configure --with-php-config=/usr/local/php/bin/php-config

# make && make install

 

[root@national-pension-contents libmcrypt-2.5.8]# ls
acinclude.m4    buildconf     config.log     COPYING.LIB  install-sh      libmcrypt.spec.in  Makefile.in    README
aclocal.m4      ChangeLog     config.status  depcomp      KNOWN-BUGS      libtool            missing        src
AUTHORS         config.guess  config.sub     doc          lib             ltmain.sh          mkinstalldirs  stamp-h1
autom4te.cache  config.h      configure      include      libltdl         Makefile           modules        THANKS
autoscan.log    config.h.in   configure.in   INSTALL      libmcrypt.spec  Makefile.am        NEWS           TODO
[root@national-pension-contents libmcrypt-2.5.8]# pwd
/usr/local/src/libmcrypt-2.5.8
[root@national-pension-contents libmcrypt-2.5.8]# cd ../php-5.3.29/ext/mcrypt/
[root@national-pension-contents mcrypt]# ./configure --with-php-config=/usr/local/php/bin/php-config 
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
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 ISO C89... 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... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-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 mcrypt support... yes, shared
checking for libmcrypt version... >= 2.5.6
checking for mcrypt_module_open in -lmcrypt... no
checking for mcrypt_module_open in -lmcrypt... yes
checking for ld used by cc... /bin/ld
checking if the linker (/bin/ld) is GNU ld... yes
checking for /bin/ld option to reload object files... -r
checking for BSD-compatible nm... /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... 1572864
checking command to parse /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... no
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/bin/ld -m elf_x86_64) 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@national-pension-contents mcrypt]# make && make install
/bin/sh /usr/local/src/php-5.3.29/ext/mcrypt/libtool --mode=compile cc  -I. -I/usr/local/src/php-5.3.29/ext/mcrypt -DPHP_ATOM_INC -I/usr/local/src/php-5.3.29/ext/mcrypt/include -I/usr/local/src/php-5.3.29/ext/mcrypt/main -I/usr/local/src/php-5.3.29/ext/mcrypt -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 -I/usr/local/include  -DHAVE_CONFIG_H  -g -O2   -c /usr/local/src/php-5.3.29/ext/mcrypt/mcrypt.c -o mcrypt.lo 
mkdir .libs
 cc -I. -I/usr/local/src/php-5.3.29/ext/mcrypt -DPHP_ATOM_INC -I/usr/local/src/php-5.3.29/ext/mcrypt/include -I/usr/local/src/php-5.3.29/ext/mcrypt/main -I/usr/local/src/php-5.3.29/ext/mcrypt -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 -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/php-5.3.29/ext/mcrypt/mcrypt.c  -fPIC -DPIC -o .libs/mcrypt.o
/bin/sh /usr/local/src/php-5.3.29/ext/mcrypt/libtool --mode=compile cc  -I. -I/usr/local/src/php-5.3.29/ext/mcrypt -DPHP_ATOM_INC -I/usr/local/src/php-5.3.29/ext/mcrypt/include -I/usr/local/src/php-5.3.29/ext/mcrypt/main -I/usr/local/src/php-5.3.29/ext/mcrypt -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 -I/usr/local/include  -DHAVE_CONFIG_H  -g -O2   -c /usr/local/src/php-5.3.29/ext/mcrypt/mcrypt_filter.c -o mcrypt_filter.lo 
 cc -I. -I/usr/local/src/php-5.3.29/ext/mcrypt -DPHP_ATOM_INC -I/usr/local/src/php-5.3.29/ext/mcrypt/include -I/usr/local/src/php-5.3.29/ext/mcrypt/main -I/usr/local/src/php-5.3.29/ext/mcrypt -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 -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/php-5.3.29/ext/mcrypt/mcrypt_filter.c  -fPIC -DPIC -o .libs/mcrypt_filter.o
/usr/local/src/php-5.3.29/ext/mcrypt/mcrypt_filter.c: In function ‘php_mcrypt_filter_create’:
/usr/local/src/php-5.3.29/ext/mcrypt/mcrypt_filter.c:210:2: warning: passing argument 1 of ‘mcrypt_module_open’ discards ‘const’ qualifier from pointer target type [enabled by default]
  mcrypt_module = mcrypt_module_open(cipher, algo_dir, mode, mode_dir);
  ^
In file included from /usr/local/include/mcrypt.h:4:0,
                 from /usr/local/src/php-5.3.29/ext/mcrypt/mcrypt_filter.c:25:
/usr/local/include/mutils/mcrypt.h:38:9: note: expected ‘char *’ but argument is of type ‘const char *’
  MCRYPT mcrypt_module_open(char *algorithm,
         ^
/bin/sh /usr/local/src/php-5.3.29/ext/mcrypt/libtool --mode=link cc -DPHP_ATOM_INC -I/usr/local/src/php-5.3.29/ext/mcrypt/include -I/usr/local/src/php-5.3.29/ext/mcrypt/main -I/usr/local/src/php-5.3.29/ext/mcrypt -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 -I/usr/local/include  -DHAVE_CONFIG_H  -g -O2   -o mcrypt.la -export-dynamic -avoid-version -prefer-pic -module -rpath /usr/local/src/php-5.3.29/ext/mcrypt/modules  mcrypt.lo mcrypt_filter.lo -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lmcrypt
cc -shared  .libs/mcrypt.o .libs/mcrypt_filter.o  -Wl,--rpath -Wl,/usr/local//lib -Wl,--rpath -Wl,/usr/local//lib -L/usr/local/lib /usr/local//lib/libmcrypt.so  -Wl,-rpath -Wl,/usr/local/lib -Wl,-soname -Wl,mcrypt.so -o .libs/mcrypt.so
creating mcrypt.la
(cd .libs && rm -f mcrypt.la && ln -s ../mcrypt.la mcrypt.la)
/bin/sh /usr/local/src/php-5.3.29/ext/mcrypt/libtool --mode=install cp ./mcrypt.la /usr/local/src/php-5.3.29/ext/mcrypt/modules
cp ./.libs/mcrypt.so /usr/local/src/php-5.3.29/ext/mcrypt/modules/mcrypt.so
cp ./.libs/mcrypt.lai /usr/local/src/php-5.3.29/ext/mcrypt/modules/mcrypt.la
PATH="$PATH:/sbin" ldconfig -n /usr/local/src/php-5.3.29/ext/mcrypt/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/src/php-5.3.29/ext/mcrypt/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/

 

'/usr/local/php/lib/php/extensions/no-debug-zts-20090626/'에 보시면 mcrypt.so 파일이 보일 겁니다.

[root@national-pension-contents mcrypt]# ll  /usr/local/php/lib/php/extensions/no-debug-zts-20090626/
total 2728
-rwxr-xr-x 1 root root  159329 Feb 28 15:26 mcrypt.so
-rwxr-xr-x 1 root root 1949145 Feb 28 14:37 mongo.so
-rwxr-xr-x 1 root root  107970 Feb 28 14:36 pcntl.so
-rwxr-xr-x 1 root root  570358 Feb 28 14:56 zip.so
[root@national-pension-contents mcrypt]# 

 

그냥 아래 내용을 긁어서 사용하세요.

# libmcrypt 소스 파일 설치 

wget https://ko.osdn.net/projects/sfnet_mcrypt/downloads/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz/
tar zxf libmcrypt-2.5.8.tar.gz 
cd libmcrypt-2.5.8/
./configure --prefix=/usr/local/
make && make check && make install


#mcrypts.so확장 모듈 설치

cd /usr/local/src/php-5.3.29/ext/mcrypt
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
728x90

pcntl.so 확장 모듈 추가하기

 

 

pcntl 은 PHP가 지원하는 프로세스 제어 함수로 Unix 형식의 프로세스 생성, 프로세스 실행, 신호 처리, 프로세스 종료 기능을 구현하고 있습니다. 

웹 서버 환경에서 프로세스 제어를 사용하지 않아야 하며 웹 서버 환경에서 프로세스 제어 기능을 사용하면 예기치 않은 결과가 발생할 수 있습니다.

현재 PCNTL는 신호 처리 콜백 메커니즘으로 ticks를 사용하고 있고,
"user ticks"를 사용하는 것과 같은 것입니다.

declare()를 사용하여 프로그램에서 콜백의 발생을 허용하는 위치를 지정해야합니다.

따라서 비동기 이벤트를 처리하는 오버 헤드를 최소화하는 것이 가능합니다.

이전에는 pcntl를 사용하여 PHP를 컴파일하면 pcntl의 사용 여부에 관계없이 항상이 오버 헤드의 피해를 입을 수 있습니다.


 

들어가기전...

PHP를 소스(Source)로 설치한 경우 입니다.

PHP-5.3.9 버전을 기준으로 설명합니다.

PHP-5.3.9 압축파일을 /usr/local/src 폴더에서 풀어놓고 설치를 하였습니다.

/usr/local/src/php-5.3.29/ 입니다.

설치한 폴더 옵션인 prefix는 /usr/local/php 로 해뒀습니다.

/usr/local/php 에 설치가 되어 있습니다.


 

-- PHP 소스 설치 폴더로 이동 ..

#cd /usr/local/src/php-소스폴더/ext

 

-- phpize 로 확장모듈 configure 파일 생성

# /usr/local/php/bin/phpize 

[root@national-pension-contents php-5.3.29]# cd ext/
[root@national-pension-contents ext]# ls
bcmath      dom                 ftp        intl      mysqli   pdo_dblib     phar        simplexml  standard   xml
bz2         enchant             gd         json      mysqlnd  pdo_firebird  posix       skeleton   sybase_ct  xmlreader
calendar    ereg                gettext    ldap      oci8     pdo_mysql     pspell      snmp       sysvmsg    xmlrpc
com_dotnet  exif                gmp        libxml    odbc     pdo_oci       readline    soap       sysvsem    xmlwriter
ctype       ext_skel            hash       mbstring  openssl  pdo_odbc      recode      sockets    sysvshm    xsl
curl        ext_skel_win32.php  iconv      mcrypt    pcntl    pdo_pgsql     reflection  spl        tidy       zip
date        fileinfo            imap       mssql     pcre     pdo_sqlite    session     sqlite     tokenizer  zlib
dba         filter              interbase  mysql     pdo      pgsql         shmop       sqlite3    wddx
[root@national-pension-contents ext]# 
[root@national-pension-contents ext]# cd pcntl/
[root@national-pension-contents pcntl]# ls
config.m4  CREDITS  package.xml  pcntl.c  php_pcntl.h  php_signal.c  php_signal.h  README  test-pcntl.php  tests

[root@national-pension-contents pcntl]# 
[root@national-pension-contents pcntl]#  /usr/local/php/bin/phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
configure.in:3: warning: prefer named diversions
configure.in:3: warning: prefer named diversions

[root@national-pension-contents pcntl]# ls
acinclude.m4    config.guess  configure     ltmain.sh        package.xml   php_signal.h    tests
aclocal.m4      config.h.in   configure.in  Makefile.global  pcntl.c       README
autom4te.cache  config.m4     CREDITS       missing          php_pcntl.h   run-tests.php
build           config.sub    install-sh    mkinstalldirs    php_signal.c  test-pcntl.php


[root@national-pension-contents pcntl]# ./configure 
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
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 ISO C89... 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... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
configure: error: Cannot find php-config. Please use --with-php-config=PATH

 

-- configure 실행시 에러 발생

#./configure 

.......

Please use --with-php-config=PATH

 

-- PHP 소스를 /usr/local/php에 설치하셨다면 아래와 같이 ...

# ./configure --with-php-config=/usr/local/php/bin/php-config

[root@national-pension-contents pcntl]# ./configure --with-php-config=/usr/local/php/bin/php-config
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
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 ISO C89... 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... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-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 whether to enable pcntl support... yes, shared
checking for fork... yes
checking for waitpid... yes
checking for sigaction... yes
checking for getpriority... yes
checking for setpriority... yes
checking for wait3... yes
checking for sigprocmask... yes
checking for sigwaitinfo... yes
checking for sigtimedwait... yes
checking for ld used by cc... /bin/ld
checking if the linker (/bin/ld) is GNU ld... yes
checking for /bin/ld option to reload object files... -r
checking for BSD-compatible nm... /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... 1572864
checking command to parse /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... no
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/bin/ld -m elf_x86_64) 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

 

-- make && make install 하기

# make && make install

[root@national-pension-contents pcntl]# make && make install
/bin/sh /usr/local/src/php-5.3.29/ext/pcntl/libtool --mode=compile cc  -I. -I/usr/local/src/php-5.3.29/ext/pcntl -DPHP_ATOM_INC -I/usr/local/src/php-5.3.29/ext/pcntl/include -I/usr/local/src/php-5.3.29/ext/pcntl/main -I/usr/local/src/php-5.3.29/ext/pcntl -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   -c /usr/local/src/php-5.3.29/ext/pcntl/pcntl.c -o pcntl.lo 
mkdir .libs
 cc -I. -I/usr/local/src/php-5.3.29/ext/pcntl -DPHP_ATOM_INC -I/usr/local/src/php-5.3.29/ext/pcntl/include -I/usr/local/src/php-5.3.29/ext/pcntl/main -I/usr/local/src/php-5.3.29/ext/pcntl -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 -c /usr/local/src/php-5.3.29/ext/pcntl/pcntl.c  -fPIC -DPIC -o .libs/pcntl.o
/bin/sh /usr/local/src/php-5.3.29/ext/pcntl/libtool --mode=compile cc  -I. -I/usr/local/src/php-5.3.29/ext/pcntl -DPHP_ATOM_INC -I/usr/local/src/php-5.3.29/ext/pcntl/include -I/usr/local/src/php-5.3.29/ext/pcntl/main -I/usr/local/src/php-5.3.29/ext/pcntl -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   -c /usr/local/src/php-5.3.29/ext/pcntl/php_signal.c -o php_signal.lo 
 cc -I. -I/usr/local/src/php-5.3.29/ext/pcntl -DPHP_ATOM_INC -I/usr/local/src/php-5.3.29/ext/pcntl/include -I/usr/local/src/php-5.3.29/ext/pcntl/main -I/usr/local/src/php-5.3.29/ext/pcntl -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 -c /usr/local/src/php-5.3.29/ext/pcntl/php_signal.c  -fPIC -DPIC -o .libs/php_signal.o
/bin/sh /usr/local/src/php-5.3.29/ext/pcntl/libtool --mode=link cc -DPHP_ATOM_INC -I/usr/local/src/php-5.3.29/ext/pcntl/include -I/usr/local/src/php-5.3.29/ext/pcntl/main -I/usr/local/src/php-5.3.29/ext/pcntl -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   -o pcntl.la -export-dynamic -avoid-version -prefer-pic -module -rpath /usr/local/src/php-5.3.29/ext/pcntl/modules  pcntl.lo php_signal.lo 
cc -shared  .libs/pcntl.o .libs/php_signal.o   -Wl,-soname -Wl,pcntl.so -o .libs/pcntl.so
creating pcntl.la
(cd .libs && rm -f pcntl.la && ln -s ../pcntl.la pcntl.la)
/bin/sh /usr/local/src/php-5.3.29/ext/pcntl/libtool --mode=install cp ./pcntl.la /usr/local/src/php-5.3.29/ext/pcntl/modules
cp ./.libs/pcntl.so /usr/local/src/php-5.3.29/ext/pcntl/modules/pcntl.so
cp ./.libs/pcntl.lai /usr/local/src/php-5.3.29/ext/pcntl/modules/pcntl.la
PATH="$PATH:/sbin" ldconfig -n /usr/local/src/php-5.3.29/ext/pcntl/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/src/php-5.3.29/ext/pcntl/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/

아래의 폴더에 pcntl.so 파일이 있습니다.

/usr/local/php/lib/php/extensions/no-debug-zts-20090626/

 

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

 

 


[root@national-pension-contents zip]# cd /usr/local/php/lib/php/extensions/no-debug-zts-20090626/

[root@national-pension-contents no-debug-zts-20090626]# ll

total 2572

-rw-r--r-- 1 root root 1949145 Feb 28 14:37 mongo.so

-rwxr-xr-x 1 root root  107970 Feb 28 14:36 pcntl.so

-rwxr-xr-x 1 root root  570358 Feb 28 14:56 zip.so

 

혹시 실행권한이 없다면 chmod 755로 실행권을 주시길 바랍니다.

[root@national-pension-contents no-debug-zts-20090626]# chmod 755 *

[root@national-pension-contents no-debug-zts-20090626]# ll

total 2572

-rwxr-xr-x 1 root root 1949145 Feb 28 14:37 mongo.so

-rwxr-xr-x 1 root root  107970 Feb 28 14:36 pcntl.so

-rwxr-xr-x 1 root root  570358 Feb 28 14:56 zip.so

 

 

아래는 해당 extension할 모듈을 설치하기 위한 스크립트 입니다.

/usr/local/php/bin/phpize 
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
cd /usr/local/php/lib/php/extensions/no-debug-zts-20090626/
chmod 755 *

 

728x90

mongo.so 확장 모듈 추가하기

 

mongo.so 는 php에서 mongoDB를 커넥트 해서 사용하기 위한 모듈입니다.

mongoDB를 사용하겠다고 하시면 mongo.so 확장 모듈을 설치하셔야 합니다.

 

들어가기전...

PHP를 소스(Source)로 설치한 경우 입니다.

PHP-5.3.9 버전을 기준으로 설명합니다.

PHP-5.3.9 압축파일을 /usr/local/src 폴더에서 풀어놓고 설치를 하였습니다.

/usr/local/src/php-5.3.29/ 입니다.

설치한 폴더 옵션인 prefix는 /usr/local/php 로 해뒀습니다.

/usr/local/php 에 설치가 되어 있습니다.

 

mongo.so 확장모듈을 설치하기 위해서는 pecl 툴을 사용합니다.

 


-- 설치된 폴더 이동

cd /usr/local/php/bin/

[root@national-pension-contents bin]# ls
pear  peardev  pecl  phar  phar.phar  php  php-config  phpize

 

-- pecl install mongo 명령어로 mongo.so 확장모듈 설치

[root@national-pension-contents bin]# pecl install mongo
-bash: pecl: command not found
[root@national-pension-contents bin]# ./pecl install mongo

[root@national-pension-contents pcntl]# cd /usr/local/php/bin/
[root@national-pension-contents bin]# ls
pear  peardev  pecl  phar  phar.phar  php  php-config  phpize


[root@national-pension-contents bin]#  pecl install mongo
-bash: pecl: command not found

[root@national-pension-contents bin]# ./pecl install mongo
WARNING: "pecl/mongo" is deprecated in favor of "channel:///mongodb"
downloading mongo-1.6.16.tgz ...
Starting to download mongo-1.6.16.tgz (210,341 bytes)
.............................................done: 210,341 bytes
118 source files, building
running: phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
configure.in:3: warning: prefer named diversions
configure.in:3: warning: prefer named diversions
Build with Cyrus SASL (MongoDB Enterprise Authentication) support? [no] : 
building in /tmp/pear/temp/pear-build-root6il05e/mongo-1.6.16
running: /tmp/pear/temp/mongo/configure --with-mongo-sasl=no
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
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 ISO C89... 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... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-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 whether to enable Mongo extension... yes, shared
checking Build with OpenSSL support... yes
checking for pkg-config... /bin/pkg-config
checking whether byte ordering is bigendian... no
checking whether to include code coverage symbols... no
checking Build with Cyrus SASL support... no
checking for ld used by cc... /bin/ld
checking if the linker (/bin/ld) is GNU ld... yes
checking for /bin/ld option to reload object files... -r
checking for BSD-compatible nm... /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... 1572864
checking command to parse /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... no
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/bin/ld -m elf_x86_64) 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
running: make
/bin/sh /tmp/pear/temp/pear-build-root6il05e/mongo-1.6.16/libtool --mode=compile cc -I./util -I. -I/tmp/pear/temp/mongo -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-root6il05e/mongo-1.6.16/include -I/tmp/pear/temp/pear-build-root6il05e/mongo-1.6.16/main -I/tmp/pear/temp/mongo -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 -I/tmp/pear/temp/pear-build-root6il05e/mongo-1.6.16/api -I/tmp/pear/temp/mongo/api -I/tmp/pear/temp/pear-build-root6il05e/mongo-1.6.16/util -I/tmp/pear/temp/mongo/util -I/tmp/pear/temp/pear-build-root6il05e/mongo-1.6.16/exceptions -I/tmp/pear/temp/mongo/exceptions -I/tmp/pear/temp/pear-build-root6il05e/mongo-1.6.16/gridfs -I/tmp/pear/temp/mongo/gridfs -I/tmp/pear/temp/pear-build-root6il05e/mongo-1.6.16/types -I/tmp/pear/temp/mongo/types -I/tmp/pear/temp/pear-build-root6il05e/mongo-1.6.16/batch -I/tmp/pear/temp/mongo/batch -I/tmp/pear/te
mp/pear-build-root6il05e/mongo-1.6.16/contrib -I/tmp/pear/temp/mongo/contrib -I/tmp/pear/temp/pear-build-root6il05e/mongo-1.6.16/mcon -I/tmp/pear/temp/mongo/mcon -I/tmp/pear/temp/pear-build-root6il05e/mongo-1.6.16/mcon/contrib -I/tmp/pear/temp/mongo/mcon/contrib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/mongo/php_mongo.c -o php_mongo.lo
mkdir .libs


................



(cd .libs && rm -f mongo.la && ln -s ../mongo.la mongo.la)
/bin/sh /tmp/pear/temp/pear-build-root6il05e/mongo-1.6.16/libtool --mode=install cp ./mongo.la /tmp/pear/temp/pear-build-root6il05e/mongo-1.6.16/modules
cp ./.libs/mongo.so /tmp/pear/temp/pear-build-root6il05e/mongo-1.6.16/modules/mongo.so
cp ./.libs/mongo.lai /tmp/pear/temp/pear-build-root6il05e/mongo-1.6.16/modules/mongo.la
PATH="$PATH:/sbin" ldconfig -n /tmp/pear/temp/pear-build-root6il05e/mongo-1.6.16/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /tmp/pear/temp/pear-build-root6il05e/mongo-1.6.16/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'.

running: make INSTALL_ROOT="/tmp/pear/temp/pear-build-root6il05e/install-mongo-1.6.16" install
Installing shared extensions:     /tmp/pear/temp/pear-build-root6il05e/install-mongo-1.6.16/usr/local/php/lib/php/extensions/no-debug-zts-20090626/
running: find "/tmp/pear/temp/pear-build-root6il05e/install-mongo-1.6.16" | xargs ls -dils
  4553477    0 drwxr-xr-x 3 root root      16 Feb 28 14:37 /tmp/pear/temp/pear-build-root6il05e/install-mongo-1.6.16
  4553502    0 drwxr-xr-x 3 root root      18 Feb 28 14:37 /tmp/pear/temp/pear-build-root6il05e/install-mongo-1.6.16/usr
 76481663    0 drwxr-xr-x 3 root root      16 Feb 28 14:37 /tmp/pear/temp/pear-build-root6il05e/install-mongo-1.6.16/usr/local
140750308    0 drwxr-xr-x 3 root root      16 Feb 28 14:37 /tmp/pear/temp/pear-build-root6il05e/install-mongo-1.6.16/usr/local/php
209205010    0 drwxr-xr-x 3 root root      16 Feb 28 14:37 /tmp/pear/temp/pear-build-root6il05e/install-mongo-1.6.16/usr/local/php/lib
  4553503    0 drwxr-xr-x 3 root root      23 Feb 28 14:37 /tmp/pear/temp/pear-build-root6il05e/install-mongo-1.6.16/usr/local/php/lib/php
 76481664    0 drwxr-xr-x 3 root root      34 Feb 28 14:37 /tmp/pear/temp/pear-build-root6il05e/install-mongo-1.6.16/usr/local/php/lib/php/extensions
140750309    0 drwxr-xr-x 2 root root      21 Feb 28 14:37 /tmp/pear/temp/pear-build-root6il05e/install-mongo-1.6.16/usr/local/php/lib/php/extensions/no-debug-zts-20090626
140750311 1904 -rwxr-xr-x 1 root root 1949145 Feb 28 14:37 /tmp/pear/temp/pear-build-root6il05e/install-mongo-1.6.16/usr/local/php/lib/php/extensions/no-debug-zts-20090626/mongo.so

Build process completed successfully
Installing '/usr/local/php/lib/php/extensions/no-debug-zts-20090626/mongo.so'
install ok: channel://pecl.php.net/mongo-1.6.16
configuration option "php_ini" is not set to php.ini location
You should add "extension=mongo.so" to php.ini

 

-- 성공적으로 추가되었다면 

'/usr/local/php/lib/php/extensions/no-debug-zts-20090626/mongo.so'에 설치되어 있습니다.

그리고 php.ini 파일에 "extension=mongo.so" 을 추가해주면 됩니다.

Build process completed successfully
Installing '/usr/local/php/lib/php/extensions/no-debug-zts-20090626/mongo.so'
install ok: channel://pecl.php.net/mongo-1.6.16
configuration option "php_ini" is not set to php.ini location
You should add "extension=mongo.so" to php.ini

 

그냥 아래 내용을 긁어서 사용하세요.

cd /usr/local/php/bin/

ls

./pecl install mongo

 

728x90

https://developers.google.com/youtube/reporting

 

Introduction  |  YouTube Analytics and Reporting APIs

This document explains similarities and differences in the ways that the YouTube Analytics API and YouTube Reporting API provide access to YouTube Analytics data. The document's purpose is to help you to choose the right API for your application. Both APIs

developers.google.com

 

이 문서는 Youtube Analytics API와 Youtube Reporting API가 제공하는 Youtube Analytics Data에 대한 유사성과 차이점을 설명하는 문서입니다.

이 문서의 목적은 당신의 어플리케이션에 맞는 올바른 API를 선택하게 하기 위한 것입니다.

두 APIs는 YouTube Analytics data를 가져올 수 있게 개발되어져 있습니다.

또한 두  APIs는 YouTube Cannel 소유자와 Youtube content 소유자에게 각자 특정 set의 리포트에 엑세스 할 수 있습니다.

   

  • Channel reports 는 특정 채널에 대한 user activity metrics 을 포함하고 있습니다.

  • Content owner reports 는 특정 Youtube Contents 소유자에게 연결된 모든 채널에 대한 집계 metrics 를 포함하고 있습니다. 예를 들어, 어떤 레코드 라벨은 이 라벨 가지고 있는 아티스트들의 모든 YouTube channels에 대한 리포트를 검색할 수 있습니다. 일부 콘텐츠 소유자 보고서에는 사용자 활동 통계가 포함되 다른 콘텐츠 소유자 보고서에는 수익 및 광고실적 관련 통계가 포함되기도 합니다.

The Reporting API는 몇몇 컨텐츠 소유자에게 system-managed ad 수익 리포트에 엑세스 할 수 있도록 허용하고 있습니다.

이  system-managed reports 데이터는 Reporting API 에서 단지 검색만 할 수 있습니다.

그리고 모든 YouTube Analytics 와 YouTube Reporting API는 channel 또는 content 소유자가 가지고 있는 데이터를 요구할때 이들의 인증이 반드시 필요합니다.

 

 

Report 내용

API가 검색하는 리포트에는 2가지 타입의 데이터를 포함하고 있습니다.

  • Dimensions 는 집계데이터에 이용하기 위한, user가 활동한 date 나 user가 위치해 있었던 국가 같은 일반기준입니다.

    리포트에서, 각 data의 row 는 수치가 결합된 고유한 형태입니다.  따라서, 각 rows의 수치 값의 조합은 해당 rows에 대해 primary key 의 기능을 합니다.

  • Metrics 는 user activity 의 개별 측정값으로, 광고실적이나, 예상수입을 나타냅니다.  User activity 통계에는 동영상 조회수 및 평점 (좋아요 및 싫어요)과 같은 것들이 포함되어 있습니다.

 

 

내 어플레케이션에 맞는 API 선택하기

YouTube Analytics API는  타켓된 쿼리에 의해 생성된 맞춤 YouTube Analytics 리포트를 실시간으로 제공합니다.

API는 제공 필터링과 소팅 파라미터를 제공하고 있어서, 호출하는 어플리케이션은 기본적으로 필터링이나 sorting 기능이 필요없습니다.

각 API 리턴받게될 데이터에 대해서 특정 테이터 범위를 요청합니다.

API는 또한 주별, 월별 데이터셋을 검색할 수 있도록 해줍니다.

따라서 호출하는 어플리케이션은 검색된 데이터 셋을 저장하거나 날짜 범위에 대한 통계를 집계할 필요가 없습니다.

YouTube Reporting API 는 채널 또는 콘텐츠 소유자에 대한 YouTube 분석데이터가 포함된 bulk 리포트(대량 보고서)를 검색할 수 있습니다. 

 

이것은 중요한 대량 데이터셋을 필터링, 정렬 마이닝하는 도구를 제공하는 어플리케이션을 활용할 수 있도록 설계되어 있습니다. 

각 리포트는 사전에 정의된 필드셋(fields set)을 포함하고 있습니다. 

개발자는 API를 이용하여 reporting jobs을 예약할 수 있습니다.

각 작업들은 YouTube 가 생성할 수있는 리포트를 식별합니다.

그런 다음 YouTube는 비동기식으로 다운로드 할 수있는 일일 보고서를 생성합니다.

각 보고서에는 24시간 동안의 유일한 데이터를 포함하고 있습니다.

또한, YouTube 자동적으로 YouTube 제작자 스튜디오에서 리포트에 엑세스할 수 있는 시스템-관리 보고서 셋을 자동으로 생성합니다.

이 보고서는 광고 수익 데이터에 프로그래밍 방식으로 액세스 할 수 있습니다.

 

Supported reports

다음 표는 API를 사용하여 검색 할 수있는 다양한 유형의 보고서를 나타냅니다.

타켓팅 쿼리는 YouTube Analytics API를 통해 제공되며, 대량 보고서(Bulk report)는 YouTube Report API를 통해 제공됩니다.

한 API에서 사용 가능한 데이터는 다른 API에서 사용하기 쉽지 않습니다.

예를 들어 YouTube Analytics API를 사용하면 매주 또는 매월 사용자 활동 측정 항목을 검색 할 수 있지만 YouTube Report API에서는 해당 데이터를 직접 집계해야 합니다.

반면 YouTube Reporting API는 콘텐츠 소유자에 대한 자산 보고서(asset reports)를 지원하지만 해당 데이터는 YouTube Analytics API에서 사용할 수 없습니다.

 

Video reports

채널과 컨텐츠 소유자에게 지원합니다. 

비디오 보고서는 채널 비디오 또는 콘텐츠 소유자의 비디오와 관련된 모든 사용자 활동에 대한 통계를 제공합니다. 

예를 들어,이 보고서에는 동영상이 조회한 횟수가 포함되어 있습니다.

YouTube Analytics API에서 일부 콘텐츠 소유자 동영상 보고서에는 예상 수익 및 광고 실적 통계도 포함됩니다.

 

Playlist reports

채널과 컨텐츠 소유자에게 지원합니다.
재생 목록(Playlist) 보고서는 재생 목록(Playlist)과 관련하여 발생하는 동영상 조회수와 관련된 통계를 제공합니다. YouTube Report API는 재생 목록(Playlist)에 대한 잠재 고객 보유 보고서를 지원하지만 YouTube Analytics API는 유사한 보고서를 지원하지 않습니다.

Ad performance reports

컨텐츠 소유자에게 지원합니다.

광고 실적 보고서는 동영상 재생 중에 실행된 광고에 대한 노출 기반 측정 항목을 제공합니다.

이러한 측정 항목은 각 광고 노출에 대해 설명하며, 각 동영상 재생시 여러 노출이 발생할 수 있습니다.

Estimated revenue reports

컨텐츠 소유자에게 지원합니다.

예상 수익 보고서는 Google에서 판매 한 광고 소스 및 비 광고 소스의 비디오에 대한 총 예상 수익을 제공합니다. 

이 보고서에는 일부 광고 실적 통계도 포함되어 있습니다. 

시스템 관리 보고서(system-managed reports)에는 실제 수익이 포함되어 있습니다.

 

Asset reports

컨텐츠 소유자에게 지원합니다.

자산 보고서는 콘텐츠 소유자의 자산에 연결된 비디오와 관련된 사용자 활동 지표를 제공합니다. 

콘텐츠 소유자가 해당 동영상을 콘텐츠 소유자의 저작물 중 하나와 일치한다고 주장한 경우 콘텐츠가 보고서에 포함되어집니다.

동영상은 콘텐츠 소유자 또는 다른 YouTube 사용자가 업로드했을 수 있습니다.

 

System-managed reports

YouTube 제작자 스튜디오의 보고서 섹션에서 해당 보고서에 액세스 할 수 있는 콘텐츠 소유자에게 지원됩니다.

시스템 관리 보고서(System-managed reports)는 자산과 비디오로 얻은 실제 수익 데이터를 제공합니다.

추가 보고서에는 소유권을 주장한 동영상 및 해당 동영상과 일치하는 저작물의 리스트를 나타냅니다.

현재 모든 제작자 스튜디오 보고서를 API에서 사용할 수있는 것은 아닙니다.

 

Note: YouTube는 Creator Studio에서는 해당 보고서에 액세스 할 수 있는 콘텐츠 소유자를 위해 시스템 관리 보고서(System-managed reports)를 자동으로 생성합니다.

하지만 결과적으로 이 보고서를 검색하는 프로세스는 이 목록의 다른 유형의 보고서와 다릅니다.

자세한 내용은 시스템 관리 보고서 설명서를 참조하십시오.

 

주요 차이점

다음 표는 YouTube Analytics Reporting API의 중요한 차이점을 보여줍니다.

특징 YouTube Analytics API YouTube Reporting API
데이터를 검색하는 프로세스

각 API는 특정 기준과 항목을 지정하여 요청하면 곧바로 시간 범위(time period)만큼에 대한 반환해줄 수 있는 데이터를 리턴해줍니다.

 

어플레케이션에 리포팅 job을 예약합니다.

각 job에 대해, YouTube 매일 리포트를 비동기로 다운로드 받을 수 있도록 생성합니다.

날짜 범위

일부 API 보고서는 사용자 활동의 발생한 날자를 지정합니다.

이 몇몇 리포트들은 사용자 활동 집계를 측정하기 위해 측정 기준으로 7-day 단위 , 30-day 단위, 또는 한달 단위로 지원 합니다. 

모든 API리포트는사용자 활동이 발생하는 날짜를 지정합니다.

API를 이용하는 어플리케이션은 주기적으로 데이터를 생성할 수 있는 기능을 구현할 수 있습니다.

필터링 데이터

당신은 지정된 값을 가지고 있는 dimension을 포함하고 있는 rows 의 리포트를 필터할 수 있습니다.

API는  continent a과 subContinent 같은  필터에 사용되어지는 몇몇 dimensions를 지합니다.

이 API는 전체 데이터 set의 대량 다운로드를 지원합니다.

여기에는 필터링이나 필터 전용 dimensions에 의한 data를 리턴하지 않습니다.

클라이언트 응용 프로그램은 다운로드된 데이터를 저장하고 다운로드 된 데이터에 대해 자체적으로 필터링하는 기능을 구현해야 합니다.

 

정렬

반환되는 메트릭 값을 기준으로 보고서를 정렬 할 수 있습니다.

일부 보고서는 제한된 수의 결과만 지원합니다.

예를 들어 채널에서 가장 많이 본 동영상을 표시하는 보고서는 최대 200 rows까지 반환됩니다.

이 API는 전체 데이터 세트의 대량 다운로드를 지원합니다. 

클라이언트 응용 프로그램은 다운로드 한 데이터에 대해 자체적으로 정렬 할 수있는 기능을 구현해야 합니다.

표시

API 보고서에는 식별할 수 있는 표시된 dimension값, 예를 들어 "ANDROID" 또는 "CHANNEL"과 같은,  text 값을 포함하고 있습니다. 

API 보고서에는 텍스트 값에 매핑 할 수 있는 정수가 포함되어 있습니다. 

해당 보고서의 텍스트는 정수 코드값으로 처리가 되어 있다는 뜻

쿼터

API 서버는 각 쿼리의 쿼터 비용을 측정하기 위해 각 쿼리를 평가합니다.

쿼터 사용량은 문서에 보다 자세히 설명하고 있습니다.

할당량 사용량은 데이터를 한 번 검색 한 다음 응용 프로그램 내에서 필터링, 정렬 및 쿼리하기 때문에 문제가되지 않습니다.

고유 리포트  
  • 자막 관련 사용자 활동
  • 재생 목록의 잠재 고객 보유 데이터
  • 콘텐츠 소유자에 대한 예상 수익 보고서 (2 개의 다른 보고서를 사용할 수 있음)
  • 컨텐츠 소유자에 대한 자산 보고서 (11 개의 서로 다른 보고서 사용 가능)
고유 수치 group (filter-only dimension)
continent (filter-only dimension)
subContinent (filter-only dimension)
7DayTotals
30DayTotals
month
isCurated==1 (filter-only dimension)
viewsPerPlaylistStart
averageTimeInPlaylist
annotation_id
annotation_type
asset_id
card_id
card_type
live_or_on_demand
subscribed_status
subtitle_language
고유 측정항목 uniques
relativeRetentionPerformance
viewsPerPlaylistStart
averageTimeInPlaylist
card_click_rate
card_clicks
card_impressions
card_teaser_click_rate
card_teaser_clicks
card_teaser_impressions
estimated_partner_adsense_revenue
estimated_partner_doubleclick_revenue playlist_saves_added
playlist_saves_removed

 

 

API의 네이밍 차이점

두 API는 현재 집계와 수치를 구분하기 위해서 서로 다른 네이밍 규칙을 사용합니다. 

현재 YouTube Analytics API 이름은 camelCase를 사용하지만 YouTube Reporting API 이름은 밑줄로 구분된 이름을 사용합니다.

다음 표는 두 API가 동일한 집계와 수치을 구분하는데 사용하는 다른이름으로 식별합니다.

경우에 따라 두 이름의 차이에서 camelCase에서 밑줄로 변환하여 사용하는 경우가 아닌 경우도 있습니다.

예를 들어 YouTube Analytics API의  video 이름은 YouTube Reporting API에서 video_id라는 이름으로 지정되기도 합니다.

 

이름 (Dimensions)

YouTube Analytics API name YouTube Reporting API name
adType ad_type
ageGroup age_group
asset asset_id
audienceType audience_retention_type
channel channel_id
claimedStatus claimed_status
contentOwner content_owner_id
country country_code
day date
deviceType device_type
elapsedVideoTimeRatio elapsed_video_time_percentage
gender gender
insightPlaybackLocationDetail playback_location_detail
insightPlaybackLocationType playback_location_type
insightTrafficSourceDetail traffic_source_detail
insightTrafficSourceType traffic_source_type
liveOrOnDemand live_or_on_demand
operatingSystem operating_system
playlist playlist_id
province province_code
sharingService sharding_service
subscribedStatus subscribed_status
subtitleLanguage subtitle_language
uploaderType uploader_type
video video_id

 

집계 (Metrics)

YouTube Analytics API name YouTube Reporting API name
adEarnings estimated_partner_ad_revenue
annotationImpressions annotation_impressions
annotationClickableImpressions annotation_clickable_impressions
annotationClicks annotation_clicks
annotationClickThroughRate annotation_click_through_rate
annotationClosableImpressions annotation_closable_impressions
annotationCloses annotation_closes
annotationCloseRate annotation_close_rate
audienceWatchRatio audience_retention_percentage
averageViewDuration average_view_duration_seconds
averageViewPercentage average_view_duration_percentage
cardClickRate card_click_rate
cardClicks card_clicks
cardImpressions card_impressions
cardTeaserClickRate card_teaser_click_rate
cardTeaserClicks card_teaser_clicks
cardTeaserImpressions card_teaser_impressions
comments comments
dislikes dislikes
earnings estimated_partner_revenue
estimatedMinutesWatched watch_time_minutes
estimatedPartnerAdSenseRevenue estimated_partner_adsense_revenue
estimatedPartnerDoubleClickRevenue estimated_partner_doubleclick_revenue
grossRevenue estimated_youtube_ad_revenue
impressionBasedCpm estimated_cpm
impressions ad_impressions
likes likes
monetizedPlaybacks estimated_monetized_playbacks
playbackBasedCpm estimated_playback_based_cpm
playlistStarts playlist_starts
savesAdded playlist_saves_added
savesRemoved playlist_saves_removed
shares shares
subscribersGained subscribers_gained
subscribersLost subscribers_lost
videosAddedToPlaylists videos_added_to_playlists
videosRemovedFromPlaylists videos_removed_from_playlist
viewerPercentage views_percentage
views views

 

The following table identifies the different types of reports you can retrieve using the APIs. Targeted queries are available via the YouTube Analytics API, and bulk reports are available via the YouTube Reporting API.

 

Data that is available in one API might not be available in the other. For example, the YouTube Analytics API lets you retrieve user activity metrics on a weekly or monthly basis, but the YouTube Reporting API requires you to aggregate that data yourself. On the other hand, the YouTube Reporting API supports asset reports for content owners, but that data is not available from the YouTube Analytics API.

 

 

 

This document explains similarities and differences in the ways that the YouTube Analytics API and YouTube Reporting API provide access to YouTube Analytics data. The document's purpose is to help you to choose the right API for your application.

Both APIs enable developers to retrieve YouTube Analytics data. In addition, both APIs support YouTube channel owners and YouTube content owners, each of whom can access a specific set of reports:

  • Channel reports contain user activity metrics for a specified channel.

  • Content owner reports aggregate metrics for all of the channels linked to a specified YouTube content owner. For example, a record label could retrieve a report containing combined statistics for the YouTube channels of all of the label's artists. Some content owner reports contain user activity metrics, while others contain metrics related to revenue and ad performance.

The Reporting API also allows some content owners to access system-managed ad revenue reports. The data in the system-managed reports can only be retrieved with the Reporting API.

All YouTube Analytics and YouTube Reporting API requests must be authorized by the channel or content owner that owns the requested data.

Report contents

 

The reports that the APIs retrieve contain two types of data:

  • Dimensions are common criteria that are used to aggregate data, such as the date on which the user activity occurred or the country where the users were located.

    In a report, each row of data has a unique combination of dimension values. As such, each row's combination of dimension values functions as the primary key for that row.

  • Metrics are individual measurements of user activity, ad performance, or estimated revenue. User activity metrics include things like video view counts and ratings (likes and dislikes).

Choose the right API for your application

The YouTube Analytics API supports real-time targeted queries to generate custom YouTube Analytics reports. The API provides filtering and sorting parameters, so the calling application does not need to natively support these functions.

Each API request specifies the date range for which data will be returned. The API also enables you to retrieve weekly and monthly data sets. As such, the calling application does not need to store retrieved data sets or aggregate statistics across date ranges.The YouTube Reporting API retrieves bulk reports containing YouTube Analytics data for a channel or content owner. It is designed for applications that can import large data sets and that provide tools to filter, sort, and mine that data.

Each report contains a predefined set of fields. Developers use the API to schedule reporting jobs, each of which identifies a report that YouTube should generate. YouTube then generates a daily report that can be asynchronously downloaded. Each report contains data for a unique 24-hour period.

In addition, YouTube automatically generates a set of system-managed reports for content owners that have access to the corresponding reports in YouTube Creator Studio. These reports provide programmatic access to ad revenue data.

Supported reports

The following table identifies the different types of reports you can retrieve using the APIs. Targeted queries are available via the YouTube Analytics API, and bulk reports are available via the YouTube Reporting API.

 

Data that is available in one API might not be available in the other. For example, the YouTube Analytics API lets you retrieve user activity metrics on a weekly or monthly basis, but the YouTube Reporting API requires you to aggregate that data yourself. On the other hand, the YouTube Reporting API supports asset reports for content owners, but that data is not available from the YouTube Analytics API.

Video reports Supported for channels (query or bulk) and content owners (query or bulk).

Video reports provide statistics for all user activity related to a channel's videos or a content owner's videos. For example, these reports contain the number of views that your videos received. In the YouTube Analytics API, some content owner video reports also include estimated revenue and ad performance metrics.
Playlist reports Supported for channels (query or bulk) and content owners (query or bulk).

Playlist reports provide statistics that are specifically related to video views that occur in the context of a playlist. The YouTube Reporting API supports audience retention reports for playlists, but the YouTube Analytics API does not support a similar report.
Ad performance reports Supported for content owners (query or bulk).

Ad performance reports provide impression-based metrics for ads that ran during video playbacks. These metrics account for each ad impression, and each video playback can yield multiple impressions.
Estimated revenue reports Supported for content owners (bulk).

Estimated revenue reports provide the total estimated revenue for videos from Google-sold advertising sources and from non-advertising sources. These reports also contain some ad performance metrics. Note that system-managed reports contain actual revenue.
Asset reports Supported for content owners (bulk).

Asset reports provide user activity metrics related to videos that are linked to a content owner's assets. A video is included in a content owner's report if the content owner has claimed that video as a match of one of the content owner's assets. The video could have been uploaded by the content owner or by another YouTube user.
System-managed reports Supported for content owners who have access to the corresponding reports in the Reports section of YouTube's Creator Studio.

System-managed reports provide actual revenue data earned by assets and videos. An additional report lists claimed videos and the assets those videos match. Note that not all Creator Studio reports are currently available in the API.

Note: YouTube automatically generates system-managed reports for content owners that have access to the corresponding reports in Creator Studio. As a result, the process for retrieving these reports is different than for the other types of reports in this list. See the documentation for system-managed reports for more information.

 

Key differences

The following table highlights important differences between the YouTube Analytics and Reporting APIs.

FeatureYouTube Analytics APIYouTube Reporting API

Process to retrieve data Each API request specifies dimensions and metrics to be returned as well as the time period for which data will be returned. Applications schedule reporting jobs. For each job, YouTube generates daily reports that can be asychronously downloaded.
Date Ranges Some API reports specify the date that user activity occurred. Some of those reports support dimensions to aggregate user activity metrics by 7-day periods, 30-day periods, or months. All API reports specify the day that user activity occurred. Applications using the API can implement features to aggregate data for periodic intervals.
Filtering data You can filter reports to include only rows for which a dimension has a specific value. The API also supports some dimensions, like continent and subContinent, that are used only as filters. The API supports bulk downloads of complete data sets. It does not support filtering or return data for filter-only dimensions. The client application stores the downloaded data and implements its own features to filter the data.
Sorting Reports can be sorted based on returned metric values. Some reports support only a limited number of results. For example, the report that lists a channel's most viewed videos returns a maximum of 200 rows. This API supports bulk downloads of complete data sets. Client applications can implement their own features to sort downloaded data.
Enumerations API reports contain text values, like "ANDROID" or "CHANNEL," to identify enumerated dimension values. API reports contain integers that can be mapped to text values.
Quota The API server evaluates each query to determine its quota cost. The quota usage document explains the methodology in more detail. Quota usage is not an issue because data is retrieved once and then filtered, sorted, and queried within the application.
Unique reports  
  • User activity related to subtitles
  • Audience retention data for playlists
  • Estimated revenue reports for content owners (2 different reports are available)
  • Asset reports for content owners (11 different reports are available)
Unique dimensions group (filter-only dimension)
continent (filter-only dimension)
subContinent (filter-only dimension)
7DayTotals
30DayTotals
month
isCurated==1 (filter-only dimension)
viewsPerPlaylistStart
averageTimeInPlaylist
annotation_id
annotation_type
asset_id
card_id
card_type
live_or_on_demand
subscribed_status
subtitle_language
Unique metrics uniques
relativeRetentionPerformance
viewsPerPlaylistStart
averageTimeInPlaylist
card_click_rate
card_clicks
card_impressions
card_teaser_click_rate
card_teaser_clicks
card_teaser_impressions
estimated_partner_adsense_revenue
estimated_partner_doubleclick_revenue playlist_saves_added
playlist_saves_removed

Naming differences between APIs

The two APIs currently use different naming conventions to identify dimensions and metrics. At this time, YouTube Analytics API names use camelCase, while YouTube Reporting API names use underscore-delimited names.

The following tables identify the different names that the two APIs use to identify the same metrics and dimensions. In some cases, the difference between the two names is more than what you would get after converting a name from camelCase to underscores. For example, the video dimension in the YouTube Analytics API is named video_id in the YouTube Reporting API.

Dimensions

YouTube Analytics API nameYouTube Reporting API name

adType ad_type
ageGroup age_group
asset asset_id
audienceType audience_retention_type
channel channel_id
claimedStatus claimed_status
contentOwner content_owner_id
country country_code
day date
deviceType device_type
elapsedVideoTimeRatio elapsed_video_time_percentage
gender gender
insightPlaybackLocationDetail playback_location_detail
insightPlaybackLocationType playback_location_type
insightTrafficSourceDetail traffic_source_detail
insightTrafficSourceType traffic_source_type
liveOrOnDemand live_or_on_demand
operatingSystem operating_system
playlist playlist_id
province province_code
sharingService sharding_service
subscribedStatus subscribed_status
subtitleLanguage subtitle_language
uploaderType uploader_type
video video_id

Metrics

YouTube Analytics API nameYouTube Reporting API name

adEarnings estimated_partner_ad_revenue
annotationImpressions annotation_impressions
annotationClickableImpressions annotation_clickable_impressions
annotationClicks annotation_clicks
annotationClickThroughRate annotation_click_through_rate
annotationClosableImpressions annotation_closable_impressions
annotationCloses annotation_closes
annotationCloseRate annotation_close_rate
audienceWatchRatio audience_retention_percentage
averageViewDuration average_view_duration_seconds
averageViewPercentage average_view_duration_percentage
cardClickRate card_click_rate
cardClicks card_clicks
cardImpressions card_impressions
cardTeaserClickRate card_teaser_click_rate
cardTeaserClicks card_teaser_clicks
cardTeaserImpressions card_teaser_impressions
comments comments
dislikes dislikes
earnings estimated_partner_revenue
estimatedMinutesWatched watch_time_minutes
estimatedPartnerAdSenseRevenue estimated_partner_adsense_revenue
estimatedPartnerDoubleClickRevenue estimated_partner_doubleclick_revenue
grossRevenue estimated_youtube_ad_revenue
impressionBasedCpm estimated_cpm
impressions ad_impressions
likes likes
monetizedPlaybacks estimated_monetized_playbacks
playbackBasedCpm estimated_playback_based_cpm
playlistStarts playlist_starts
savesAdded playlist_saves_added
savesRemoved playlist_saves_removed
shares shares
subscribersGained subscribers_gained
subscribersLost subscribers_lost
videosAddedToPlaylists videos_added_to_playlists
videosRemovedFromPlaylists videos_removed_from_playlist
viewerPercentage views_percentage
views views
728x90

https://developers.google.com/youtube/v3/docs

 

API Reference  |  YouTube Data API  |  Google Developers

YouTube Data API를 사용하면 YouTube 웹사이트에서 일반적으로 실행하는 기능을 사용자의 웹사이트 또는 애플리케이션에 통합할 수 있습니다. 아래 목록에서는 API를 사용하여 검색할 수 있는 다양한 유형의 리소스를 확인합니다. API는 이러한 여러 개의 리소스를 삽입하거나 업데이트 또는 삭제하는 메소드도 지원합니다. 참조 가이드에서는 API로 이러한 모든 작업을 수행하는 방법을 설명합니다. 이 가이드는 리소스 유형별로 정리되어 있습니다. 리소

developers.google.com

YouTube Data API를 사용하면 YouTube 웹사이트에서 일반적으로 실행하는 기능을 사용자의 웹사이트 또는 애플리케이션에 통합할 수 있습니다. 아래 목록에서는 API를 사용하여 검색할 수 있는 다양한 유형의 리소스를 확인합니다. 

API는 이러한 여러 개의 리소스를 삽입하거나 업데이트 또는 삭제하는 메소드도 지원합니다.

참조 가이드에서는 API로 이러한 모든 작업을 수행하는 방법을 설명합니다. 

이 가이드는 리소스 유형별로 정리되어 있습니다. 

리소스란 동영상, 재생 목록 또는 구독과 같이 YouTube 환경을 구성하는 항목 유형을 의미합니다. 

가이드에는 리소스 유형별로 하나 이상의 데이터 표현이 나와 있으며 리소스는 JSON 개체로 표시됩니다. 

또한 리소스 유형별로 지원되는 하나 이상의 메소드(LIST, POST, DELETE 등)와 함께 애플리케이션에서 이러한 메소드를 사용하는 방법에 대해 설명합니다.

 

1. Activity (활동)

특정 사용자가 YouTube 사이트에서 실행한 작업의 정보를 알 수 있습니다.

요청하는 기준에 일치하는 채널 활동 이벤트의 리스트를 반환합니다.

예를 들어 특정 채널과 관련된 이벤트, 사용자의 구독정보 및 Google+ 친구 또는 사용자별로 맞춤 설정되는 YouTube 홈페이지 피드와 관련된 이벤트를 검색할 수 있습니다.

동영상 평가, 동영상 공유, 동영상 즐겨찾기 정보, 채널 게시판에 게시 등이 포함되어 있습니다.

 

Activity 리소스에 다음 메소드를 지원합니다.

 

- list 

- insert 


2. Channel (채널)

단일 YouTube 채널에 대한 정보를 알 수 있습니다.

channel 리소스에는 YouTube 채널에 대한 정보가 포함되어 있습니다.

 

channels 리소스에 다음 메소드를 지원합니다.

- list

요청 기준과 일치하는 0개 이상의 channel 리소트 집합을 반환합니다.

 

- update

채널의 메타데이터를 업데이트 합니다.

  * 이 메소드는 현재 channel 리소스의 brandingSettings 및 invideoPromotion 개체와 해당 하위 속성의 업데이트만 지원합니다

 

2-1. channelBanner (채널 배너 업로드 )

channelBanner 리소스에는 새로 업로드한 이미지를 채널의 배너 이미지로 설정하는 데 사용할 URL을 포함할 수 있습니다.

새로 업로드한 이미지를 채널의 배너 이미지로 설정하는 데 사용할 URL을 찾아줍니다.

 

API는 channelBanners 리소스에 다음 메소드를 지원합니다

- insert : YouTube에 채널 배너 이미지를 업로드합니다. 

 

  * 이 메소드는 다음과 같이 채널의 배너 이미지를 업데이트하기 위해서는 다음 5단계를 거쳐야 제대로 업로드가 됩니다.

  1. channelBanners.insert 메소드를 호출하여 YouTube에 바이너리 이미지를 업로드합니다.

  2. 이미지는 화면 비율이 16:9여야 하며 최소 2120x1192픽셀 이상이어야 합니다.

  3. API가 1단계에서 반환한 응답으로부터 url 속성 값을 추출합니다.

  4. channels.update 메소드를 호출해 채널의 브랜드 설정을 업데이트합니다. 

  5. brandingSettings.image.bannerExternalUrl 속성 값을 2단계에서 확인한 URL로 설정합니다.

 

Youtube에 channel banner이미지를 업로드합니다.

이 channelBanner 메소드는 channel 에 배너이미지를 업로드하기위한 3단계 프로세스에서 첫 2단계를 나타냅니다. :

 

1. channelBanners.insert 라 불리는 메소드는 YouTube 에 바이너리 이미지 데이터를 업로드하기 위한 것입니다.

 이미지는 반드시 16:9 가로:세로비율을 가지고 있어야 하고, 2048X1152pixels 이상이어야 합니다.

 우리는 2560px X 1140px 이미지를 업로드하는 것을 추천합니다.

 

2. 1단계에서 API 가 return 해주는 응답에서 URL Property 를 추출해야 합니다.

 

3. channels.update 라 불리는 메소드에서 channel의 branding setting에 업데이트합니다.

brandingSettings.image.brannerExternelUrl property에 URL에 2단계에서 가져온 URL property를 value로 세팅하세요.

 

이 메소드는 media 업로드를 지원합니다.

업로드하는 파일은 반드시 아래의 제약 조건을 갖춰야 합니다.

최대 파일 크기 : 6MB

허용된 Media MIME types :  image/jpeg, image/png, application/octet-stream

Uploads a channel banner image to YouTube. This method represents the first two steps in a three-step process to update the banner image for a channel:

1. Call the channelBanners.insert method to upload the binary image data to YouTube. The image must have a 16:9 aspect ratio and be at least 2048x1152 pixels. We recommend uploading a 2560px by 1440px image.

2. Extract the url property's value from the response that the API returns for step 1.Call the channels.update method to update the channel's branding settings. 

3. Set the brandingSettings.image.bannerExternalUrl property's value to the URL obtained in step 2.

This method supports media upload. Uploaded files must conform to these constraints: 
Maximum file size: 6MB 
Accepted Media MIME types: image/jpeg, image/png, application/octet-stream

 

 

2-1. ChannelSections

channelSection 리소스에는 채널이 추천한 videos 세트에 대한 정보가 포함되어 있습니다.

 

예를 들어, 섹션에는 채널의 최신 업로드, 가장 인기있는 업로드 또는 하나 이상의 재생 목록의 비디오가 포함될 수 있습니다.

channel의 section은 channel이 browse view에 컨텐츠를 표시하는 경우에만 표시됩니다. (feed view 가 아닙니다.)

 

채널이 browse view 컨텐츠를 표시 할 수 있게 하려면 지정된 채널(specified channel)에 대해 brandingSettings.channel.showBrowseView  프로퍼티(property)를 true로 설정하면 됩니다.

 

channel은 targeting data를 설정하지 않고 최대 10개의 shelve를 만들 수 있으며 targeting data를 사용하면 최대 100 개의 shelve을 만들 수 있습니다.

A channelSection resource contains information about a set of videos that a channel has chosen to feature.
For example, a section could feature a channel's latest uploads, most popular uploads, or videos from one or more playlists.Note that a channel's sections are only visible if the channel displays content in a browse view (rather than a feed view). 

To enable a channel to display content in a browse view, set the brandingSettings.channel.showBrowseView property to true for the specified channel.

A channel can create a maximum of 10 shelves without setting targeting data and can create a maximum of 100 shelves with targeting data.

 

API는 channelSections 리소스에 다음 메소드를 지원합니다


- list

channelSection 리소스의 리스트를 API 요청기준(API request criteria)에 맞는 것을 되돌려 줍니다.

 

- insert

인증된 user 채널에 대한 channel 색션을 추가합니다.

한개의 channel은 10개의 shelves 를 targeting data 세팅없이 만들 수 있고, 최대 targeting data 를 가지고는 100 shelves를 만들 수 있습니다.

A channel can create a maximum of 10 shelves without setting targeting data and can create a maximum of 100 shelves with targeting data

 

- update
channel section을 업데이트 합니다.

 

- delete
channel section 를 삭제합니다.

 


3. Caption (자막)

Caption 리소스는 Youtube의 자막트랙을 가져옵니다.

자막 트랙(Caption track)은 정확히 한개의 YouTube 동영상과 연결되어 있습니다.

 

API는 Captions 리소스에 다음 메소드를 지원합니다


- list

caption tracks의 목록을 검색하는 것은 지정한(특정지은) video에 관련되어 있다.

즉, 지정한 video와 관련된 캡션 트랙 목록을 검색합니다.

API 응답(response)는 실제 captions을 포함하고 있지 않는 것과 captions.download 메소드는 캡션 트랙을 검색하기 위한 기능을 제공하는 것을 을 알아주세요.

Retrieve a list of caption tracks that are associated with a specified video. 
Note that the API response does not contain the actual captions and that the captions.download method provides the ability to retrieve a caption track.

 

- insert
caption track을 업로드 합니다.

 

- update
caption track을 업데이트합니다.

caption track을 업데이트할때, 당신은 바꿀 수 있습니다. 

track의 초안 상태를 변경하거나 트랙의 새 caption file 을 업로드하거나 둘 다를 수행 할 수 있습니다.

 

- delete

선택한(지정한) caption track을 삭제할 수 있습니다.

 

- download

caption track을 다운로드 합니다.

caption track은 tfmt  파라미터에 지정된 값을 요청하지 않는다면, 오리지널 포멧으로 리턴합니다.

tlang 파라미터에 대해서 지정된 값을 요청하지 않는다면 오리지널 언어로 리턴합니다.

The caption track is returned in its original format unless the request specifies a value for the tfmt parameter and in its original language unless the request specifies a value for the tlang parameter.

 


4. Comment (답글, 댓글)

comment 리소스에는 YouTube 댓글 한개에 대한 정보가 포함되어 있습니다.

comment 리소스는 동영상 또는 채널에 대한 댓글이 나타나게 할 수 있습니다.? (댓글을 달 수 있다.)

추가로, comment은 Top-Level 의 comment나 Top-Level 의 comment에 대한  회신을 할 수 있습니다.

A comment resource contains information about a single YouTube comment.
A comment resource can represent a comment about either a video or a channel.
In addition, the comment could be a top-level comment or a reply to a top-level comment.

 

API는 Comment 리소스에 다음 메소드를 지원합니다


- list

API request 파라미터에 매치된 comments 리스트를 리턴합니다.

 

- insert

표현할 comment를 회신하여 생성합니다. 

Top-Level comment를 달기 위해서는 commentThreads.insert메소드를 이용하세요.

 

- update
comment를 업데이트 합니다.

 

- delete
comment를 삭제합니다.

 

- setModerationStatus

하나 이상의 comment의 검토 상태를 설정합니다.

API 요청여부는 댓글과 관련된 채널 또는 동영상의 소유자가 승인해야 합니다.

Sets the moderation status of one or more comments. 
The API request must be authorized by the owner of the channel or video associated with the comments.

 

- markAsSpam

하나 이상의 comment에 달린 발신자의 의견에 대해 스팸으로 표시할 수 있습니다.

Expresses the caller's opinion that one or more comments should be flagged as spam. 

 

3-1.CommentThreads (top-level 댓글)

CommentThread 리소스에는 Top-level comment로 구성된 YouTube comment thread에 대한 정보가 포함되어, 해당 댓글이 있는 경우 Top-level의 댓글(comment)과 답글(reply)로 구성되어 있습니다.

CommentThread 리소스는 videos 또는 Channels에 대한 comment을 나타낼 수 있습니다.

 

Top-level의 댓글(comment)과 답글(reply)은 실제로 commentThread 리소스에 기반하고 있습니다.

CommentThread 리소스에 Comment에 대한 모든 응답이 반드시 포함되는 것은 아니며, 특정 Comment에 대한 모든 응답을 검색하려면 comments.list 메소드를 사용해야합니다. 또한 일부 comments에 대해 회신이 없을 수도 있습니다.

 

A commentThread resource contains information about a YouTube comment thread, which comprises a top-level comment and replies, if any exist, to that comment. A commentThread resource can represent comments about either a video or a channel.Both the top-level comment and the replies are actually comment resources nested inside the commentThread resource.
The commentThread resource does not necessarily contain all replies to a comment, and you need to use the comments.list method if you want to retrieve all replies for a particular comment. Also note that some comments do not have replies.

 

API는 CommentThread 리소스에 다음 메소드를 지원합니다


- list

API request parameters에 맞는 comment threads 리스트를 반환합니다.

 

- insert

새 Top-level comment를 등록합니다.

존재하는 comment에 reply을 추가하기 위해서, comments.insert 메소드를 대신 사용합니다.

Creates a new top-level comment. To add a reply to an existing comment, use the  comments.insert method instead. 

 

- update

comment thread에 있는 Top-level comment 를 수정합니다.

 


4.GuideCategories (가이드 카테고리)

guideCategory 리소스는 YouTube 알고리즘이 채널의 콘텐츠 또는 인기도와 같은 기타 지표(예: 인기도)를 바탕으로 지정한 카테고리를 확인합니다.

guideCategory는 YouTube 사용자가 원하는 콘텐츠를 더 쉽게 찾을 수 있는 방법으로 채널을 구성하기 위한 방법을 모색합니다.

channel은 한 개 이상의 guideCategory에 연결될 수 있지만 가이드 카테고리에 모두 포함된다고는 할 수 없습니다.

 

이 list는 동영상 카테고리와 유사하지만 vidoes 카테고리는 동영상 업로더가 지정할 수 있고 chnnels 카테고리는 YouTube만 지정할 수 있다는 점이 다릅니다.

 

API는 guideCategories 리소스에 다음 메소드를 지원합니다.

- list

YouTube 채널과 관련된 카테고리의 목록을 반환합니다.

 


5. PlaylistItems

PlaylistItem 리소스는 재생목록에 포함된 동영상과 같은, 다른 리소스를 식별합니다.

또한 playlistItem 리소스에는 재생목록에서 리소스가 사용되는 방식과 관련하여 포함된 리소스에 대한 세부정보가 포함되어 있습니다.
YouTube 재생목록은 다음과 같은 채널의 특별한 동영상 모음을 구분합니다.

업로드한 동영상
즐겨찾는 동영상
긍정적 평가(좋아요)를 받은 동영상
감상한 동영상
나중에 볼 동영상
보다 구체적으로 이러한 목록은 개인, 그룹 또는 회사의 동영상, 재생목록 및 기타 YouTube 정보의 모음인 채널과 연결되어 있습니다.

각 목록의 재생목록 ID는 해당 채널의 channel resource 로부터 검색할 수 있습니다. 

그런 다음 playlistItems.list 메소드를 사용해 원하는 목록을 검색합니다. 

playlistItems.insert 및 playlistItems.delete 메소드를 호출해 목록에 항목을 추가하거나 목록에서 항목을 삭제할 수도 있습니다. 

예를 들어 사용자가 동영상을 즐겨찾기에 추가한 경우 해당 동영상을 사용자 채널의 즐겨찾기 동영상 재생목록에 넣을 수 있습니다.

 


API는 playlistItems 리소스에 다음 메소드를 지원합니다.

- list
API 요청 매개변수와 일치하는 재생목록 항목의 모음을 반환합니다. 

지정된 재생목록의 모든 항목을 검색하거나 고유 ID를 통해 하나 또는 여러 개의 재생목록 항목을 검색할 수 있습니다. 

 

- insert
재생목록에 리소스를 추가합니다. 

 

- update
재생목록의 항목을 수정합니다. 

예를 들어 재생목록에서 항목의 위치를 업데이트할 수 있습니다. 

 

- delete
재생목록의 항목을 삭제합니다. 

 

 

5-1. playlist

playlist 리소스는 YouTube 재생목록을 나타냅니다. 

* 재생목록은 순서대로 감상하거나 다른 사용자와 공유할 수 있는 동영상의 리스트 모음입니다.

재생목록은 최대 200개의 동영상을 포함할 수 있으며 사용자가 만들 수 있는 재생목록의 수에는 제한이 없습니다. 

재생목록은 기본적으로 다른 사용자에게 공개되지만 비공개로 설정할 수도 있습니다.

YouTube 재생목록은 다음과 같은 채널의 특별한 동영상 모음을 구분합니다.

업로드한 동영상
즐겨찾는 동영상
긍정적 평가(좋아요)를 받은 동영상
감상한 동영상
나중에 볼 동영상
보다 구체적으로 이러한 목록은 개인, 그룹 또는 회사의 동영상, 재생목록 및 기타 YouTube 정보의 모음인 채널과 연결되어 있습니다. 

각 목록의 재생목록 ID는 해당 채널의 channel resource 리소스로부터 검색할 수 있습니다.

그런 다음 playlistItems.list 메소드를 사용해 원하는 목록을 검색합니다. 

 

playlistItems.insert 및 playlistItems.delete 메소드를 호출해 목록에 항목을 추가하거나 목록에서 항목을 삭제할 수도 있습니다.


API는 playlists 리소스에 다음 메소드를 지원합니다.

- list
API 요청 매개변수와 일치하는 재생목록의 모음을 반환합니다. 

예를 들어 인증된 사용자가 보유한 전체 재생목록을 검색하거나, 고유 ID를 통해 하나 또는 여러 개의 재생목록을 검색할 수 있습니다.

 

- insert
재생목록을 만듭니다.

 

- update
재생목록을 수정합니다. 

예를 들어 재생목록의 제목, 설명, 개인정보 보호 상태를 변경할 수 있습니다. 

 

- delete
재생목록을 삭제합니다.


7. search (검색결과)

검색결과에는 API 요청에 지정된 검색 매개변수와 일치하는 YouTube 동영상, 채널 또는 재생목록의 정보가 포함되어 있습니다.

검색결과는 동영상과 같이 고유하게 식별할 수 있는 리소스를 보여주지만, 자체적으로는 영구적인 데이터를 가지고 있진 않습니다. (항상 변할 수 있습니다.)

 

API는 검색에 다음 메소드를 지원합니다.

- list
API 요청에 지정된 쿼리 매개변수와 일치하는 검색결과의 모음을 반환합니다. 

기본적으로 검색결과의 집합은 쿼리 매개변수와 일치하는 video, channel, playlist 리소스를 식별하지만, 특정 유형의 리소스만 검색하도록 쿼리를 구성할 수도 있습니다. 


8. subscription

YouTube 사용자의 구독 정보를 포함하고 있습니다.

* 구독정보는 채널에 새 동영상이 추가되거나 다른 사용자가 YouTube에서 동영상 업로드, 동영상 평가 또는 동영상 추천 등의 작업 중 하나를 수행할 때 이를 알려주는 기능입니다.

 

subscription 리소스에는 YouTube 사용자의 구독정보가 포함되어 있습니다.

구독정보는 채널에 새 동영상이 추가되거나 다른 사용자가 YouTube에서 동영상 업로드, 동영상 평가 또는 동영상 추천 등의 작업 중 하나를 수행할 때 이를 알려줍니다.


API는 subscriptions 리소스에 다음 메소드를 지원합니다.

- list

API 요청 기준과 일치하는 구독정보 리소스를 반환합니다. 

 

- insert
인증된 사용자 채널에 대한 구독정보를 추가합니다.

 

- delete
구독정보를 삭제합니다.


9. thumbnail

하나의 리소스에 연결된 미리보기 이미지의 각기 다른 크기별로 구분하여 줍니다. 미리보기 이미지의 특징은 다음과 같습니다.

  • 리소스의 snippet.thumbnails 속성은 해당 리소스에서 사용할 수 있는 미리보기 이미지를 식별하는 개체입니다.

  • thumbnail 리소스에는 일련의 개체가 포함되어 있습니다.  각 개체의 이름(default, medium, high 등)은 미리보기 이미지의 크기를 나타냅니다.

  • 다양한 유형의 리소스를 통해 미리보기 이미지의 다양한 크기를 지원할 수 있습니다.

  • 다양한 유형의 리소스를 통해 동일한 이름을 가진 미리보기 이미지의 크기를 서로 다르게 정의할 수 있습니다.

    • 예를 들어 video 리소스의 default 미리보기 이미지는 보통 120x90픽셀이며, channel 리소스의 default 미리보기 이미지는 보통 88x88픽셀입니다.

  • 미리보기 이미지의 크기는 리소스 유형이 동일하더라도 원본 이미지 또는 YouTube에 업로드된 콘텐츠의 해상도에 따라 달라질 수 있습니다.

    • 예를 들어 HD 동영상은 HD가 아닌 동영상보다 더 높은 해상도의 미리보기를 지원할 수 있습니다.

  • 미리보기 이미지의 크기 정보가 포함된 개체에는 width 속성과 height 속성이 있습니다.

    • width와 height 속성은 반환되지 않을 수도 있습니다.

  • 업로드된 미리보기 이미지가 필요한 크기와 일치하지 않는 경우 이미지가 올바른 크기에 맞춰 조정되며 가로세로 비율도 그대로 유지됩니다.

    • 이미지가 잘리지는 않으나 올바른 크기로 맞추기 위해 이미지에 검은색 띠가 포함될 수 있습니다.

API는 subscriptions 리소스에 다음 메소드를 지원합니다.

- set

YouTube에 맞춤 동영상 미리보기 이미지를 업로드하고 이를 동영상에 설정합니다.


10. videos

단일 YouTube 동영상을 나타냅니다.

 

API는 videos 리소스에 다음 메소드를 지원합니다.

 

- getRating

지정된 동영상의 목록에 대해 인증된 사용자가 적용한 평가를 검색합니다

- list

API 요청 매개변수와 일치하는 동영상의 목록을 반환합니다.

- insert

YouTube에 동영상을 업로드하고 동영상의 메타데이터를 선택적으로 설정합니다.

- update

동영상의 메타데이터를 업데이트합니다.

- delete

YouTube 동영상을 삭제합니다

- rate

동영상에 좋아요 또는 싫어요 평가를 추가하거나 이러한 평가를 삭제합니다.

 

10-1. VideoAbuseReportReasons

videoAbuseReportReason 리소스에는 잘못된 콘텐츠가 포함된 것으로 동영상이 신고된 이유에 대한 정보를 확인해 줍니다.

내 애플리케이션이 abusive video에 대한 정보를 알기 위해서 videos.reportAbuse 메소드를 호출하면, 해당 요청은 videoAbuseReportReason 리소스의 정보를 사용하여 비디오가 보고되는 이유를 확인해 줍니다.

A videoAbuseReportReason resource contains information about a reason that a video would be flagged for containing abusive content.
When your application calls the videos.reportAbuse method to report an abusive video, the request uses the information from a videoAbuseReportReason resource to identify the reason that the video is being reported.

 

videosAbuseReport 리소스에 다음 메소드를 지원합니다.

 

- list

abusive videos로 신고된 사유를 검색합니다.

 

10-2. videoCategory

업로드된 동영상과 연결되었거나 연결할 수 있는 카테고리를 확인해 줍니다.

 

API는 videoCateogory 리소스에 다음 메소드를 지원합니다.

- list

YouTube 동영상과 연결할 수 있는 카테고리의 목록을 반환합니다.

 


11. Watermarks

지정된 채널의 동영상을 재생하는 동안 표시되는 이미지를 확인해 줍니다.

또한 동영상 재생 중 워터마크가 표시되는 시기와 표시되는 시간의 길이를 정하는 타이밍 세부정보뿐 아니라 이미지가 연결되는 타겟 채널도 지정할 수 있습니다.

 

watermarks 리소스에 다음 메소드를 지원합니다.

 

- set

YouTube에 워터마크 이미지를 업로드하고 채널에 설정합니다.

- unset

워터마크를 삭제합니다. 

728x90

ORM 

데이터베이스 시스템에 저장된 데이터를 객체로 표현하기 위한 변환하는 것을 말합니다.

그 반대로, 객체에 저장된 데이터를 데이터베이스 시스템에 저장하기 위해 데이터를 변환하는 것을 말합니다.

 

 

엘로퀸트 ORM

라라벨이 제공하는ORM 구현체의 이름입니다.

라라벨에서 데이터베이스의 데이터를 객체로 변환해 놓은 것입니다.

데이터 모델 정도로 이해하면 편할 거 같네요.

 


1. MYSQL에 authors, posts 테이블을 만듭니다.

create table authors(
id int(11) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
name varchar(20) NOT NULL default '',
email varchar(255) NOT NULL default '',
pwd varchar(60) NOT NULL default '',
profiles text NOT NULL,
regDate datetime NOT NULL
)ENGINE=InnoDB DEFAULT Charset=UTF8 Collate=utf8_unicode_ci;

 

create table posts(
	id int(11) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
	title varchar(255) NOT NULL default '',
	contents TEXT NOT NULL,
	regDate datetime NOT NULL
)ENGINE=InnoDB DEFAULT Charset=UTF8 Collate=utf8_unicode_ci;

 

2. tinker 를 이용해서 authors, posts 테이블에 insert 하기

 

 

$ php artisan tinker

>>> DB::insert('insert into authors(name, email,pwd,profiles, regDate)values(?,?,?,?, now())', ['한치로', 'hanchiro@naver.com','password','']);

>>> DB::insert('insert into posts(title,contents,regDate)values(?,?,now())', ['hello chiro','고마워 tinker 야']);

>>> DB::insert('insert into posts(title,contents,regDate)values(?,?,now())', ['잘지내고 있나요?','잘 지내고 있나요? 전 요즈음 영어공부를 하고 있어요']);

>>> DB::insert('insert into posts(title,contents,regDate)values(?,?,now())', ['how do you today?','how do you today? those day I have been study english']);

 

3. 모델 만들기 - php artisan make:model

php artisan make:model Post

php artisan make:model Author

hanui-MacBook-Pro:NationalPension hanchiro$ php artisan make:model Post
Model created successfully.
hanui-MacBook-Pro:NationalPension hanchiro$ php artisan make:model Author
Model created successfully.
hanui-MacBook-Pro:NationalPension hanchiro$ 

 

모델을 만들게 되면 laravel프로젝트안에 Author.php 와 Post.php 라는 파일이 만들어 집니다.

 

 

 

4. DB Tablre 과 객체 연결하기

Author.php, Post.php  파일에서 각각 

protected $table = '테이블명'; 

을 추가해줍니다.

5. php artisan tinker에서 객체 실행해 보기

App\Author::get();
App\Post::get();

hanui-MacBook-Pro:NationalPension hanchiro$ php artisan tinker
Psy Shell v0.9.12 (PHP 7.1.1 — cli) by Justin Hileman
>>> 
>>> 
>>> App\Author::get();
=> Illuminate\Database\Eloquent\Collection {#2915
     all: [
       App\Author {#2916
         id: 1,
         name: "한치로",
         email: "hanchiro@naver.com",
         pwd: "password",
         profiles: "",
         regDate: "2020-02-12 17:32:05",
       },
     ],
   }
>>> App\Post::get();
=> Illuminate\Database\Eloquent\Collection {#2919
     all: [
       App\Post {#2918
         id: 1,
         title: "hello chiro",
         contents: "고마워 tinker 야",
         regDate: "2020-02-12 16:12:02",
       },
       App\Post {#2917
         id: 2,
         title: "잘지내고 있나요?",
         contents: "잘 지내고 있나요? 전 요즈음 영어공부를 하고 있어요",
         regDate: "2020-02-12 16:12:39",
       },
       App\Post {#2914
         id: 3,
         title: "how do you today?",
         contents: "how do you today? those day I have been study english",
         regDate: "2020-02-12 16:14:16",
       },
     ],
   }
>>> 

 

객체와 DB 가 제대로 연결되어 나타나네요..ㅋㅋㅋ

 


6. php artisan tinker 으로 새로운 row  레코드 만들기

>>> $author = new App\Author;

>>> $author->get();

>>> $author->save()

hanui-MacBook-Pro:NationalPension hanchiro$ php artisan tinker
Psy Shell v0.9.12 (PHP 7.1.1 — cli) by Justin Hileman
>>> $author = new App\Author;
=> App\Author {#2903}
>>> $author->get();
=> Illuminate\Database\Eloquent\Collection {#2904
     all: [
       App\Author {#2911
         id: 1,
         name: "한치로",
         email: "hanchiro@xxx.com",
         pwd: "password",
         profiles: "",
         regDate: "2020-02-12 17:32:05",
       },
     ],
   }
>>> $author->email
=> null
>>> $author->email ='hanchiro@xxx.com';
=> "hanchiro@xxx.com"
>>> $author->password='111222';
=> "111222"
>>> $author->save()

Illuminate/Database/QueryException with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'password' in 'field list' (SQL: insert into `authors` (`email`, `password`, ...

로 시작하면서 password 라는 필드가 없다고 에러를 내네요.

Illuminate/Database/QueryException with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'password' in 'field list' (SQL: insert into `authors` (`email`, `password`, `updated_at`, `created_at`) values (hanchiro@xxx.com, 111222, 2020-02-13 01:17:22, 2020-02-13 01:17:22))'

 

6-1. public $timestamps = false;

->save() 를 사용하게 되면 호출에서 예외가 발생합니다.

>>> $author = new App\Author
=> App\Author {#2909}
>>> $author->email ='hanchiro@xxx.com';
=> "hanchiro@xxx.com"
>>> $author->pwd='111222';
=> "111222"
>>> $author->save()
Illuminate/Database/QueryException with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'updated_at' in 'field list' (SQL: insert into `authors` (`email`, `pwd`, `updated_at`, `created_at`) values (hanchiro@xxx.com, 111222, 2020-02-13 01:24:47, 2020-02-13 01:24:47))'

 

이게 뭐냐면 엘로퀸트는 모든 테이블에 update_at와 create_at라는 datetime 필드를 자동으로 만들어 줍니다.

그래서 우리가 tinker 에서 row 정보를 만들어서 insert하고자 할대 update_at, create_at필드를 자동으로 추가해서 insert 구문을 만들어요.

그런데 실제 우리 MySQL의 Authors 테이블에는 이런 update_at, create_at 필드가 없죠.

그래서 에러가 나는 겁니다.

이를 해결 하기 위해서는 아래와 같이  public $timestamps = false; 를 model을 상속받은 Author 모델에 override 해줍니다.

// Model extends를 하면 datetime의 created_at, 와 updated_at 가 자동 생성되어진다.
   // 이를 없애기 위해서 아래의 옵션을 준다.
   // 별도의 table에 등록일자, 수정일자를 두고 있다면 아래와 같이 옵션을 주자.
   public $timestamps = false;

 

App/Author.php 파일에 public $timestamps = false;  추가

 

 

결국 메모리에 남아 있기 때문에 새로 $author = new App\Author;  부터 다시 만들었습니다.

여러번 실수를 하게 되었네요.

>>> $author = new App\Author
=> App\Author {#2903}
>>> $author->email ='hanchiro@xxx.com';
=> "hanchiro@xxx.com"
>>> $author->pwd='111222';
=> "111222"
>>> $author->save()
Illuminate/Database/QueryException with message 'SQLSTATE[HY000]: General error: 1364 Field 'profiles' doesn't have a default value (SQL: insert into `authors` (`email`, `pwd`) values (hanchiro@xxx.com, 111222))'
>>> $author->profiles = '프로필';
=> "프로필"
>>> $author->save()
Illuminate/Database/QueryException with message 'SQLSTATE[HY000]: General error: 1364 Field 'regDate' doesn't have a default value (SQL: insert into `authors` (`email`, `pwd`, `profiles`) values (hanchiro@xxx.com, 111222, 프로필))'
>>> $author->re;
readme.md  resources/ 
>>> $author->regDate = now();
=> Illuminate\Support\Carbon @1581557248 {#2916
     date: 2020-02-13 01:27:28.535030 UTC (+00:00),
   }
>>> $author->save()
=> true

 

>>> $author = new App\Author
=> App\Author {#2903}
>>> $author->email ='hanchiro@xxx.com';
=> "hanchiro@xxx.com"
>>> $author->pwd='111222';
=> "111222"
>>> $author->profiles = '프로필';
=> "프로필"
>>> $author->regDate = now();
=> Illuminate\Support\Carbon @1581557248 {#2916
     date: 2020-02-13 01:27:28.535030 UTC (+00:00),
   }
>>> $author->save()
=> true

 

실제 mysql  DB에 등록되었는지 확인해보세요.

이런 전 이름을 안넣었네요 ^^;;



7. App\Author::create / protected $fillable  / protected $guarded

hanui-MacBook-Pro:NationalPension hanchiro$ php artisan tinker
Psy Shell v0.9.12 (PHP 7.1.1 — cli) by Justin Hileman
>>> App\Author::create([
... 'email'=>'hanchiro@zzz.com',
... 'profiles'=>'프로필',
... 'name'=>'에버런'
... 'pwd'=>bcrypt('password'),
PHP Parse error: Syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ')' or ']' on line 5
>>> App\Author::create([
'email'=>'hanchiro@zzz.com',
'profiles'=>'프로필',
'name'=>'에버런',
'pwd'=>bcrypt('password'),
... ]);
Illuminate/Database/QueryException with message 'SQLSTATE[HY000]: General error: 1364 Field 'profiles' doesn't have a default value (SQL: insert into `authors` (`email`, `pwd`) values (hanchiro@zzz.com, $2y$10$qIfbUYenMqUPxERQCjEkTexZ2sIbCRDBCboacN1qbR89MlzTZquyO))'

 

엘로퀸트는 데이터베이스를 대량할당을 할때 필드마다 특성이 있을 수 있기 때문에 보호 장치를 2가지 뒀습니다.

1. $fillable 프로퍼티로 허용할 필드를 배열로 넣어주면 됩니다.

protected $fillable = [];
2. $guarded 프로퍼티로 금지할 필드를 배열로 넣어 주면 됩니다.
protected $guarded = [];

 

 

그리고 나서 다시 App\Author::create([]); 로 row 를 저장하니 제대로 등록이 되네요.

>>> App\Author::create([
... 'name'=>'에버런',
... 'email'=>'hanchiro@zzz.com',
... 'profiles'=>'프로필',
... 'pwd'=>bcrypt('password'), 
... 'regDate'=>now()
... ]);
=> App\Author {#2912
     email: "hanchiro@zzz.com",
     profiles: "프로필",
     pwd: "$2y$10$nFAC6nPoY6IV.gCU579.fO12d.PWFFHSr037H0J3EigJ9ispgrd4W",
     regDate: Illuminate\Support\Carbon @1581557855 {#2921
       date: 2020-02-13 01:37:35.643235 UTC (+00:00),
     },
     id: 3,
   }
>>> App\Author::get()
=> Illuminate\Database\Eloquent\Collection {#2899
     all: [
       App\Author {#2901
         id: 1,
         name: "한치로",
         email: "hanchiro@yyy.com",
         pwd: "password",
         profiles: "",
         regDate: "2020-02-12 17:32:05",
       },
       App\Author {#2900
         id: 2,
         name: "",
         email: "hanchiro@xxx.com",
         pwd: "111222",
         profiles: "프로필",
         regDate: "2020-02-13 01:27:28",
       },
       App\Author {#2902
         id: 3,
         name: "",
         email: "hanchiro@zzz.com",
         pwd: "$2y$10$nFAC6nPoY6IV.gCU579.fO12d.PWFFHSr037H0J3EigJ9ispgrd4W",
         profiles: "프로필",
         regDate: "2020-02-13 01:37:35",
       },
     ],
   }
>>> 

 

728x90

라라벨의 기능중에서 DB관련 파사드 지원해 줍니다.

SQL 삽입 과 같은 악의적 공격 원천 차단하기 위해서 파사드를 사용합니다.

이를 이용해서 실제 DB에 데이터를 넣고 테스트를 할 수 있습니다.

그중에서 tinker의 사용법을 알아보겠습니다


1. Mysql 유저 생성 및 DB 생성하기 (mysql DB서버에 접속할 로그인 정보를 만든다고 생각하세요)

hanui-MacBook-Pro:NationalPension hanchiro$ mysql -u root -p

Enter password: 

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 15

Server version: 5.7.16 MySQL Community Server (GPL)



Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.



Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.



Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.



 

 

mysql > use mysql;
mysql > create database posts;
-- posts 라는 데이터베이스를 만들었습니다.

mysql > create USER '유저' IDENTIFIED BY '비밀번호';
-- 유저로 '유저' 라는 아이디를 만들어서 '비밀번호'와 함께 생성해줍니다.

mysql > grant all privileges on posts.* to '유저';
-- posts 로 시작하는 DB에 대해서 posts라는 데이터베이스 를 찾아서 '유저'에 대해 권한을 부여합니다.

mysql > flush privileges;
-- 해당 설정값이 mysql 에 적용이 되도록 해줍니다.

mysql > quit;
-- 나옵니다.

 

mysql > use mysql;
mysql > create database posts;
mysql > create USER 'postsID' IDENTIFIED BY 'postsPASSWORD';
mysql > grant all privileges on posts.* to 'postsID';
mysql > flush privileges;
mysql > quit;

 

생성한 DB명 : posts

생성한 USER아이디 : postsID

생성한 PASSWORD : postsPASSWORD

 

를 만들어 뒀습니다.(꼭 수정해서 mysql DB 를 만들어 쓰세요 ^^)

그리고 이 DB 로그인 정보는 꼭 기억해 두세요.

 

 

2. posts 테이블 만들기

mysql  서버에 접속해서 posts DB에 접속한 다음에  "use posts"  로 posts DB로 이동합니다.

hanui-MacBook-Pro:NationalPension hanchiro$ mysql -u root -p

Enter password: 

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 15

Server version: 5.7.16 MySQL Community Server (GPL)



Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.



Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.



Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use posts

 

아래와 같이 posts  데이터베이스 안에 posts라는 테이블을 만들어 줍니다.

create table posts(
	id int(11) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
	title varchar(255) NOT NULL default '',
	contents TEXT NOT NULL,
	regDate datetime NOT NULL
)ENGINE=InnoDB DEFAULT Charset=UTF8 Collate=utf8_unicode_ci;

 

 


3. laravel 설정파일 .env 파일에 파란박스 부분에 DB 를 생성할때의 내용을 입력 해줍니다.

1. 번에서 생성한

생성한 DB명 : posts

생성한 USER아이디 : postsID

생성한 PASSWORD : postsPASSWORD

를 .env 파일에 똑같은 쌍으로 입력 해주세요

 

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=생성한 DB명
DB_USERNAME=생성한 USER아이디
DB_PASSWORD=생성한 PASSWORD

 

 

 

 


4. php artisan tinker 사용하기!! 

hanui-MacBook-Pro:NationalPension hanchiro$ php artisan tinker

Psy Shell v0.9.12 (PHP 7.1.1 — cli) by Justin Hileman

 

DB::insert

>>> DB::insert('insert into posts(title,contents,regDate)values(?,?,now())', ['hello chiro','고마워 tinker 야']);

>>> DB::insert('insert into posts(title,contents,regDate)values(?,?,now())', ['잘지내고 있나요?','잘 지내고 있나요? 전 요즈음 영어공부를 하고 있어요']);

>>> DB::insert('insert into posts(title,contents,regDate)values(?,?,now())', ['how do you today?','how do you today? those day I have been study english']);

 

>>> DB::insert('insert into posts(title,contents,stDate)values(?,?,now()), ['hello chiro','고마워 tinker 야']);

PHP Parse error: Syntax error, unexpected T_STRING, expecting ')' on line 1

>>> DB::insert('insert into posts(title,contents,stDate)values(?,?,now()), ['hello chiro','고마워 tinker 야']');

PHP Parse error: Syntax error, unexpected T_STRING, expecting ')' on line 1

>>> DB::insert('insert into posts(title,contents,stDate)values(?,?,now())', ['hello chiro','고마워 tinker 야']);

Illuminate/Database/QueryException with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'stDate' in 'field list' (SQL: insert into posts(title,contents,stDate)values(hello chiro,고마워 tinker 야,now()))'


>>> DB::insert('insert into posts(title,contents,regDate)values(?,?,now())', ['hello chiro','고마워 tinker 야']);

=> true

>>> DB::table('posts')->get();

=> Illuminate\Support\Collection {#2910

     all: [

       {#2900

         +"id": 1,

         +"title": "hello chiro",

         +"contents": "고마워 tinker 야",

         +"regDate": "2020-02-12 16:12:02",

       },

     ],

   }


>>> DB::insert('insert into posts(title,contents,regDate)values(?,?,now())', ['잘지내고 있나요?','잘 지내고 있나요? 전 요즈음 영어공부를 하고 있어요']);

=> true

>>> DB::insert('insert into posts(title,contents,regDate)values(?,?,now())', ['how do you today?','how do you today? those day I have been study english']);

=> true

>>> DB::table('posts')->get();

=> Illuminate\Support\Collection {#2914

     all: [

       {#2913

         +"id": 1,

         +"title": "hello chiro",

         +"contents": "고마워 tinker 야",

         +"regDate": "2020-02-12 16:12:02",

       },

       {#2896

         +"id": 2,

         +"title": "잘지내고 있나요?",

         +"contents": "잘 지내고 있나요? 전 요즈음 영어공부를 하고 있어요",

         +"regDate": "2020-02-12 16:12:39",

       },

       {#2908

         +"id": 3,

         +"title": "how do you today?",

         +"contents": "how do you today? those day I have been study english",

         +"regDate": "2020-02-12 16:14:16",

       },

     ],

   }

 

DB::select

>>> $posts = DB::select('select * from posts');

>>> $posts[0]->title;

>>> $posts[1]->title;

>>> $posts[3]->title;

>>> $posts[2]->title;

>>> $posts = DB:select('select * from posts');

PHP Parse error: Syntax error, unexpected ':' on line 1

>>> $posts = DB::select('select * from posts');

=> [

     {#2915

       +"id": 1,

       +"title": "hello chiro",

       +"contents": "고마워 tinker 야",

       +"regDate": "2020-02-12 16:12:02",

     },

     {#2907

       +"id": 2,

       +"title": "잘지내고 있나요?",

       +"contents": "잘 지내고 있나요? 전 요즈음 영어공부를 하고 있어요",

       +"regDate": "2020-02-12 16:12:39",

     },

     {#2912

       +"id": 3,

       +"title": "how do you today?",

       +"contents": "how do you today? those day I have been study english",

       +"regDate": "2020-02-12 16:14:16",

     },

   ]

>>> $posts[0]->title;

=> "hello chiro"

>>> $posts[1]->title;

=> "잘지내고 있나요?"

>>> $posts[3]->title;

PHP Notice:  Undefined offset: 3 in Psy Shell code on line 1

>>> $posts[2]->title;

=> "how do you today?"

>>> $post = DB:selectOne('select * from posts');

PHP Parse error: Syntax error, unexpected ':' on line 1

 

DB::selectOne

>>> $post = DB::selectOne('select * from posts');

>>> $post = DB::selectOne('select * from posts');



=> {#2909

     +"id": 1,

     +"title": "hello chiro",

     +"contents": "고마워 tinker 야",

     +"regDate": "2020-02-12 16:12:02",

   }

>>> $post->title;

=> "hello chiro"

>>> 

 

DB::table('posts')->first();

>>> DB::table('posts')->last();

>>> DB::table('posts')->first();
=> {#2920
     +"id": 1,
     +"title": "hello chiro",
     +"contents": "고마워 tinker 야",
     +"regDate": "2020-02-12 16:12:02",
   }

 

DB::table('posts')->last(); 는 안되네요

>>> DB::table('posts')->last();

BadMethodCallException with message 'Call to undefined method Illuminate/Database/Query/Builder::last()'

 

 

 

 

>>> DB::table('posts')->find(); 는 안되네요

>>> DB::table('posts')->find();
TypeError: Too few arguments to function Illuminate/Database/Query/Builder::find(), 0 passed in Psy Shell code on line 1 and at least 1 expected

 

DB::table('posts')->find(2);

>>> DB::table('posts')->find(2);

=> {#2918

     +"id": 2,

     +"title": "잘지내고 있나요?",

     +"contents": "잘 지내고 있나요? 전 요즈음 영어공부를 하고 있어요",

     +"regDate": "2020-02-12 16:12:39",

   }

 

>>> DB::table('posts')->find(1,2); 안되요

>>> DB::table('posts')->find(1,2);

TypeError: Argument 1 passed to Illuminate/Database/Grammar::columnize() must be of the type array, integer given, called in /Users/hanchiro/dev/workspace_php/NationalPension/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/Grammar.php on line 131

 

DB::table('posts')->find([1,2]); 이건 좀 이상하네요.

>>> DB::table('posts')->find([1,2]);

=> {#2914

     +"id": 1,

     +"title": "hello chiro",

     +"contents": "고마워 tinker 야",

     +"regDate": "2020-02-12 16:12:02",

   }

>>> DB::table('posts')->find([2,3]);

=> {#2920

     +"id": 2,

     +"title": "잘지내고 있나요?",

     +"contents": "잘 지내고 있나요? 전 요즈음 영어공부를 하고 있어요",

     +"regDate": "2020-02-12 16:12:39",

   }

 

DB::table('posts')->find([2]);

>>> DB::table('posts')->find([2]);

=> {#2900

     +"id": 2,

     +"title": "잘지내고 있나요?",

     +"contents": "잘 지내고 있나요? 전 요즈음 영어공부를 하고 있어요",

     +"regDate": "2020-02-12 16:12:39",

   }

 

DB::table('posts')->find([1-2]); --> null 이 나오네요

>>> DB::table('posts')->find([1-2]);

=> null

 

 

DB::table('posts')->where('id=1); 은 안되요

>>> DB::table('posts')->where('id=1);

PHP Parse error: Syntax error, unexpected T_ENCAPSED_AND_WHITESPACE on line 1

 

DB::table('posts')->where('id','=',1); 에서 ->get()을 해줘야 해요.

>>> DB::table('posts')->where('id','=',1);

=> Illuminate\Database\Query\Builder {#2924

     +connection: Illuminate\Database\MySqlConnection {#2904},

     +grammar: Illuminate\Database\Query\Grammars\MySqlGrammar {#2903},

     +processor: Illuminate\Database\Query\Processors\MySqlProcessor {#2902},

     +bindings: [

       "select" => [],

       "join" => [],

       "where" => [

         1,

       ],

       "having" => [],

       "order" => [],

       "union" => [],

     ],

     +aggregate: null,

     +columns: null,

     +distinct: false,

     +from: "posts",

     +joins: null,

     +wheres: [

       [

         "type" => "Basic",

         "column" => "id",

         "operator" => "=",

         "value" => 1,

         "boolean" => "and",

       ],

     ],

     +groups: null,

     +havings: null,

     +orders: null,

     +limit: null,

     +offset: null,

     +unions: null,

     +unionLimit: null,

     +unionOffset: null,

     +unionOrders: null,

     +lock: null,

     +operators: [

       "=",

       "<",

       ">",

       "<=",

       ">=",

       "<>",

       "!=",

       "<=>",

       "like",

       "like binary",

       "not like",

       "ilike",

       "&",

       "|",

       "^",

       "<<",

       ">>",

       "rlike",

       "regexp",

       "not regexp",

       "~",

       "~*",

       "!~",

       "!~*",

       "similar to",

       "not similar to",

       "not ilike",

       "~~*",

       "!~~*",

     ],

     +useWritePdo: false,

   }

 

 

DB::table('posts')->where('id','=',1)->get();

DB::table('posts')->where('id',1)->get();

DB::table('posts')->whereId('1')->get();

 

id가 1인 테이블 정보를 가져오는 똑같은 표현식입니다.

>>> DB::table('posts')->where('id','=',1)->get();

=> Illuminate\Support\Collection {#2932

     all: [

       {#2930

         +"id": 1,

         +"title": "hello chiro",

         +"contents": "고마워 tinker 야",

         +"regDate": "2020-02-12 16:12:02",

       },

     ],

   }

>>> DB::table('posts')->where('id',1)->get();

=> Illuminate\Support\Collection {#2919

     all: [

       {#2899

         +"id": 1,

         +"title": "hello chiro",

         +"contents": "고마워 tinker 야",

         +"regDate": "2020-02-12 16:12:02",

       },

     ],

   }


>>> DB::table('posts')->whereId('1')->get();

=> Illuminate\Support\Collection {#2924

     all: [

       {#2932

         +"id": 1,

         +"title": "hello chiro",

         +"contents": "고마워 tinker 야",

         +"regDate": "2020-02-12 16:12:02",

       },

     ],

   }

 

 

DB::table('posts')->where(function($query){ $query->whereId(1); })->get();

콜백 함수로 where 절에 대한 조건문을 입력할 수 있어요.

 

>>> DB::table('posts')->where(function($query){ $query->whereId(1); })->get();

=> Illuminate\Support\Collection {#2937

     all: [

       {#2936

         +"id": 1,

         +"title": "hello chiro",

         +"contents": "고마워 tinker 야",

         +"regDate": "2020-02-12 16:12:02",

       },

     ],

   }

>>> 

 

728x90

Spring Boot Starter & Parent 로 간단히 의존성 설정하기

http://dveamer.github.io/backend/SpringBootStater.html

 

 

순수 Java 프로젝트는 필요한 라이브러리를 사용하기 위해선 라이브러리 파일들을 직접 보관하고 관리해야 했습니다. 

 

Maven, Gradle과 같은 프로젝트 관리 툴을 이용하면서 라이브러리의 정보, 버전, 의존성을 문서(pom.xml, build.gradle)에 작성만 해도 라이브러리를 사용할 수 있게 되었고 덕분에 관리와 공유할 수 있게 되었습니다.

하지만 여전히 라이브러리간의 의존성 관리와 버전 충돌은 우리들이 직접 해결하고 매번 작성해야 합니다.

 

Python은 PIP라는 패키지 매니저를 통해 패키지를 설치하면 해당 패키지와 의존성을 갖는 패키지 조합을 사전에 정의되어있는 버전에 맞게 자동으로 설치해줍니다.

PHP 7 에서는 composer를 통해서 이런 작업들을 할 수 있게 도와주고 있습니다.

nodejs 에서는 npm 에서 이런 작업들을 도와주고 있습니다.

 

그리고 Spring boot 에서도 이런 라이브러리 간의 의존성관리 및 버전 충돌에 대한 이슈를 굉장히 쉽고 빠르고 정확하게 의존성 설정을 할 수 있도록 도와주는 라이브러리가 있습니다.

 

그것이 바로 spring-boot-stater와 spring-boot-stater-parent입니다.

Spring 진영에서는 이러한 문제를 해결해주는 spring-boot-starter와 spring-boot-stater-parent를 제공했습니다. 

Spring Boot를 사용하면서 자주 사용하게 되는 라이브러리간의 의존성, 버전 조합을 각각 테스트한 뒤 공개했다고 보시면 됩니다. 

Spring 진영의 신뢰성 높은 검증을 거친 이 의존성 조합은 비록 세상 모든 라이브러리의 조합을 커버하지는 못하지만 자주 사용되는 라이브러리들에 대해서만큼은 스트레스를 받지 않고 설정할 수 있게 해줍니다.


Spring Boot Starter

프로젝트에 설정해야 할 다수의 의존성들을 사전에 미리 정의해서 의존성 조합 제공

Spring Boot에서는 spring-boot-starter라는 사전에 미리 정의한 편리한 의존성 조합을 제공합니다.

프로젝트에 설정해야하는 다수의 의존성들을 starter가 이미 포함하고 있기 때문에 우리는 starter에 대한 의존성 추가만으로도 프로젝트를 시작하거나 새로운 기능을 추가할 수 있습니다.

 

예를들어, 기존에 aspectJ를 이용한 AOP를 이용하고 싶으면

org.springframework:spring-aop 의존성과 org.aspectj:aspectjweaver 의존성을 추가해서 사용했었지만

Spring Boot에선는 spring-boot-starter-aop 의존성만 추가하면 aspectJ를 사용하기 위한 모든 의존성 조합이 추가 됩니다.

의존성 조합의 간단한 예가 AOP였던 거고 좀 더 복잡한 의존성 조합을 보고 싶으시다면 다른 starter를 확인해 보시기 바랍니다. 

 

 

또다른 예시로 spring-boot-starter-jpa를 의존성 추가했을 때 아래와 같은 일을 해줍니다.

  • spring-aop, spring-jdbc 등의 의존성을 걸어준다.

  • classpath를 뒤져서 어떤 Database를 사용하는지 파악하고, 자동으로 entityManager를 구성해 준다.

  • 해당 모듈들 설정에 필요한 properties 설정을 제공한다. (Configuration Processor를 사용하면 효과 UP)

spring-boot-starter-data-jpa v2.1.7.RELEASE은 7개의 의존성 조합을 포함하고 있고 잘 살펴보시면 그 7개의 의존성 중에 또 다른 spring-boot-starter가 존재해서 실제는 7개보다 더 많은 의존성이 설정되어 있습니다.

또한 중복되어 문제가 되는 의존성에서 대해서는 exclusion 설정도 되어 있습니다.

 

즉, spring-boot-starter-jpa 모듈을 추가함으로써 아래의 7가지 의존성 조합에 대한 부분을 알아서 정리해주고 관리해줍니다.

<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-aop</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-jdbc</artifactId>
		</dependency>
		<dependency>
			<groupId>javax.transaction</groupId>
			<artifactId>javax.transaction-api</artifactId>
		</dependency>
		<dependency>
			<groupId>javax.xml.bind</groupId>
			<artifactId>jaxb-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-core</artifactId>
			<exclusions>
				<exclusion>
					<groupId>org.jboss.spec.javax.transaction</groupId>
					<artifactId>jboss-transaction-api_1.2_spec</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.springframework.data</groupId>
			<artifactId>spring-data-jpa</artifactId>
			<exclusions>
				<exclusion>
					<groupId>org.aspectj</groupId>
					<artifactId>aspectjrt</artifactId>
				</exclusion>
				<exclusion>
					<groupId>org.slf4j</groupId>
					<artifactId>jcl-over-slf4j</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-aspects</artifactId>
		</dependency>
</dependencies>

 

spring-boot-starter-web 에 설정된 pom.xml 

<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starters</artifactId>
    <version>2.2.1.RELEASE</version>
  </parent>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-web</artifactId>
  <version>2.2.1.RELEASE</version>
  <name>Spring Boot Web Starter</name>
  <description>Starter for building web, including RESTful, applications using Spring
		MVC. Uses Tomcat as the default embedded container</description>
  <url>https://projects.spring.io/spring-boot/#/spring-boot-parent/spring-boot-starters/spring-boot-starter-web</url>
  <organization>
    <name>Pivotal Software, Inc.</name>
    <url>https://spring.io</url>
  </organization>
  <licenses>
    <license>
      <name>Apache License, Version 2.0</name>
      <url>https://www.apache.org/licenses/LICENSE-2.0</url>
    </license>
  </licenses>
  <developers>
    <developer>
      <name>Pivotal</name>
      <email>info@pivotal.io</email>
      <organization>Pivotal Software, Inc.</organization>
      <organizationUrl>https://www.spring.io</organizationUrl>
    </developer>
  </developers>
  <scm>
    <connection>scm:git:git://github.com/spring-projects/spring-boot.git</connection>
    <developerConnection>scm:git:ssh://git@github.com/spring-projects/spring-boot.git</developerConnection>
    <url>https://github.com/spring-projects/spring-boot</url>
  </scm>
  <issueManagement>
    <system>Github</system>
    <url>https://github.com/spring-projects/spring-boot/issues</url>
  </issueManagement>
  <dependencies>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter</artifactId>
      <version>2.2.1.RELEASE</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-json</artifactId>
      <version>2.2.1.RELEASE</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-tomcat</artifactId>
      <version>2.2.1.RELEASE</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-validation</artifactId>
      <version>2.2.1.RELEASE</version>
      <scope>compile</scope>
      <exclusions>
        <exclusion>
          <artifactId>tomcat-embed-el</artifactId>
          <groupId>org.apache.tomcat.embed</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-web</artifactId>
      <version>5.2.1.RELEASE</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-webmvc</artifactId>
      <version>5.2.1.RELEASE</version>
      <scope>compile</scope>
    </dependency>
  </dependencies>
</project>

1. Spring Boot Starter는 우리가 찾아서 설정해야 하는 것들을 미리 작성해야 보다 쉽고 빠르고 정확하게 의존성 설정을 할 수 있게 해줍니다.

2. 프로젝트를 진행하면서, 공통적으로 사용하는 spring  설정을 모듈로 묶어놓고 사용할 수 있게 해줍니다.

3. 필요한 경우, 상위 프로젝트에서 얼마든지 설정을 덮어 쓸 수 있게 해줍니다.

 

 

spring-boot-starter 작성하기

https://supawer0728.github.io/2018/03/15/create-spring-boot-starter/


Spring Boot Starter Parent 

해당 의존성 조합간의 충돌문제가 없는 검증된 버전정보 조합을 제공

 

프로젝트 시작 시기에 다양한 라이브러리들을 사용하게되면 라이브러리 버전간의 충돌문제가 발생할 수 있습니다.

Sprign Boot의 starter가 의존성 조합을 제공해준다면 starter-parent는 해당 의존성 조합간의 충돌 문제가 없는 검증 된 버전정보 조합을 제공합니다.

spring-boot-starter-parent 2.1.7.RELEASE에서 제공하는 버전정보 조합은 Maven repository - spring-boot-stater-parent 혹은 GitHub - spring-boot-stater-parent 에서 확인 가능합니다.

우리는 아래와 같이 spring-boot-starter-parent 버전만 설정해도 수많은 라이브러리들의 버전충돌 문제를 피할 수 있습니다.

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.7.RELEASE</version>
</parent>

<dependencies>
    ...(생략)

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-aop</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
</dependencies>


특정 의존성이 버전을 변경하고자 한다면 아래와 같이 properties를 이용해서 해당 의존성 버전을 override하면 됩니다.

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.7.RELEASE</version>
</parent>

<properties>
    <aspectj.version>1.9.4</aspectj.version>
</properties>

<dependencies>
    ...(생략)

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-aop</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
</dependencies>

 

1. spring-boot-starter-parent 라이브러리를 사용해서 추가하는 라이브러리 모듈에 대한 버전을 가이드합니다.

2. <version> 태그를 추가하지 않아도 parent 에서 자동으로 처리해줍니다.

3. <version>에 대한 내용을 변경하고자 할 경우에는 <properties> 태그를 이용해서 변경, override 해줍니다.

 

728x90

 

나는 Java/ Maven Project 를 intelliJ IDEA에서 하고 있습니다.

그런데 내가 test 를 실행할려고 할때, 아래 그림과 같이 "Noting Here" 라는 메세지가 나오면서 실행이 안되네요.

그래서 한참을 찾다가 아래와 같은 해결책을 발견하여 공유합니다.

(I have a Java / maven project in IntelliJ IDEA, but when I try to run a test I got the message "Nothing Here")

 

1. 단계

- Preferences.. 에서 Plugins 탭에서 Gradle을 찾아보세요.

- Gradle이 설치되어 있는지 살펴보고 설치되어 Enable 되어 있다면 Disable 해주세요.

Apply 버튼을 클릭하시고 IntelliJ IDEA 를 Restart 합니다.

재 실행해서 보시면 아래와 같이 뜬다면 1단계는 성공 입니다~~!!!

 

2. 단계 : disabled_plugins.txt 를 찾아 아래 내용을 삭제합니다.

org.jetbrains.idea.gradle.ext
org.jetbrains.plugins.gradle
org.jetbrains.plugins.gradle.maven

 

전 여러개의 버전이 존재하는데 현재 2019.3 버전을 사용하고 있네요.

./Library/Preferences/IntelliJIdea2018.1/disabled_plugins.txt
./Library/Preferences/IntelliJIdea2019.3/disabled_plugins.txt
./Library/Preferences/IntelliJIdea2017.2/disabled_plugins.txt
./Library/Preferences/IntelliJIdea2019.2/disabled_plugins.txt
./Library/Preferences/IntelliJIdea2017.3/disabled_plugins.txt
./Library/Preferences/IntelliJIdea2018.3/disabled_plugins.txt
./Library/Preferences/IntelliJIdea2016.2/disabled_plugins.txt
./Library/Preferences/IntelliJIdea2018.2/disabled_plugins.txt
./Library/Preferences/IntelliJIdea2016.3/disabled_plugins.txt
./Library/Preferences/IntelliJIdea2017.1/disabled_plugins.txt
./Library/Preferences/IntelliJIdea2019.1/disabled_plugins.txt

 

# vi  ./Library/Preferences/IntelliJIdea2019.3/disabled_plugins.txt

CFML Support
CloudFoundry
DevKit
GlassFish
IdeaVIM
JBoss
JSR45Plugin
Jetty
Resin
WebSphere
Weblogic
com.intellij.dmserver
com.intellij.drools
com.intellij.gradle
com.intellij.gwt
com.intellij.javaee.view
com.intellij.jboss.arquillian
com.intellij.jboss.core
com.intellij.seam
com.intellij.seam.pageflow
com.intellij.seam.pages
com.intellij.struts2
com.intellij.tapestry
com.intellij.uiDesigner
cucumber-groovy
org.intellij.grails
org.jetbrains.android
org.jetbrains.idea.gradle.ext  <<--- 찾았다 요놈!!!

 

그래도 해결 안된다면!!

마지막으로 위의 1,2단계로 해도 해결이 되지 않는다면 idea.log파일을 열어두고 해당 이슈에 대해 반복발생시켜서 살펴봐야 합니다.

(Help | Show Log In Explorer)

 

If it doesn't help, attach your idea.log file after reproducing the issue (Help | Show Log in Explorer).

 


참고 URL 

https://youtrack.jetbrains.com/issue/IDEA-228180?_ga=2.175130594.1707466865.1580292427-909525344.1568791489

https://stackoverflow.com/questions/59784808/cant-run-test-on-intellij-idea

+ Recent posts