MySQL extension support for php in linux

Source: Internet
Author: User

Mysqli extension allows users to access functions provided by MySQL 4.1 or later. To use functions in this extension library, you must add support for mysqli extension when compiling PHP.

Note:The mysqli extension library is designed to work collaboratively with MySQL 4.1.3 or later.


One site was transferred over the past two days because of a problem with the database, and I did not carefully handle the site. After the database is completed today, it still cannot be used. The following error is reported: Fatal error: Class 'mysqli' not found in. It turns out that when I compile php, I didn't compile mysqli support. The solution to the problem is to recompile it.


To install the mysqli extension of PHP, add -- with-mysqli = mysql_config_path/mysql_config to the configuration. Mysql_config_path indicates the path of the mysql_config program, which is released along with MySQL versions later than 4.1.


Cd php-5.2.8 // below there is an ext folder with mysqli
Cd ext/mysqli

In linux, there should be configure for compiling the source code files, but not here. After we have installed php, there is a file named phpize in the command directory bin in the php5 folder, use it to generate the configure file.

/Usr/local/php5/bin/phpize // press Enter here to run. After the execution, the configure file is displayed,
. /Configure-prefix =/usr/local/mysqli-with-php-config =/usr/local/php5/bin/php-config-with-mysqli =/usr/local/ mysql/bin/mysql_config

Press enter directly to continue without any problem ..

Make
Make test
Make install // (Installing shared extensions:/usr/local/php5/lib/php/extensions/no-debug-non-zts-20041030/will be displayed without errors /)

The mysqli. so file is now available ..

Load the file directly in php. ini ..

Extension_dir = "/usr/local/php5/ext"
Extension = mysqli. so

Modify the first line to this, and then add the second line .. Wq is saved and exited.

Run the mysqli. so file cp under/usr/local/php5/ext.

Restart apache.


Mysqli-construct a new mysqli object

Method

Autocommit-Options for enabling or disabling automatically submitted Databases
Change_user-change the user connected to the specified database
Character_set_name-returns the default character set for database connection
Close-close a previously opened connection
Commit-submit the current transaction
Connect-open a new connection to the MySQL database server
Debug-Execute troubleshooting
Dump_debug_info-Get error message
Get_client_info-return the Client Version
Get_host_info-return the connection type
Get_server_info-returns the MySQL server version.
Get_server_version-returns the MySQL server version.
Init-Initialize mysqli object
Info-obtain the information of the latest Query
Kill-requires the server to stop a mysql thread
Multi_query-execute multiple queries

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.