search
HomeBackend DevelopmentPHP7How to compile and install pdo_mysql in php7

How to compile and install pdo_mysql in php: first download the "pdo_mysql" expansion package from "pecl.php.net"; then execute "/usr/local/bin/phpize"; then modify "php.ini" ;Finally restart php-fpm.

How to compile and install pdo_mysql in php7

Recommended: "PHP Video Tutorial"

php7 Compile and install pdo_mysql extension

1. Download the pdo_mysql expansion package from pecl.php.net;

If you have a PHP source code package, you don’t need to download it. You can find it under ext/ under the source code package;

2 . Unzip, enter the expansion package directory, and execute /usr/local/bin/phpize (the path depends on the actual situation, mainly to find phpize. If there is no phpize, you may need to install php-dev)

# tar -zxvf PDO_MYSQL-1.0.2.tgz
# /usr/local/bin/phpize
Configuring for:
PHP Api Version:         20160303
Zend Module Api No:      20160303

3. configure

./configure -with-php-config=/usr/local/bin/php-config -with-pdo-mysql=mysqlnd
这里使用mysqlnd 而不是 /usr/local/mysql,PHP7 正式移除了 mysql 扩展;如果有多个版本的 PHP,使用-with-php-config=/usr/local/bin/php-config 指向对应版本的php-config 可以将扩展安装到对应的 PHP 版本;

4. make, make install

5. Then modify php.ini

Find the line; extension=php_pdo_mysql.dll, remove the comment, and modify the following files Name:

extension=pdo_mysql.so

Restart php-fpm, ok!

————————————————————————————————————

Record a question:

Environment: docker, Debian GNU/Linux 8

PHP: 7.1.10

Use the downloaded pdo_mysql package to install configure Times: can not find mysql under the "mysqlnd" that you specified, but check that the PHP extension mysqlnd is installed,

then -with-pdo-mysql=/usr/local/include/php/ext/mysqlnd will not work either ;

But there is no problem if you install it with pdo_mysql in the PHP source package;

Compared the files in mysqlnd under the source package and /usr/local/include/php/ext/mysqlnd It’s indeed different;

I have to figure this out when I have time

————————————————————

The above problem is solved: just install the mysql development tool kit

apt-get install libmysqlclient-dev

but new problems will arise. . .

Ultimate solution:

Download the corresponding version of the PHP source code package, and install it with the source code package. It is very smooth. . .

http://php.net/downloads.php
http://php.net/releases/

The above is the detailed content of How to compile and install pdo_mysql in php7. For more information, please follow other related articles on the PHP Chinese website!

Statement
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
How to Use Sessions Effectively in PHP 7?How to Use Sessions Effectively in PHP 7?Mar 10, 2025 pm 06:20 PM

This article details effective PHP 7 session management, covering core functionalities like session_start(), $_SESSION, session_destroy(), and secure cookie handling. It emphasizes security best practices including HTTPS, session ID regeneration, s

How to Upgrade from PHP 5.6 to PHP 7?How to Upgrade from PHP 5.6 to PHP 7?Mar 10, 2025 pm 06:29 PM

This article details upgrading PHP 5.6 to PHP 7, emphasizing crucial steps like backing up, checking server compatibility, and choosing an upgrade method (package manager, compiling, control panel, or web server configuration). It addresses potentia

How to Monitor PHP 7 Performance with Tools like New Relic?How to Monitor PHP 7 Performance with Tools like New Relic?Mar 10, 2025 pm 06:28 PM

This article explains how to monitor PHP 7 application performance using New Relic. It details New Relic's setup, key performance indicators (KPIs) like Apdex score and response time, bottleneck identification via transaction traces and error track

How to Autoload Classes in PHP 7?How to Autoload Classes in PHP 7?Mar 10, 2025 pm 06:20 PM

This article explains PHP 7's autoloading, using spl_autoload_register() to load classes on demand. It details best practices like namespace-based autoloading and caching for performance optimization, addresses common issues (e.g., class not found

How to Use Git for Version Control in PHP 7 Projects?How to Use Git for Version Control in PHP 7 Projects?Mar 10, 2025 pm 06:27 PM

This article guides PHP 7 developers on using Git for version control. It covers initialization, staging, committing, ignoring files, remote repositories, branching, merging, conflict resolution, and essential Git commands. Best practices for effic

How to Deploy a PHP 7 Application to a Web Server?How to Deploy a PHP 7 Application to a Web Server?Mar 10, 2025 pm 06:28 PM

This article details deploying PHP 7 applications, covering methods (FTP, SSH, deployment tools), server configuration (Apache/Nginx, PHP-FPM), database setup, and crucial security considerations. It highlights common challenges like server compatib

How to Use Xdebug for Debugging PHP 7 Code?How to Use Xdebug for Debugging PHP 7 Code?Mar 10, 2025 pm 06:26 PM

This article explains how to use Xdebug for debugging PHP 7 code. It covers Xdebug configuration (installation, php.ini settings, IDE setup), breakpoint usage (conditional, function, remote), and troubleshooting connection issues. Effective debuggi

How to Include and Require Files in PHP 7?How to Include and Require Files in PHP 7?Mar 10, 2025 pm 02:52 PM

This article explains PHP 7's include, include_once, require, and require_once file inclusion methods. It details their differences in error handling (warnings vs. fatal errors) and multiple inclusion prevention. Best practices for file organizatio

See all articles

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft