MySQL datetime 날짜로 select하기

MySQL datetime 날짜로 select하기 select 컬럼명 from 테이블명 where date(컬럼명)='2018-01-23'; select 컬럼명 from 테이블명 where 컬럼명 between '2018-01-20' and '2018-01-24'; 위의 2가지 방법이 가장 기본적인 쿼리이다.

APM 구버전 설치 (4) PHP 5.2 and phpMyAdmin

#php설치를 가장 조심해서 해야 할 듯 싶다. 내가 많이 해보진 않았지만 초반과정에서 인스턴스만 약 30개 가량 지웠다 다시만들었다를 반복한듯..

&PHP설치

1.압축풀고 설치하고!



$wget 'http://storage.googleapis.com/google-code-attachments/php52-backports/issue-16/comment-2/libxml29_compat.patch'

$patch -p0 < ./libxml129_compat.patch




$./configure --prefix=/usr/local/server/php --with-mcrypt --with-apxs2=/usr/local/server/apache/bin/apxs --with-mysql=/usr/local/server/mysql --with-mysqli=/usr/local/server/mysql/bin/mysql_config --with-config-file-path=/usr/local/server/apache/conf --disable-debug --enable-safe-mode --enable-track-vars --enable-sockets --with-mod_charset --with-charset=utf8 --with-xml --with-language=korean --enable-curl --enable-mailparse --enable-calender --enable-syssvsem=yes --enable-sysvshm=yes --enable-ftp --enable-magic-quotes --enable-gd-native-ttf --enable-url-includes --enable-trans-id --enable-inline-optimization --enable-bcmath --with-jpeg --with-png --with-zlib --with-jpeg-dir=/usr --with-png-dir=/usr/lib --with-freetype-dir=/usr --with-libxml-dir=/usr --enable-exif --with-gd --with-ttf --with-gettext --enable-sigchild --enable-mbstring

$make && make install

2.configure 에러들이 생길 수 있다.

configure: error: libjpeg.(a|so) not found.
configure: error: libpng.(a|so) not found.

- configure 중 해당 라이브러리가 없어 나는 에러
- 아래의 라이브러리 설치
yum install libjpeg-devel
yum install libpng-devel

64bit 운영체제에서 해결이 됨.
ln -s /usr/lib64/libjpeg.so /usr/lib
ln -s /usr/lib64/libpng.so /usr/lib


3.PHP의 환경 설정을 한다.

$cp php.ini-dist /usr/local/server/apache/conf/php.ini

4.Apache와 연동을 위해서 httpd.conf 파일을 수정을 해야 한다.

$vi /usr/local/server/apache/conf/httpd.conf

:set number

#219번째 줄 수정
 DirectoryIndex index.html index.php

#360~364중에 추가를 해줌
    360     AddType application/x-compress .Z
    361      AddType application/x-gzip .gz .tgz
    362
    363     AddType application/x-httpd-php .php
    364     AddType application/x-httpd-php-source .phps

4.설치 테스트를 해본다.

$/etc/init.d/httpd restart

#테스트 페이지를 만들어서 php의 정보를 보여주는 함수를 사용해 본다.

$vi /usr/local/server/apache/htdocs/phpinfo.php
<? phpinfo(); ?>

#phpinfo를 만들고 sudo service httpd restart를 해야 바로 보이더라는 것이지.

#추가로 설치를 하고나서 나 같은 경우는 curl 을 재설치를 해줬다 안보이길래! 
 ZendOptimizer도 설치를 해줘야 한다.




&phpMyAdmin 설치

$ mv phpMyAdmin-2.11.10 phpMyAdmin
일단, 이름이 너무 기므로 phpMyAdmin으로 바꿔줌.


$ mv phpMyAdmin /usr/local/server/apache/htdocs/
/var/www/html의 위치는 해당 서버의 DocumentRoot에 따라서 달라짐. 
이제 설정파일 하나만 편집해주시면 됨니다. vim이나 vi, nano와 같은 텍스트 편집기 이용
$ vi /usr/local/server/apache/htdocs/phpMyAdmin/libraries/config.default.php
해당 파일 내에서 아래의 두 부분을 편집해줌
  • $cfg[‘PmaAbsoluteUri’] = ”; —> $cfg[‘PmaAbsoluteUri’] = ‘http://[서버주소]/phpMyAdmin/‘;
  • $cfg[‘Servers’][$i][‘auth_type’] = ‘config‘; —> $cfg[‘Servers’][$i][‘auth_type’] = ‘http‘;
PmaAbsoluteUri의 경우에는 설정을 안해도 동작 그런데 auth_type은 반드시 http로 바꿔줘용. config의 경우에는 config.inc.php 파일 내에 아이디와 비밀번호를 저장하는 방식이고, http는 .htaccess를 이용해서 MySQL 내의 계정(리눅스나 유닉스의 계정이 아닌 MySQL 내의 계정)을 이용해서 접속을 하는 방식. 아이디와 비밀번호는 파일로 보관하는 것은 권장할 만한 사항이 아니므로 http를 이용함.

댓글

이 블로그의 인기 게시물

3계층 구조( 3 Tier Architecture )

GET방식과 POST방식이란? ( PHP )

MySQL Index태우기가 뭐에요?