본문 바로가기
Linux/APM

php 버전 변경 후 오류 (5.X <-> 7.X)

by aegypius 2020. 2. 29.
728x90
반응형

  php의 버전을 변경 한 후에 사이트가 정상작동이 안된다면 당연히 오류를 찾아내서 수정해야 한다. 하지만 사이트는 정상적으로 작동하고 있는데 서버에는 에러로그가 계속 쌓이고 있다면 빨리 찾아내기 어려울 수도 있다.

  php 5.6.x 버전을 7.3.x로 변경 후에 그누보드 5에서 다음과 같은 에러로그가 발생한다. 

PHP Warning:  Use of undefined constant wr_9 - assumed 'wr_9' (this will throw an Error in a future version of PHP)

  그 뒤에는 에러가 발생한 경로가 표시되어 있다. 위의 경우는 wr_9를 'wr_9'로 수정하면 해결되는 비교적 단순한 오류이며 그냥 두더라도 사이트의 운영에는 전혀 지장이 없다. 하지만 해결하지 않으면 서버의 에러로그를 점점 비대하게 만든다. php 마이그레이션에 대한 버전별 정리 자료는 php.net에 자세히 나와있다. 참고하자.

  이를 해결하기 위해서 php-fpm을 시도했는데......우선 기존에 설치되어 있던 php 7.3은 워드프레스 사이트들을 위해서 그대로 두고 그누보드를 위해서 php 5.6.40을 소스로 받아서 컴파일 했다. 한대의 서버에 여러버전의 php를 돌릴 계획이었다.

./configure --prefix=/usr/local/php56 --with-config-file-path=/usr/local/php56/etc --enable-fpm --enable-sigchild --with-libxml-dir --with-openssl --with-zlib --with-mysqli --with-zlib-dir --with-bz2 --enable-calendar --with-curl --enable-dba --with-gdbm --enable-exif --enable-ftp --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --enable-gd-native-ttf --with-gettext --with-imap --with-imap-ssl --with-kerberos --enable-mbstring --with-mhash --with-mcrypt --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --enable-opcache --enable-zip --with-pdo-mysql --with-snmp --enable-intl
configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.

  위의 오류를 해결하기 위해 libc-client-devel을 설치하고 다시 발생하는 아래의 로그에 krb5를 설치하는 등의 작업을 반복하여 결국 컴파일에 성공했다. 대략 5회 이상의 컴파일 작업을 반복한 듯 하다.

configure: error: Unable to detect ICU prefix or no failed. Please verify ICU install prefix and make sure icu-config works.

 

     <IfModule prox_fcgi_module>
         ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/accountDir/siteDir/$1
    </IfModule prox_fcgi_module>

  그리고 아파치의 해당 사이트의 설정부분을 아래와 같이 수정했다.

  php5.6을 적용한 사이트에서는 db connection 관련 오류가 발생한다. 컴파일 할 때의 옵션을 하나하나 살피던가 아니면 yum으로 설치된 5.6의 컴파일 옵션을 참고해야 겠다. docker를 테스트 해볼만한 적당한 핑계거리가 생긴것도 같다. 테스트를 위해서 VPS나 vmware를 생각중이다. 

  php fpm이나 docker 둘 중 하나다. php의 소스를 수정하는 것은 아직(?) 계획에 없으니까.....


php 5.3.29 컴파일옵션 

./configure --prefix=/usr/local/php53 --with-config-file-path=/usr/local/php53 --with-config-file-scan-dir=/etc/php53/php.d --with-libdir=lib64 --with-mysql --with-mysqli --enable-fpm --enable-mbstring --disable-debug --disable-rpath --with-bz2 --with-curl --with-gettext --with-iconv --with-openssl --with-gd --with-mcrypt --with-pcre-regex --with-zlib


php source compile 설치 시 오류메시지 

오류01 : /usr/bin/ld: cannot file -lltdl
( 해결 : yum install libtool-ltdl-devel )
* php 5.3.29 버전의 컴파일 설치 시 발생했던 오류

오류02 : configure: error: xml2-config not found. Please check your libxml2 installation.
( 해결 : yum install libxml2-devel )
* php 5.3.29 버전의 컴파일 설치 시 발생했던 오류

오류03 : error: Cannot find OpenSSL's 
( 해결 : yum install libmxl2-develyum install openssl-devel )
* php 5.3.29 버전의 컴파일 설치 시 발생했던 오류

오류04 : error: Please reinstall the BZip2 distribution
( 해결 : yum install bzip2-devel )
* php 5.3.29 버전의 컴파일 설치 시 발생했던 오류

오류05 : configure: error: Please reinstall the libcurl distribution -
    easy.h should be in /include/curl/

( 해결 : yum install bzip2-develyum install curl-devel )
* php 5.3.29 버전의 컴파일 설치 시 발생했던 오류

오류06 : configure: error: png.h not found.
( 해결 : yum install libpng-devel )
* php 5.3.29 버전의 컴파일 설치 시 발생했던 오류

오류07 : configure: error: mcrypt.h not found. Please reinstall libmcrypt.
( 해결 : yum install libmcrypt-devel )
* php 5.3.29 버전의 컴파일 설치 시 발생했던 오류

오류08 : configure: error: mcrypt.h not found. Please reinstall libmcrypt.
( 해결 : yum install libmcrypt-devel )
* php 5.3.29 버전의 컴파일 설치 시 발생했던 오류

오류09 : configure: error: mcrypt.h not found. Please reinstall libmcrypt.configure: error: Cannot find MySQL header files under yes.
           Note that the MySQL client library is not bundled anymore!

( 해결 : yum --enablerepo=remi install mysql-devel )
* php 5.3.29 버전의 컴파일 설치 시 발생했던 오류

기타 : Failed at step USER spawning /usr/libexec/mariadb-prepare-db-dir: No such process
      => mariadb를 최소 설치 후 실행되지 않고 이와같은 오류가 발생한다면
      1. 네트워크를 재시작 해보자. 2. 시스템을 리부팅 해보자 3. mariadb를 재설치 해보자.

728x90
반응형

댓글