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

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

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2024-1-6 21:10:09 | 显示全部楼层 |阅读模式
编译模块:切换到ext模块目录:
5 h/ w1 K$ a( |cd /usr/src/php-8.3.1/ext/mysqli; E# s0 i. O. @6 X: y: g
切换到myqlli目录:
% \" F, s7 R/ X0 d) w& L4 K
5 B, h3 F* L+ i1 i' P5 L! s7 V, P% r% w2 m* m8 j2 i6 H" I
执行:
& J% C, o; p7 a7 J% i/usr/local/php/bin/phpize
+ \- k4 @' y4 V+ K* u& ZConfiguring for:
# P, I' n$ d6 L- V$ A  yPHP Api Version:         202308315 q2 R$ A+ a2 a# c' ?3 i. d
Zend Module Api No:      20230831
( F/ @! G* O" }3 KZend Extension Api No:   420230831
" y+ W3 O7 m5 ~& [. y7 Y# A$ R1 s7 x  i3 \3 d9 O
要检查config.m4文件  没有就复制一个吧:! I2 `/ _: @( h* V) t% |

( v; Y( ?; A+ b" w4 w: f8 E2 `# N8 x, t+ h% l# E! V, a5 y
通过configure配置php:9 v, Z9 _; n. K3 {9 ~' M( l
./configure --with-php-config=/usr/local/php/bin/php-config- O4 A2 ^8 t$ V+ S
. \( w' k' Z+ t
编译并安装:
  c7 L3 s5 ]& L/ d0 W2 Dmake && make install ( Q% e9 o7 h1 d: A

* ^0 k0 t. |4 F: q9 ?/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
4 c7 ?6 @+ ?6 y. k' w' 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
, L& _: X9 }: l2 a+ Jcreating mysqli.la  B* T) w& o( E8 N3 x
(cd .libs && rm -f mysqli.la && ln -s ../mysqli.la mysqli.la)
8 M& ?9 S3 T- J1 b+ D' j+ l, R- W/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
' u! p! N) X" K' F% q, T% {cp ./.libs/mysqli.so /usr/src/php-8.3.1/ext/mysqli/modules/mysqli.so" J7 S0 D4 \6 G. D7 w* v. i
cp ./.libs/mysqli.lai /usr/src/php-8.3.1/ext/mysqli/modules/mysqli.la
6 k) x. s) x6 _3 k2 A; VPATH="$PATH:/sbin" ldconfig -n /usr/src/php-8.3.1/ext/mysqli/modules9 H* L9 W$ b2 {6 e
----------------------------------------------------------------------6 ]! M3 o( Y, [2 M  y7 n, K
Libraries have been installed in:9 c$ n$ x: b* h
   /usr/src/php-8.3.1/ext/mysqli/modules
! R- X6 l+ w+ G7 ]! R! c0 |+ L- q  G' e  ~  a
If you ever happen to want to link against installed libraries
+ r. q/ S/ N9 j& f3 l+ ein a given directory, LIBDIR, you must either use libtool, and9 M- M) D5 q3 K3 c
specify the full pathname of the library, or use the `-LLIBDIR'8 z! Z, I  D4 |: j/ ~
flag during linking and do at least one of the following:& }) U; s! ~$ N2 ?- X# e) E# ]/ ^
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable- N  l4 V9 A' Q4 y+ Y) i  l
     during execution+ L- C2 ^/ U8 m* C* O/ @. l
   - add LIBDIR to the `LD_RUN_PATH' environment variable; s: P: s3 q  r( [7 ~  c0 I3 H8 L
     during linking& A: T0 K0 k. d4 ]
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag8 n0 E, N$ [; [5 V9 h2 p
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'
6 C* v/ S: p5 I& ?( R1 q1 }+ `$ |! N- L3 Q9 w; i; D! Y
See any operating system documentation about shared libraries for
  O& [0 Z) ~- h3 e* N7 M) hmore information, such as the ld(1) and ld.so(8) manual pages.
9 E& }: |4 R% Q6 n' w+ P----------------------------------------------------------------------$ f% E8 W3 u& K0 j* l1 y# ?. g

( [8 r& e" X- L8 k& xBuild complete.
! E, V4 ^) q  ^Don't forget to run 'make test'., z" P; H1 l4 V% [

- ?" c) N$ |+ A( B6 F: xInstalling shared extensions:     /usr/local/php/lib/php/extensions/no-debug-zts-20230831/
8 @1 q' r- L6 B( ]) nInstalling header files:          /usr/local/php/include/php/9 f4 G! i, ?/ x% P
1 ^) d5 m! f' g6 U; F; o' }0 J, r
去对应的目录检查文件:
$ h- t# _# a- ^' ~2 e" p+ W2 k* @+ W; L: p
[root@ipam2 no-debug-zts-20230831]# ls1 j; g& ]5 H  S* z/ c4 Z0 K; {. F6 H
mysqli.so
5 S* n+ s7 W2 L0 ]& h/ _" r: t2 Q9 X

" Z4 S" F8 i) d, Q6 E
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

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

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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