Home >Backend Development >PHP Problem >What should I do if there is no extension library after php is compiled?

What should I do if there is no extension library after php is compiled?

王林
王林Original
2021-07-05 14:41:482595browse

The solution to the problem that there is no extension library after php is compiled is to first enter the source code directory of php and execute the compile and installation command. Then add the pdo_mysql.so extension in the php.ini configuration file. Finally, execute the restart command.

What should I do if there is no extension library after php is compiled?

The operating environment of this article: centos 6.5 system, Nginx1.7&&PHP5.5&&MySQL5.6, thinkpad t480 computer.

Foreword:

There may be many extension libraries that have not been added when compiling php, but when we run the web program, we will find that many extension libraries need to be used.

So how should we solve this problem when we have already set up the LNMP environment and do not want to recompile and install it?

We can use phpize to install the extension library to add it. Let us take a look at the specific method below.

For example (php version 5.5.9, installation directory/usr/local/php5, source code directory/opt/softs/-php5.5.9, need to add support for pdo_mysql):

Enter PHP source code directory

>cd /opt/softs/php-5.5.9/ext/pdo_mysql
>/usr/local/php5/bin/phpize
>./configure –with-php-config=/usr/local/php5/bin/php-config –with-pdo-mysql=/usr/local/mysql/
>make && make install

After completion, the system prompts the directory where the pdo_mysql.so file is located (/usr/local/php5/lib/php/extensions/no-debug-non-zts-20121212).

Modify php.ini and add a sentence

extension=/usr/local/php5/lib/php/extensions/no-debug-non-zts-20121212/pdo_mysql.so

Restart the service

>service php-fpm restart

Free learning video sharing:Programming video

The above is the detailed content of What should I do if there is no extension library after php is compiled?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn