[root@localhost bin]# ./httpd -t

httpd: Syntax error on line 150 of /usr/local/apache/conf/httpd.conf: Cannot load modules/libphp5.so into server: /usr/local/apache/modules/libphp5.so: undefined symbol: unixd_config

아파치 시동시에 위와 같은 에러가 뜬다.

버전정보는

Server version: Apache/2.4.53 (Unix)
PHP 5.2.17 (cli)

보통 위 에러는 apache2와 php4.x로 컴파일 할때에 생기는 오류지만 apache2.4와 php5.2에서도 발생이 되기도 한다.
php압축해제경로/sapi/apache2handler/에서 php_functions.c 파일을 일부 수정한다.
 
[PHP 5.2.17 의 경우]

>line 386

#if !defined(WIN32) && !defined(WINNT) && !defined(NETWARE)
        AP_DECLARE_DATA extern unixd_config_rec ap_unixd_config;
#endif

 

>line 417

#if !defined(WIN32) && !defined(WINNT) && !defined(NETWARE)
        snprintf(tmp, sizeof(tmp), "%s(%d)/%d", ap_unixd_config.user_name, ap_unixd_config.user_id, ap_unixd_config.group_id);
        php_info_print_table_row(2, "User/Group", tmp);
#endif

 

재 컴파일 후 Syntax 테스트

[root@localhost bin]# ./httpd -t
Syntax OK

[PHP 4.4.8 의 경우]

php4소스파일에서 아래 경로의 파일을 수정해야합니다.

/sapi/apache2handler/php_functions.c

붉게 표시된 부분을 기존 unixd_config -> ap_unixd_config로 수정

373라인
AP_DECLARE_DATA extern unixd_config_rec unixd_config;

404라인
snprintf(tmp, sizeof(tmp), "%s(%d)/%d", unixd_config.user_name, unixd_config.user_id, unixd_config.group_id);

ap_get_server_version -> ap_get_server_banner로 수정

327라인
return (char *) ap_get_server_version();

수정 후 에 재 컴파일

출처 : https://rootrator.tistory.com/112

 

apache 시동시 에러 "undefined symbol: unixd_config"

[root@localhost bin]# ./httpd -thttpd: Syntax error on line 150 of /usr/local/apache/conf/httpd.conf: Cannot load modules/libphp5.so into server: /usr/local/apache/modules/libphp5.so: undefined symbol: unixd_config 아파치 시동시에 위와 같은 에

rootrator.tistory.com

출처 : https://darksharavim.tistory.com/333

 

[PHP]libphp4.so: undefined symbol 오류

환경 : centos7+apache2.4.6(RPM)+php4.4.9(src) 위 환경에서 아파치 구동시 아래와 같이 오류가 발생하여 확인해본 결과 libphp4.so: undefined symbol: unixd_config libphp4.so: undefined symbol: ap_get_server_version apache버전업

darksharavim.tistory.com

 

기본적으로 php 7.2 버전 이상부터는 mcypt 를 지원하지 않는다
편법으로 mcrypt를 설치해본자
기존에 웹서버(apache 2.4 ) / php 7.3 버전은 설치되어 있다

현재 php에 mcrypt가 설치되어 있는지 확인해보면 아무런 정보가 표시되지 않는다 즉 미설치 상태

[root@xinet ~]# php -i | grep mcrypt

1. libmcrypt 다운로드 및 설치 ( 만약 설치되어 있다면 패스)

[root@xinet ~]# wget https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/l/libmcrypt-2.5.8-13.el7.x86_64.rpm

[root@xinet ~]# wget https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/l/libmcrypt-devel-2.5.8-13.el7.x86_64.rpm

[root@xinet ~]# rpm -Uvh libmcrypt-*

2. mcyrpt 1.0 파일 다운로드 및 phpize 이용 설치 (php 8.0은 mcrypt-1.0.3 / php 8.1의 경우 mcrypt-1.0.4 다운로드할 것)

[root@localhost ~]# wget https://pecl.php.net/get/mcrypt-1.0.3.tgz

[root@localhost ~]# tar xvfz mcrypt-1.0.3.tgz 

[root@localhost ~]# cd mcrypt-1.0.3

[root@localhost mcrypt-1.0.2]# /usr/local/php/bin/phpize 
Configuring for:
PHP Api Version:         20190902
Zend Module Api No:      20190902
Zend Extension Api No:   320190902

