글목록

2014. 3. 25.

[CentOS 6.4] php 5.5.8 -> php 5.2.8 downgrade



CentOS 6.4 32bit
Apache 2.4.4 
Mysql 5.6.15




./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/lib --with-gd --with-freetype-dir=/usr/local/freetype --with-zlib --enable-sockets --enable-gd-native-ttf --with-png-dir=/usr/local/lib --with-jpeg-dir=/usr/local/lib --enable-sigchild --enable-magic-quotes --with-gettext --enable-mbstring --enable-inline-optimization --enable-bcmath --enable-shmop --enable-calendar --enable-ftp --with-gdbm --with-iconv=/usr/local/lib --enable-mbregex --with-imap --with-imap-ssl --with-openssl=/usr/local/openssl --with-curl --enable-soap --disable-debug --with-mcrypt=/usr/local/libmcrypt --with-kerberos



1. [ext/openssl/openssl.lo] Error 1 


/root/php-5.1.6/ext/openssl/openssl.c:206: error: expected specifier-qualifier-list before 'LHASH'
/root/php-5.1.6/ext/openssl/openssl.c:367: error: expected declaration specifiers or '...' before 'LHASH'
(中略)
/root/php-5.1.6/ext/openssl/openssl.c:2073: error: 'struct php_x509_request' has no member named 'priv_key_encrypt'


make: *** [ext/openssl/openssl.lo]  Error 1 



$ cd /usr/local/src
$ wget http://www.openssl.org/source/openssl-0.9.8e.tar.gz
$ tar zxvf openssl-0.9.8e.tar.gz
$ cd openssl-0.9.8e
$ ./config --prefix=/usr/local/openssl
$ make; make install



2.


/usr/local/src/php-5.2.8/ext/mysqli/mysqli.c: In function 'zm_startup_mysqli':

/usr/local/src/php-5.2.8/ext/mysqli/mysqli.c:644: error: 'MYSQL_RPL_MASTER' undeclared (first use in this function)
/usr/local/src/php-5.2.8/ext/mysqli/mysqli.c:644: error: (Each undeclared identifier is reported only once
/usr/local/src/php-5.2.8/ext/mysqli/mysqli.c:644: error: for each function it appears in.)
/usr/local/src/php-5.2.8/ext/mysqli/mysqli.c:645: error: 'MYSQL_RPL_SLAVE' undeclared (first use in this function)
/usr/local/src/php-5.2.8/ext/mysqli/mysqli.c:646: error: 'MYSQL_RPL_ADMIN' undeclared (first use in this function)
make: *** [ext/mysqli/mysqli.lo] Error 1
make: *** Waiting for unfinished jobs....

       -> mkdir /usr/local/mysql/include/mysql

           ln -s /usr/local/mysql/include/- /usr/local/mysql/include/mysql/
           make ZEND_EXTRA_LIBS = '-liconv' 


在安装nginx + mysql + php 的时候出现这样的错误:

/usr/local/src/php-5.2.15/ext/mysqli/mysqli.c:644: error: (Each undeclared identifier is reported only once
/usr/local/src/php-5.2.15/ext/mysqli/mysqli.c:644: error: for each function it appears in.)
/usr/local/src/php-5.2.15/ext/mysqli/mysqli.c:645: error: 'MYSQL_RPL_SLAVE' undeclared (first use in this function)
/usr/local/src/php-5.2.15/ext/mysqli/mysqli.c:646: error: 'MYSQL_RPL_ADMIN' undeclared (first use in this function)
make: *** [ext/mysqli/mysqli.lo] Error 1

这样真正的解决方法是:

修改/usr/local/include/mysql/mysql.h 文件内容:
mysql.h这个是根据个人安装的mysql路径来找  在mysql下面的include的mysql目录里  别搞错了)
找到
enum mysql_protocol_type 

MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET, 
MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY 
}; 

在这个中间添加这些内容
++++++++++++++++++++++++++++++++++++++++++++
/* 
There are three types of queries - the ones that have to go to 
the master, the ones that go to a slave, and the adminstrative 
type which must happen on the pivot connectioin 
*/ 
enum mysql_rpl_type 

MYSQL_RPL_MASTER, MYSQL_RPL_SLAVE, MYSQL_RPL_ADMIN 
};

++++++++++++++++++++++++++++++++++++++++++++
typedef struct character_set 

unsigned int number; /* character set number */ 
unsigned int state; /* character set state */ 
const char *csname; /* collation name */ 
const char *name; /* character set name */ 


3. make: *** [sapi/cli/php] Error 1 


--with-iconv=/usr/local/lib/



4.httpd: Syntax error on line 163 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로 수정하면된다.
파일 위치는 php-5.2.xxx/sapi/apache2hander/php_functions.c
-       AP_DECLARE_DATA extern unixd_config_rec unixd_config;
+       AP_DECLARE_DATA extern unixd_config_rec ap_unixd_config;
 #endif
        for (n = 0; ap_loaded_modules[n]; ++n) {
@@ -414,7 +414,7 @@
        php_info_print_table_row(2, "Hostname:Port", tmp);
 #if !defined(WIN32) && !defined(WINNT) && !defined(NETWARE)
-       snprintf(tmp, sizeof(tmp), "%s(%d)/%d", unixd_config.user_name, unixd_config.user_id, unixd_config.group_id);
+       snprintf(tmp, sizeof(tmp), "%s(%d)/%d", ap_unixd_config.user_name, ap_unixd_config.user_id, ap_unixd_config.group_id);
이렇게 바꾸고 compile하고 실행하면 문제없이 실행된다.





댓글 없음:

댓글 쓰기