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

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

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2024-1-6 21:10:09 | 显示全部楼层 |阅读模式
编译模块:切换到ext模块目录:( {$ l  _0 T- o9 p% M
cd /usr/src/php-8.3.1/ext/mysqli0 e- u& l! N! w* \0 E/ n, _5 n
切换到myqlli目录:
4 Z( o3 u* i7 R, O
" D, M7 @1 {0 U+ b' N$ F! I( O; J
执行:3 q( N* @# V: ]/ g2 v% H$ K+ e
/usr/local/php/bin/phpize
+ S! ^+ z# J0 ?6 ^Configuring for:
% ~$ h  S: }) TPHP Api Version:         20230831
) G4 C' e+ ^( k. V# P6 e2 M, NZend Module Api No:      20230831
3 E0 `/ C; g2 ?) jZend Extension Api No:   420230831
. [/ L9 z. t! h2 O& @( @
% U1 Q( ]- r6 v+ J要检查config.m4文件  没有就复制一个吧:* p  ]* {2 r9 E* L
/ q) o# F( M4 p6 _( G) }

3 v7 d$ C' M* e+ z7 s% d: T通过configure配置php:
# u: R% ]2 V" t$ D& k./configure --with-php-config=/usr/local/php/bin/php-config
7 H; `) u8 d3 X# K0 M) E& Q$ z
0 ?! Q+ f  @" X编译并安装:
- f5 l) U5 j# ~8 M( _0 [make && make install
, W; @+ S2 l7 l
- j& k6 x2 S* ]/ }2 A/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
, C1 j7 V& p0 G, X; O) ^cc -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& b9 K- A' Y% l% \  y% d: b5 Y
creating mysqli.la
& s( H' @) `! S) ~' o. I: u(cd .libs && rm -f mysqli.la && ln -s ../mysqli.la mysqli.la)9 B% u; T8 t1 `( E
/bin/sh /usr/src/php-8.3.1/ext/mysqli/libtool --mode=install cp ./mysqli.la /usr/src/php-8.3.1/ext/mysqli/modules7 p4 ?5 j  ?/ X1 U/ l# r. M
cp ./.libs/mysqli.so /usr/src/php-8.3.1/ext/mysqli/modules/mysqli.so
9 v7 c6 _, m' M# qcp ./.libs/mysqli.lai /usr/src/php-8.3.1/ext/mysqli/modules/mysqli.la
- g  F# S% \; b0 o  ~% ]( v! O) ZPATH="$PATH:/sbin" ldconfig -n /usr/src/php-8.3.1/ext/mysqli/modules
& @3 p5 Y( F8 E- O( ?----------------------------------------------------------------------( L/ y/ u* p0 q* d
Libraries have been installed in:. ^, h' ~" s& s" M# A
   /usr/src/php-8.3.1/ext/mysqli/modules
9 {$ N+ m4 b. ]1 R1 O' S$ Y# s6 q5 X' f/ p
If you ever happen to want to link against installed libraries- n0 V; w7 e  e9 `% c2 O
in a given directory, LIBDIR, you must either use libtool, and
" r. x; D2 ?) \$ S# o, A' Wspecify the full pathname of the library, or use the `-LLIBDIR'- b6 n1 P& s* i- l
flag during linking and do at least one of the following:6 w& S( a) ~8 U) I; f, S- K
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable* W2 [$ j$ f6 T3 @* |4 u
     during execution0 V7 k- g/ G2 u  p: J! G
   - add LIBDIR to the `LD_RUN_PATH' environment variable6 {" m3 R) Q( v8 U
     during linking% N6 \" {( H0 g" A$ G
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag, v3 E, x. u+ S7 W' ^: `: o+ H
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'
4 _8 E& F3 a- T+ A4 Y  w% P  t/ |0 o" j, W) H! d
See any operating system documentation about shared libraries for; h; l2 w0 B% J- C: f) T
more information, such as the ld(1) and ld.so(8) manual pages.' J( J" Y) z$ U& x& f$ `
----------------------------------------------------------------------2 N' |- a. j( p
/ m7 n6 i! X$ W5 @- u+ u
Build complete.
4 c* X! s, [7 u3 @1 c% n1 C2 |' S# i( S$ hDon't forget to run 'make test'.
8 E/ b1 H  @. ?) C3 q% }9 ?/ o' C0 |/ Y! r* u- c2 `
Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-zts-20230831// c1 }" [0 d! p8 X( m
Installing header files:          /usr/local/php/include/php/) d7 n: z6 k6 r4 ^9 w5 V
; y" Z& ?6 Q) L$ x( X; f
去对应的目录检查文件:
3 d3 O  B3 b  r& J4 r/ R/ E4 f/ l8 v: r  M  L
[root@ipam2 no-debug-zts-20230831]# ls! j. ?; H/ w0 Z" x9 m: b
mysqli.so: d6 Q0 l# A$ i, {9 Z; y8 M4 q

4 T) v  s1 C& _1 M" E  R: Z& O! h5 t
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

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

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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