[root@localhost mcrypt-1.0.2]# ./configure --with-php-config=/usr/local/php/bin/php-config 

[root@localhost mcrypt-1.0.2]# make 

[root@localhost mcrypt-1.0.2]# make install
Installing shared extensions:     /usr/local/php/lib/php/extensions/debug-zts-20190902/

3. 파일을 확인하고  파일을 php.ini에서 인식

[root@localhost mcrypt-1.0.2]# ls -l /usr/local/php/lib/php/extensions/debug-zts-20190902/
합계 1732
-rwxr-xr-x 1 root root  105840  8월 10 15:48 mcrypt.so
-rwxr-xr-x 1 root root 1665344  7월 27 17:54 opcache.so

[root@localhost mcrypt-1.0.2]# vi /usr/local/apache/conf/php.ini 

extension=mcrypt.so

4. 웹서버 재시작

[root@localhost mcrypt-1.0.2]# systemctl restart httpd

 

출처 : https://xinet.kr/?p=2975


출처 : http://blog.netchk.net/?p=1204


CentOS 6.x 버전에서 php.4.4 컴파일 과정 중 make 시 오류

Centos 6.6 32bit
php 4.4.9
openssl-1.0.1e-30.el6_6.4.i686
openssl-devel-1.0.1e-30.el6_6.4.i686

 

php 설치 중 make 작업시 에러발생
make: *** [ext/openssl/openssl.lo] Error 1

 

여기 참고 해서 openssl.c 를 교체

 

wget http://www.softel.co.jp/blogs/tech/wordpress/wp-content/uploads/2012/10/openssl.c
cp openssl.c ext/openssl/openssl.c

또는 첨부파일   openssl.c 



* Test Environment

 

CentOS 5.x 32bit

 

Red : 강조

Blue : 명령어 & 메뉴이동

Green : 주석

Pink : 변수

Purple : 예시

Orange : 출력&편집&소스

 

* Incident

 

svn 설치과정 중 apxs 파일관련 오류가 발생하여 해당 파일을 실행하였더니 아래와 같이 오류가 발생하였다.

[root@mooon]# /usr/local/apache_svn/bin/apxs -h

/usr/local/apache_svn/bin/apxs: /replace/with/path/to/perl/interpreter: bad interpreter: No such file or directory 

 

 

 

* Resolution

위 오류가 발생한 이유는 시스템상에 perl 이 없는 상태에서 소스설치를 진행하여 apxs 파일이 perl을 찾지 못해 발생하는 오류이다.

perl을 설치하고 apxs 파일을 수정하면 해결 된다.

[root@mooon]# yum install perl

[root@mooon]# vi /usr/local/apache_svn/bin/apxs

#!/replace/with/path/to/perl/interpreter -w // 삭제 

#!/usr/bin/perl -w // 추가 

 

 

 * Reference 

 

http://wnstjqdl.tistory.com/23 



서버를 이전 또는 동일한 옵션의 APM 을 다른 서버에 설치하게 될 경우 기존 APM 옵션을 알아야 하는데

따로 적어두지 않았을 경우에는 곤란함이 있다.


[14.48.175.179 서버 기준]


1.apache 소스 컴파일 옵션 확인

cat /usr/local/apache/build/config.nice

#! /bin/sh
#
# Created by configure

"./configure" \
"--prefix=/usr/local/httpd-2.2.27" \
"--sysconfdir=/etc/httpd/conf" \
"--enable-modules=most" \
"--enable-mods-shared=most" \
"--enable-ssl" \
"--enable-rewrite" \
"--enable-so" \
"$@"


2. php 소스 컴파일 옵션 확인

/usr/local/php/bin/php-config | grep configure

 --configure-options [--prefix=/usr/local/php-5.3.28 --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --with-config-file-path=/etc/httpd/conf --with-iconv --with-mcrypt=/usr --with-ncurses=/usr --with-gdbm=/usr --with-zlib=/usr --with-openssl --with-kerberos=/usr --with-imap-ssl=/usr --with-gd=/usr --with-jpeg-dir=/usr --with-png-dir=/usr --with-zlib-dir=/usr --with-xpm-dir=/usr --with-freetype-dir=/usr --with-pic --with-curl --with-dbm --disable-libtool-lock --disable-short-tags --disable-debug --disable-ipv6 --enable-inline-optimization --enable-zend-multibyte --enable-fast-install --enable-safe-mode --enable-magic-quotes --enable-calendar --enable-ftp --enable-sockets --enable-gd-native-ttf --enable-gd-jis-conv --enable-dba=shared --enable-exif --enable-zip --enable-mbstring --enable-dbase --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-bcmath --enable-shmop --enable-xml --with-mysqli=/usr/local/mysql/bin/mysql_config --with-libdir=lib64]

