Table of Contents
回复内容:
Home Backend Development PHP Tutorial Apache2.4+php5.5+mysql5.5环境配置问题,phpinfo中不显示mysql扩展项

Apache2.4+php5.5+mysql5.5环境配置问题,phpinfo中不显示mysql扩展项

Jun 06, 2016 pm 08:31 PM
mysql php

在用Apache2.4与php5.5配置独立环境的时候,打印phpinfo也显示成功,能看到开启的扩展项,但是就是不显示mysql的,也打开了mysql的扩展就是不显示,却显示了mysqlnd,测试连接mysql数据库也连接不上。不知道是什么原因

回复内容:

在用Apache2.4与php5.5配置独立环境的时候,打印phpinfo也显示成功,能看到开启的扩展项,但是就是不显示mysql的,也打开了mysql的扩展就是不显示,却显示了mysqlnd,测试连接mysql数据库也连接不上。不知道是什么原因

PHP从5.4开始默认采用mysqlnd实现mysql,mysqli,pdo_mysql.
编译时,PHP5.3这样启用mysqlnd支持:

<code>--with-mysql=mysqlnd
--with-mysqli=mysqlnd
--with-pdo-mysql=mysqlnd
</code>
Copy after login

PHP5.4后留空则默认启用mysqlnd:

<code>--with-mysql
--with-mysqli
--with-pdo-mysql
</code>
Copy after login

PHP7开始不再支持--with-mysql.

另外,如果你编译时没有添加 --with-mysql 配置项,自然也是不能使用mysql这个扩展的函数的.不过,PHP7开始将废弃mysql扩展,用户应该使用mysqli和pdo_mysql扩展.

PHP5.4.x开始默认使用mysqlnd连接mysql,区别于以前的libmysql,PHP内建支持mysqlnd,而且采用PHP license授权,避免了任何可能存在的版权问题.
http://www.php.net/manual/zh/mysql.installation.php
mysqlnd并不像libmysql那样作为通用库,它是专门为PHP而写的一个库.libmysql是直接访问数据库的,而mysqlnd是通过Zend访问数据库,有着更好的性能,可以在phpinfo()中查看到mysqlnd信息.以前编译PHP时,必须先安装MySQL,然后用--with-mysql=DIR指定MySQL的位置,有了内置的mysqlnd本地驱动,就不需要这样了.

除了解决版权问题外,mysqlnd比libmysql更快,更节省内存,而且提供了丰富的性能统计功能,也更方便PHP的编译.mysqlnd作为一个PHP扩展,跟PHP是紧耦合的,使用的是PHP的内存管理系统,所以内存占用要比libmysql少,效率也更高.可以用memory_get_usage()跟踪mysqlnd的内存使用,同时也受memory_limit的内存限制.
http://php.net/manual/en/mysqlnd.overview.php

PHP 从 5.5 开始废弃了原始的 MySQL 扩展,需使用 MySQLi 或 PDO_MySQL 扩展作为替代。

Statement of this Website
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1667
14
PHP Tutorial
1273
29
C# Tutorial
1255
24
MySQL: The Database, phpMyAdmin: The Management Interface MySQL: The Database, phpMyAdmin: The Management Interface Apr 29, 2025 am 12:44 AM

MySQL and phpMyAdmin can be effectively managed through the following steps: 1. Create and delete database: Just click in phpMyAdmin to complete. 2. Manage tables: You can create tables, modify structures, and add indexes. 3. Data operation: Supports inserting, updating, deleting data and executing SQL queries. 4. Import and export data: Supports SQL, CSV, XML and other formats. 5. Optimization and monitoring: Use the OPTIMIZETABLE command to optimize tables and use query analyzers and monitoring tools to solve performance problems.

Composer: Aiding PHP Development Through AI Composer: Aiding PHP Development Through AI Apr 29, 2025 am 12:27 AM

AI can help optimize the use of Composer. Specific methods include: 1. Dependency management optimization: AI analyzes dependencies, recommends the best version combination, and reduces conflicts. 2. Automated code generation: AI generates composer.json files that conform to best practices. 3. Improve code quality: AI detects potential problems, provides optimization suggestions, and improves code quality. These methods are implemented through machine learning and natural language processing technologies to help developers improve efficiency and code quality.

Steps to add and delete fields to MySQL tables Steps to add and delete fields to MySQL tables Apr 29, 2025 pm 04:15 PM

In MySQL, add fields using ALTERTABLEtable_nameADDCOLUMNnew_columnVARCHAR(255)AFTERexisting_column, delete fields using ALTERTABLEtable_nameDROPCOLUMNcolumn_to_drop. When adding fields, you need to specify a location to optimize query performance and data structure; before deleting fields, you need to confirm that the operation is irreversible; modifying table structure using online DDL, backup data, test environment, and low-load time periods is performance optimization and best practice.

What is the significance of the session_start() function? What is the significance of the session_start() function? May 03, 2025 am 12:18 AM

session_start()iscrucialinPHPformanagingusersessions.1)Itinitiatesanewsessionifnoneexists,2)resumesanexistingsession,and3)setsasessioncookieforcontinuityacrossrequests,enablingapplicationslikeuserauthenticationandpersonalizedcontent.

How to uninstall MySQL and clean residual files How to uninstall MySQL and clean residual files Apr 29, 2025 pm 04:03 PM

To safely and thoroughly uninstall MySQL and clean all residual files, follow the following steps: 1. Stop MySQL service; 2. Uninstall MySQL packages; 3. Clean configuration files and data directories; 4. Verify that the uninstallation is thorough.

An efficient way to batch insert data in MySQL An efficient way to batch insert data in MySQL Apr 29, 2025 pm 04:18 PM

Efficient methods for batch inserting data in MySQL include: 1. Using INSERTINTO...VALUES syntax, 2. Using LOADDATAINFILE command, 3. Using transaction processing, 4. Adjust batch size, 5. Disable indexing, 6. Using INSERTIGNORE or INSERT...ONDUPLICATEKEYUPDATE, these methods can significantly improve database operation efficiency.

How to use MySQL functions for data processing and calculation How to use MySQL functions for data processing and calculation Apr 29, 2025 pm 04:21 PM

MySQL functions can be used for data processing and calculation. 1. Basic usage includes string processing, date calculation and mathematical operations. 2. Advanced usage involves combining multiple functions to implement complex operations. 3. Performance optimization requires avoiding the use of functions in the WHERE clause and using GROUPBY and temporary tables.

Detailed explanation of the installation steps of MySQL on macOS system Detailed explanation of the installation steps of MySQL on macOS system Apr 29, 2025 pm 03:36 PM

Installing MySQL on macOS can be achieved through the following steps: 1. Install Homebrew, using the command /bin/bash-c"$(curl-fsSLhttps://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)". 2. Update Homebrew and use brewupdate. 3. Install MySQL and use brewinstallmysql. 4. Start MySQL service and use brewservicesstartmysql. After installation, you can use mysql-u

See all articles