Apache2.4 + php5.5 + mysql5.5 environment configuration problems. mysql extension items are not displayed in phpinfo.

Source: Internet
Author: User
When you use Apache2.4 and php5.5 to configure an independent environment, printing phpinfo also shows that it is successful. You can see the enabled extension items, but it does not show mysql, the mysql extension is not displayed, but mysqlnd is displayed, and the mysql database cannot be connected. I don't know what it is... when you use Apache2.4 and php5.5 to configure an independent environment, printing phpinfo also shows that it is successful. You can see the enabled extension items, but it does not show mysql, the mysql extension is not displayed, but mysqlnd is displayed, and the mysql database cannot be connected. I don't know why.

Reply content:

When you use Apache2.4 and php5.5 to configure an independent environment, printing phpinfo also shows that it is successful. You can see the enabled extension items, but it does not show mysql, the mysql extension is not displayed, but mysqlnd is displayed, and the mysql database cannot be connected. I don't know why.

Mysql, mysqli, and pdo_mysql are implemented by default in PHP from 5.4.
During compilation, PHP5.3 enables mysqlnd support as follows:

--with-mysql=mysqlnd--with-mysqli=mysqlnd--with-pdo-mysql=mysqlnd

If it is left blank after PHP5.4, mysqlnd: is enabled by default:

--with-mysql--with-mysqli--with-pdo-mysql

PHP7 is not supported at the beginning -- with-mysql.

In addition, if you do not add the -- with-mysql configuration item during compilation, you naturally cannot use the mysql extension function. however, mysql extension will be discarded in PHP 7. You should use mysqli and pdo_mysql extension.

PHP5.4.x uses mysqlnd to connect to mysql by default. Unlike libmysql, PHP supports mysqlnd built-in and uses PHP license authorization to avoid any possible copyright problems.
Http://www.php.net/manual/zh/mysql.installation.php
Mysqlnd does not act as a general library like libmysql. It is a library specially written for PHP. libmysql directly accesses the database, while mysqlnd accesses the database through Zend, which has better performance. You can view the mysqlnd information in phpinfo. before compiling PHP, you must first install MySQL, and then use -- with-mysql = DIR to specify the MySQL location. with the built-in mysqlnd local driver, this is not required.

In addition to copyright protection, mysqlnd is faster than libmysql and saves more memory. It also provides a wide range of performance statistics functions and facilitates PHP compilation. mysqlnd, as a PHP extension, is tightly coupled with PHP and uses the PHP memory management system. Therefore, it consumes less memory than libmysql and is more efficient. memory_get_usage () can be used to track the memory usage of mysqlnd, and it is also limited by the memory usage of memory_limit.
Http://php.net/manual/en/mysqlnd.overview.php

PHP has discarded the original MySQL extension since 5.5 and should be replaced by MySQLi or PDO_MySQL extension.

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.