Apache2.4+php5.5+mysql5.5环境配置问题,phpinfo中不显示mysql扩展项
在用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>
PHP5.4后留空则默认启用mysqlnd:
<code>--with-mysql --with-mysqli --with-pdo-mysql </code>
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 扩展作为替代。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











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.

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.

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.

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

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.

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.

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.

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
