找回密码
 注册
查看: 6|回复: 0

php 安装需要的模块以mysqli为例

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2024-1-6 21:10:09 | 显示全部楼层 |阅读模式
编译模块:切换到ext模块目录:
8 _9 G4 `; @2 Q+ V7 T" rcd /usr/src/php-8.3.1/ext/mysqli
  [5 g' i; q- P- `3 s. |' g切换到myqlli目录:5 `/ {/ w( ?* l  W9 N2 z' y3 N( J) N6 T
; b( e( l1 t# v+ g+ n# c
6 O, b7 F5 q( a- q: F1 D/ ?9 R
执行:
. P+ S- Z! l" P  g5 N; I0 ]/usr/local/php/bin/phpize
) a" s0 M- L$ OConfiguring for:
; |, Y0 ]+ o$ U  G5 U& f  X) @PHP Api Version:         202308317 A% T- ~1 y. l* `- v0 \% N" q, S
Zend Module Api No:      20230831+ L9 y4 O& S9 i' p9 |
Zend Extension Api No:   420230831; [7 Z; h# p! V% m2 C7 D: P

) c! a3 Y$ ?! U5 w9 D要检查config.m4文件  没有就复制一个吧:4 o" ]/ K8 X6 {$ y, H+ f8 c/ n

- X# s* h7 z, t; A2 W7 g% f" F+ A
0 Y9 r3 v/ L0 [$ J) Y通过configure配置php:
& c: _: s7 S  C& _7 a./configure --with-php-config=/usr/local/php/bin/php-config
# T: M2 ?; L/ ]% ]7 y3 C: R9 F
; N' Z- b6 _( i) J) {( O9 B编译并安装:+ N5 v& {2 X3 M3 _. K
make && make install $ C" U7 }# \. M
" u8 Y1 {* O' l4 D9 A# V" |
/bin/sh /usr/src/php-8.3.1/ext/mysqli/libtool --mode=link cc -shared -I/usr/src/php-8.3.1/ext/mysqli/include -I/usr/src/php-8.3.1/ext/mysqli/main -I/usr/src/php-8.3.1/ext/mysqli -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2 -D_GNU_SOURCE    -o mysqli.la -export-dynamic -avoid-version -prefer-pic -module -rpath /usr/src/php-8.3.1/ext/mysqli/modules  mysqli.lo mysqli_api.lo mysqli_prop.lo mysqli_nonapi.lo mysqli_report.lo mysqli_driver.lo mysqli_warning.lo mysqli_exception.lo mysqli_result_iterator.lo
. ?- k$ H1 u' dcc -shared  .libs/mysqli.o .libs/mysqli_api.o .libs/mysqli_prop.o .libs/mysqli_nonapi.o .libs/mysqli_report.o .libs/mysqli_driver.o .libs/mysqli_warning.o .libs/mysqli_exception.o .libs/mysqli_result_iterator.o   -Wl,-soname -Wl,mysqli.so -o .libs/mysqli.so% Y5 i1 p, m# g1 h
creating mysqli.la5 T! v3 }- }4 c. h7 W
(cd .libs && rm -f mysqli.la && ln -s ../mysqli.la mysqli.la)- p. B/ b4 L+ J6 T. J: h4 Q
/bin/sh /usr/src/php-8.3.1/ext/mysqli/libtool --mode=install cp ./mysqli.la /usr/src/php-8.3.1/ext/mysqli/modules% F) b8 I- [9 ]% d, f' ^& d3 L* ~
cp ./.libs/mysqli.so /usr/src/php-8.3.1/ext/mysqli/modules/mysqli.so
; H; M% u) b' D  _: p- s- F$ ~cp ./.libs/mysqli.lai /usr/src/php-8.3.1/ext/mysqli/modules/mysqli.la
; \( ]* K9 {0 W' H" nPATH="$PATH:/sbin" ldconfig -n /usr/src/php-8.3.1/ext/mysqli/modules
# Y6 o! I; o7 m  @----------------------------------------------------------------------! w/ p! q: w2 ?6 _
Libraries have been installed in:+ }4 o* Q2 n9 H. {5 \: W! ^
   /usr/src/php-8.3.1/ext/mysqli/modules- \. T! V4 L% u. L) y
3 S) S' q% g7 |) k7 v& T& [
If you ever happen to want to link against installed libraries- R+ ]9 K! m0 b: H' ^1 S$ o
in a given directory, LIBDIR, you must either use libtool, and9 ]6 ?) r* n  n$ S% d
specify the full pathname of the library, or use the `-LLIBDIR'
. m3 v3 h$ _8 ?0 F8 `+ \flag during linking and do at least one of the following:
2 j! {5 `5 R, w  l$ ^   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable4 T. X' o4 F2 ~2 n( u( f6 |7 v
     during execution
# ~; a& G" c$ X8 n2 l; C9 Z   - add LIBDIR to the `LD_RUN_PATH' environment variable9 }# e! S1 ?& e+ \4 L
     during linking  {7 o; \3 f1 o. N# Z
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag2 C/ @6 k" ~* V& H& N) k
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'
, E% O! u; S; P- q/ U8 M$ |; j: q& H8 U
See any operating system documentation about shared libraries for
. a# A( n5 f, f! T+ f4 h+ qmore information, such as the ld(1) and ld.so(8) manual pages.' C6 A. g$ J( Y8 f" l' |
----------------------------------------------------------------------
' E  p  J; G7 X9 u, U! k, }/ }3 [& J) f. N4 l, `
Build complete.
/ z5 B8 q/ W0 Y/ XDon't forget to run 'make test'.0 D$ J$ \* H1 @: w( ?# U

$ [' f6 H  d: F# z1 gInstalling shared extensions:     /usr/local/php/lib/php/extensions/no-debug-zts-20230831/! \, ?( O+ x4 j( t0 Z/ Z
Installing header files:          /usr/local/php/include/php/1 u/ m) k- I. r* `6 t, ?" }
6 r! w6 ?% G2 p8 _8 r" z9 b" i
去对应的目录检查文件:
$ E7 d& M$ C8 C
) a" n7 D) \9 \8 G% w[root@ipam2 no-debug-zts-20230831]# ls3 W8 U) {( y! Z3 S1 j+ v
mysqli.so
" y7 r. {9 n  x' `: U/ c5 G% i
" Z- C  y9 w/ o0 o: g+ y+ R8 A* E* k5 A3 s1 j
您需要登录后才可以回帖 登录 | 注册

本版积分规则

返回首页|Archiver|手机版|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )

GMT+8, 2026-6-12 00:40 , Processed in 0.023362 second(s), 23 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表