System ubutnu12.04-php 5.2
General steps:
Download the corresponding PHP version of the extension source
Unzip and enter the directory
Perform phpize precompilation (generic and PHP execution files in one directory)
./configure--with-php-config=php Path/php-config (If an error occurs installing autoconf)
Make && Makeinstall
Configuring the php.ini file to open the corresponding extension
Restart PHP Service (PHP-FPM or Apache)
——————————————————————————————
Lifting Li:
Now compile and install the MySQL extension, the phpize command is used to prepare the PHP extension library for the compilation environment. The source program for the extension library is in the Extname directory
$ cd extname$ phpize$
./Configure --with-config -file-path= /php path/bin/php-config --with-mysql --with-libdir= /lib/x86_64-linux-< Span class= "PLN" >gnu
$ make
$ make install
mysql.so会自动添加extension_dir所指目录中,修改php.ini添加 extension=mysql.so 重启php
备注: ldconfig -v | grep mysql
缺少mysql apt-get install mysql-client
缺少头文件 apt-get install libmysqlclient-dev
Linux practice--php5 compiling MySQL extensions