본문 바로가기

Server Dev

CentOS 아파치 + PHP 설치 연동

아파치 설치되어있다는 가정

아피치 설치방법 : http://88oy.tistory.com/326



php 다운로드


 http://kr1.php.net/downloads.php

php-5.5.14.tar.gz (sig) 다운로드




php 압축풀기

 tar xvf php-5.5.14.tar.gz


php 설치 

cd php-5.5.14

./configure --enable-maintainer-zts --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --libdir=/usr/lib64 --with-libdir=lib64 \

--with-mysql=/usr/local/mariadb \

--with-mysqli=/usr/local/mariadb/bin/mysql_config \

--with-pdo-mysql=shared,/usr/local/mariadb \

--with-regex=php --with-libxml-dir=/usr \

--with-openssl --with-pcre-regex \

--with-zlib --with-bz2 --with-curl \

--with-gdbm --with-db4=/usr --with-dbm \

--with-pcre-dir=/usr --with-openssl-dir=/usr \

--with-libxml-dir=/usr \

--with-gd \

--with-vpx-dir=/usr --with-jpeg-dir=/usr --with-png-dir=/usr \

--with-zlib-dir=/usr --with-xpm-dir=/usr \

--with-freetype-dir=/usr --with-t1lib=/usr \

--with-gettext --with-gmp --with-mhash \

--with-imap --with-imap-ssl \

--with-kerberos \

--with-icu-dir=/usr \

--with-ldap --with-ldap-sasl \

--with-libmbfl --with-onig \

--with-mcrypt \

--with-libedit --with-readline \

--with-tidy \

--with-libexpat-dir=/usr --with-xmlrpc --with-xsl \

--with-pear --with-pic \

--with-libdir=lib64 \

--enable-bcmath --enable-calendar \

--enable-exif --enable-ftp --enable-pcntl \

--enable-gd-native-ttf --enable-gd-jis-conv \

--enable-intl --enable-mbstring \

--enable-shmop --enable-sockets \

--enable-sysvmsg --enable-sysvsem --enable-sysvshm \

--enable-wddx --enable-zip \

--enable-mysqlnd \

--enable-dba=shared --enable-mod-charset \

--enable-dom --enable-mbregex --enable-inline-optimization \

--enable-sigchild --enable-soap \

--enable-maintainer-zts \

--enable-opcache=no

make

make install 




설치중 아래 와 같은 에러가 날때

xml2-config not found. Please check your libxml2 installation.

아래 명령어를 쳐서 설치후 다시 시도 하세요.

yum install libxml2-devel


64Bit OS 상에서 PHP 컴파일시 아래와 같이 메세지가 나오는 경우 조치방법

 

에러메세지)
configure: error: libjpeg.(a|so) not found

보통은 아래 처럼 libjpeg 관련 패키지를 설치하면 되지만
  
# yum install libjpeg-devel
  
해결이 되지 않을 경우 아래와 같이 수정을 해보세요
  
# ln -s /usr/lib64/libjpeg.so /usr/lib/
# ln -s /usr/lib64/libpng.so /usr/lib/


gd 라이브러리 설치

# yum install gd

# yum install gdbm-devel




php -v 명령어를 치면 php 설치정보를 알수 있습니다.

나오지 않을경우 

/root/.bash_profile에 /usr/local/php/bin를 추가해주세요

PATH=$PATH:$HOME/bin:/usr/local/php/bin


httpd.conf에 아래 사항 추가

<IfModule php5_module>

    <FilesMatch "\.php$">
        SetHandler application/x-httpd-php
    </FilesMatch>
    <FilesMatch "\.phps$">
        SetHandler application/x-httpd-php-source
    </FilesMatch>
</IfModule>

<? ?> php코드를 안먹을때

php.ini파일을 확인하세요.

변경전 :  short_open_tag = Off

변경후 :  short_open_tag = On



본포스팅은 아래 링크들을 참고하여 작성하였습니다.


http://drewsymo.com/2013/11/php-configure-error-xml2-config-not-found-please-check-your-libxml2-installation/


http://www.cubrid.com/zbxe/?document_srl=98646&mid=bbs_developer_tutorial


https://kldp.org/node/129397


http://dkyo.co.kr/board_jGFP45/164


http://dkyo.co.kr/board_jGFP45/164


https://kldp.org/node/31645


http://www.atblog.co.kr/?p=6287

의존성 설치 관련 링크

http://dev1.egloos.com/v/4649819

https://coderwall.com/p/ggmpfa/php-configuration-error-and-solutions-in-rpm

http://crybit.com/20-common-php-compilation-errors-and-fix-unix/