Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to add mysqli extension to php in linux

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces the linux php how to increase mysqli expansion, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.

Linux php add mysqli extension method: 1, find the php installation package under the ext directory under the mysqli extension; 2, run phpize;3 directly under the mysqli directory, add "mysqli.so" in the last line of php.ini; 4, restart apache.

This article operating environment: linux5.9.8 system, PHP7.1 version, DELL G3 computer

How does linux php add mysqli extensions?

Install the mysqli extension for php on linux

Php in the lamp environment does not extend the extension library of mysqli, so you can use the phpinfo () function in the php code to view the details of your php, such as what extensions are available, what version of php is, and so on.

So I started installing the mysqli extension for php on linux.

(1) find the mysqli extension in the ext directory under the php installation package:

If you can't remember where your php installation package is, you can try using the

Find /-name mysqli

Look for it, and if you can't find it, you can download a php installation package from the php official website, and then unzip it or download the name of the package directly in linux using the path saved by yum install-- downloadonly-- downloaddir=. For example:

Yum install-downloadonly-downloaddir=/root php

Attach common decompression commands:

Zip format: unzip compressed file name

Gzip format: gzip-d compressed file name

Tar.gz format: tar-zxvf compressed file name

Tar.bz2 format: tar-jxvf compressed file name

Rpm format: rpm2cpio compressed file name | cpio-p

The result should be as follows:

(2) generate mysqli.so extension files

First use the find command to find the location of the phpize:

Find /-name phpize

Mine is in / usr/bin/phpize.

Then run phpize directly under the mysqli directory

/ usr/bin/phpize

(note: if you do not run phpize in the mysqli directory, you will report the error Cannot find conf.m4.)

There may also be other errors, such as phpize Can't find PHP headers in / usr/include/php, which is caused by not installing php-devel or php-pear or gcc, etc., just install it with yum.

Next, use these commands:

. / configue-prefix=/usr/local/mysqlimake & & make install

If normal, the system will return a path under which is the mysql.so extension file we want

(3) modify php.ini configuration file

Find your php.ini configuration file, usually under / usr/local/lib, or find if you can't find it. And then

Vi php.ini

Add to the last line of php.ini

Extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/mysqli.so

The string of paths in front of mysqli.so fill in the path returned by the system.

Finally restart apache

/ bin/systemctl restart httpd.service Thank you for reading this article carefully. I hope the article "how to add php in linux to mysqli extension" shared by the editor will be helpful to you. At the same time, I also hope you will support us and follow the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report