mariadb-10.2.14 / PHP 7.0.16 설치시 아래와 같이 mysqli 에러 발생
make: *** [ext/mysqli/mysqli_prop.lo] Error 1
make: *** [ext/mysqli/mysqli_api.lo] Error 1
In file included from /root/src/php-7.0.16/ext/mysqli/php_mysqli_structs.h:63,
from /root/src/php-7.0.16/ext/mysqli/mysqli_fe.c:32:
/opt/mysql/include/mysql/my_global.h:3:2: warning: #warning This file should not be included by clients, include only <mysql.h>
In file included from /root/src/php-7.0.16/ext/mysqli/php_mysqli_structs.h:79,
from /root/src/php-7.0.16/ext/mysqli/mysqli_fe.c:32:
/opt/mysql/include/mysql/my_sys.h:3:2: warning: #warning This file should not be included by clients, include only <mysql.h>
In file included from /root/src/php-7.0.16/ext/mysqli/mysqli_fe.c:32:
/root/src/php-7.0.16/ext/mysqli/php_mysqli_structs.h:82:21: error: my_list.h: No such file or directory
/root/src/php-7.0.16/ext/mysqli/php_mysqli_structs.h:83:22: error: m_string.h: No such file or directory
/root/src/php-7.0.16/ext/mysqli/php_mysqli_structs.h:86:21: error: m_ctype.h: No such file or directory

보통 이런경우 구글에다가 검색해보면 

phpbug 사이트에 나오는 경우가 종종 있다.

https://bugs.php.net/patch-display.php?bug_id=75612&patch=mysql-mariadb-10.3.patch&revision=latest

나온대로 소스 수정해서 설치하면 됨


ex)해결책은 아래와 같이 소스 수정하라고 나와있음 그중에서diff -up php-7.2.4/ext/mysqli/mysqli_api.c.omv~ php-7.2.4/ext/mysqli/mysqli_api.c
ㄴ여기 보면 수정해야할 소스 경로 나오죠 ? vi로 php-7.2.4/ext/mysqli/mysqli_api.c 들어가서
--- php-7.2.4/ext/mysqli/mysqli_api.c.omv~ 2018-04-06 21:50:05.183703414 +0200
+++ php-7.2.4/ext/mysqli/mysqli_api.c 2018-04-06 21:50:16.436829372 +0200
@@ -616,7 +616,7 @@ PHP_FUNCTION(mysqli_change_user)
ㄴ616 라인에 보면
  size_t   user_len, password_len, dbname_len;
  zend_ulong  rc;
 #if !defined(MYSQLI_USE_MYSQLND) && defined(HAVE_MYSQLI_SET_CHARSET)
- const  CHARSET_INFO * old_charset;
+ const  MY_CHARSET_INFO * old_charset;
ㄴ위의 내용이 있습니다. 저기서 - 부분은 삭제(혹은 주석) 하고 + 부분은 추가, 즉 CAHRSET_INFO 를 MY_CHARSET_INFO 로변경
 #endif
 
  if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Osss!", &mysql_link, mysqli_link_class_entry, &user, &user_len, &password, &password_len, &dbname, &dbname_len) == FAILURE) {
diff -up php-7.2.4/ext/mysqli/mysqli.c.omv~ php-7.2.4/ext/mysqli/mysqli.c
ㄴ위에서 한것처럼 똑같이 vi 로 php-7.2.4/ext/mysqli/mysqli.c 열고
--- php-7.2.4/ext/mysqli/mysqli.c.omv~ 2018-04-06 21:49:41.782434506 +0200 +++ php-7.2.4/ext/mysqli/mysqli.c 2018-04-06 21:49:52.708561249 +0200 @@ -26,6 +26,7 @@ ㄴ26번 라인보면 #include <signal.h> +#include <server/mysql_version.h> ㄴ여기는 따로 삭제할필요없이 위 내용만 추가하면 되겠죠 ? 이런식으로 어느 파일을 열어서 어느 라인에 추가 삭제 혹은 수정한다음 컴파일 하면 됩니다. #include "php.h" #include "php_ini.h" #include "ext/standard/info.h" diff -up php-7.2.4/ext/mysqli/mysqli_nonapi.c.omv~ php-7.2.4/ext/mysqli/mysqli_nonapi.c --- php-7.2.4/ext/mysqli/mysqli_nonapi.c.omv~ 2018-04-06 21:51:43.217399945 +0200 +++ php-7.2.4/ext/mysqli/mysqli_nonapi.c 2018-04-06 21:58:52.799445824 +0200 @@ -263,7 +263,7 @@ void mysqli_common_connect(INTERNAL_FUNC php_mysqli_set_error(mysql_errno(mysql->mysql), (char *) mysql_error(mysql->mysql)); #if !defined(MYSQLI_USE_MYSQLND) - mysql->mysql->reconnect = MyG(reconnect); +/* mysql->mysql->reconnect = MyG(reconnect); */ #endif mysql_options(mysql->mysql, MYSQL_OPT_LOCAL_INFILE, (char *)&MyG(allow_local_infile)); diff -up php-7.2.4/ext/mysqli/mysqli_prop.c.omv~ php-7.2.4/ext/mysqli/mysqli_prop.c --- php-7.2.4/ext/mysqli/mysqli_prop.c.omv~ 2018-04-06 21:50:25.687842714 +0200 +++ php-7.2.4/ext/mysqli/mysqli_prop.c 2018-04-06 21:50:35.116768902 +0200 @@ -23,6 +23,7 @@ #include <signal.h> +#include <server/mysql_version.h> #include "php.h" #include "php_ini.h" #include "ext/standard/info.h" diff -up php-7.2.4/ext/mysqli/php_mysqli_structs.h.omv~ php-7.2.4/ext/mysqli/php_mysqli_structs.h --- php-7.2.4/ext/mysqli/php_mysqli_structs.h.omv~ 2018-04-06 21:49:12.161080045 +0200 +++ php-7.2.4/ext/mysqli/php_mysqli_structs.h 2018-04-06 21:58:44.599503172 +0200 @@ -79,11 +79,7 @@ #include <my_sys.h> #include <mysql.h> #include <errmsg.h> -#include <my_list.h> -#include <m_string.h> #include <mysqld_error.h> -#include <my_list.h> -#include <m_ctype.h> #include "mysqli_libmysql.h" #endif /* MYSQLI_USE_MYSQLND */ @@ -326,7 +322,7 @@ ZEND_BEGIN_MODULE_GLOBALS(mysqli) char *default_user; char *default_socket; char *default_pw; - zend_long reconnect; +/* zend_long reconnect; */ zend_long allow_local_infile; zend_long strict; zend_long error_no;




참고로 위 에러는 centos 7 에 php 7.2 - mariadb 10.3 설치시 php 컴파일할 ㄸ ㅐ에러 난다.

이거 작성할때는 위와같이 소스파일 수정하면 잘 됐었는데 오늘(2019-05-28) 해보니까 또 다른 에러가 난다.

In file included from /root/src/php-7.2.18/Zend/zend.h:29:0,

                 from /root/src/php-7.2.18/main/php.h:35,

                 from /root/src/php-7.2.18/ext/mysqli/mysqli_driver.c:25:

/root/src/php-7.2.18/ext/mysqli/mysqli_driver.c: In function ‘driver_reconnect_read’:

/root/src/php-7.2.18/Zend/zend_API.h:183:76: error: ‘zend_mysqli_globals’ has no member named ‘reconnect’

 #define ZEND_MODULE_GLOBALS_ACCESSOR(module_name, v) (module_name##_globals.v)

                                                                            ^

/root/src/php-7.2.18/Zend/zend_types.h:671:5: note: in definition of macro ‘ZVAL_BOOL’

    (b) ? IS_TRUE : IS_FALSE; \

     ^

/root/src/php-7.2.18/ext/mysqli/php_mysqli_structs.h:337:16: note: in expansion of macro ‘ZEND_MODULE_GLOBALS_ACCESSOR’

 #define MyG(v) ZEND_MODULE_GLOBALS_ACCESSOR(mysqli, v)

                ^

/root/src/php-7.2.18/ext/mysqli/mysqli_driver.c:35:20: note: in expansion of macro ‘MyG’

  ZVAL_BOOL(retval, MyG(value)); \

                    ^

/root/src/php-7.2.18/ext/mysqli/mysqli_driver.c:120:1: note: in expansion of macro ‘MAP_PROPERTY_MYG_BOOL_READ’

 MAP_PROPERTY_MYG_BOOL_READ(driver_reconnect_read, reconnect)

 ^

In file included from /root/src/php-7.2.18/main/php.h:39:0,

                 from /root/src/php-7.2.18/ext/mysqli/mysqli_driver.c:25:

/root/src/php-7.2.18/ext/mysqli/mysqli_driver.c: In function ‘driver_reconnect_write’:

/root/src/php-7.2.18/Zend/zend_API.h:183:76: error: ‘zend_mysqli_globals’ has no member named ‘reconnect’

 #define ZEND_MODULE_GLOBALS_ACCESSOR(module_name, v) (module_name##_globals.v)

                                                                            ^

/root/src/php-7.2.18/ext/mysqli/php_mysqli_structs.h:337:16: note: in expansion of macro ‘ZEND_MODULE_GLOBALS_ACCESSOR’

 #define MyG(v) ZEND_MODULE_GLOBALS_ACCESSOR(mysqli, v)

                ^

/root/src/php-7.2.18/ext/mysqli/mysqli_driver.c:42:2: note: in expansion of macro ‘MyG’

  MyG(value) = Z_LVAL_P(value) > 0; \

  ^

/root/src/php-7.2.18/ext/mysqli/mysqli_driver.c:121:1: note: in expansion of macro ‘MAP_PROPERTY_MYG_BOOL_WRITE’

 MAP_PROPERTY_MYG_BOOL_WRITE(driver_reconnect_write, reconnect)

 ^

make: *** [ext/mysqli/mysqli_driver.lo] Error 1


요런 에러 난다.


이거 해결 방법이 소스 파일 수정하지말고 
--with-mysqli=/opt/mysql/bin/mysql_config --with-pdo-mysql=/opt/mysql
처음 컴파일 옵션 위와같이 줫는데
--with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-mysql-sock=/tmp/mysql.sock

위와같이 바꿨다. 잘된다.


php 7 이상부터는 mysqli=path(경로)로 주지 말고 mysqlnd로 줘야 한다.

+ Recent posts