3. mysql 소스 컴파일 옵션 확인

grep -i configure_line /usr/local/mysql/bin/mysqlbug

CONFIGURE_LINE="./configure  '--prefix=/usr/local/mysql-5.0.96' '--with-mysqld-user=mysql' '--localstatedir=/mysql/data' '--with-charset=utf8' '--with-extra-charsets=all' '--with-pthreads' '--enable-thread-safe-client' '--enable-named-pipe' '--enable-shared' '--with-openssl' '--with-big-tables' '--with-readline' '--without-debug' '--without-docs' '--without-bench'"
`test -n "$CONFIGURE_LINE"  && echo "Configure command: $CONFIGURE_LINE"`


[출처] http://jelbin.tistory.com/63


httpd-2.4.3 버전과  php-5.2.14 버전을 설치하였다.

php 5.2 설치 후에 apache를 start 하게 되면 다음과 같은 메시지가 나오면서 apache가 정상적으로 작동을 하지 않았다.

httpd: Syntax error on line 146 of /usr/local/apache/conf/httpd.conf: Cannot load modules/libphp5.so into server: /usr/local/apache/modules/libphp5.so: undefined symbol: unixd_config

아파치의 버전업으로 인해서 해당 심볼의 명칭이 바뀌었다. unixd_config -> ap_unixd_config로 변경

src/php-5.2.14/sapi/apache2handler/php_functions.c

안에서 unixd_config -> ap_unixd_config 로 변경하면 된다. 총 2군데 4번 변경하면 된다.

그리고 나서 다시 컴파일을 하게 되면 문제 없이 실행이 된다.

[출처] http://sclow.tistory.com/entry/apache-24-php-52-설치시-libphp5so-undefined-symbol-unixdconfig-오류

 ./configure --prefix=/usr/local/mysql --sysconfdir=/etc --with-charset=euckr --with-extra-charsets=complex --with-mysqld-user=mysql --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static
make
make install

[컴파일 옵션 설명]

--prefix=/usr/local/mysql : 컴파일후 관련된 파일들이 설치되는 디렉토리,기본값 : /usr/local 

 --exec-prefix = EPREFIX : 기본값은  --prefix에서 지정한 값과 동일.

 --bin-dir = DIR : 클라이언트 실핼파일과 스크립들이 저장되는 디렉토리, 기본값은 PREFIX/bin

 --libexec=DIR : mysql 데몬, 기본값은 PREFIX/libexec

 --localstatedir=/usr/local/mysql/data : 사용자의 데이터와 로그파일를 저장할 디렉토리 지정, 기본값은 PREFIX/var

 --with-charset=utf8 : utf8로 charset 지정. utf-8로 하면 에러.

 --with-extra-charsets=all : 추가 charset 지정, none,complex,all 또는 charset 리스트

 --with-unix-socket-path=/tmp/mysql.sock : 소켓디렉토리 , 기본값은 /tmp 또는 /var/run

 --with-tcp-port=3306 : 포트 지정. 기본값은 3306

 --with-mysqld-user=mysql : 데몬실행 계정 지정

 --with-debug : debug code추가 , 사용안하는 경우 without 옵션으로

 --without-readline : 콘솔에서 한글 입력가능

 --enable-thread-safe-client : 쓰레드 지원

 --without-server : 서버 기능 없이 클라이언트로만 사용하고자 할 때 즉 클라이언트로만 사용할 때

 --enable-assembler : 어셈블러  함수 지원

 --with-client-ldflags=-all-static : 클라이언트 실행 파일 생성시 라이브러리를 포함하도록 지정, 정적으로 컴파일

 --with-mysqld-ldflags=-all-static : 데몬실행파일 생성시 라이브러리를 포함하도록 지정,정적으로 컴파일

 --sysconfdir=/etc : 설정파일 디렉토리지정

 --with-mit-threads : 강제로 MIT-pthreads 를 실행하고자 할때