Download the corresponding version of PHP source code and unzip it. My version is php-5.4.16
Enter ext/mysqlnd in the source code directory and compile mysqlnd.so
<code><span>cp</span> config9<span>.m</span>4 config<span>.m</span>4 sed -ie <span>"s{ext/mysqlnd/php_mysqlnd_config.h{config.h{"</span> mysqlnd_portability<span>.h</span><span>#修改源文件</span> phpize <span>#执行phpize,增加./configure 配置</span> ./configure --with-php-c/to/php-config <span>#配置文件为原php的bin下的php-config</span> sudo make &&sudo make install <span>#编译安装</span></code>
If you don’t know where php-config is, you can Use this command to find
<code>sudo find <span>/</span><span>-name</span> php<span>-config</span></code>
Enter ext/mysql, compile mysql.so
<code>phpize <span>.</span>/configure <span>--</span><span>with</span><span>-php</span><span>-config</span><span>=</span>/path/<span>to</span>/php<span>-config</span><span>--</span><span>with</span><span>-mysql</span><span>=</span>mysqlnd make <span>&&</span> make install</code>
Enter ext/mysqli, compile mysqli.so
<code>phpize <span>.</span>/configure <span>--</span><span>with</span><span>-php</span><span>-config</span><span>=</span>/path/<span>to</span>/php<span>-config</span><span>--</span><span>with</span><span>-mysqli</span><span>=</span>mysqlnd make <span>&&</span> make install</code>
Add
<code><span>extension=<span>mysqlnd</span></span><span>extension=<span>mysql</span></span><span>extension=<span>mysqli</span></span></code>
The above introduces the PHP dynamic compilation and installation of mysqli mysql mysqlnd, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.