1. 首先进入你下载的php的安装包里找到pdo_mysql文件夹。

/usr/local/php-7.3./ext/pdo_mysql

ps:有些教程说从http://pecl.php.net/这个网站上下载pdo_mysql扩展,然后再编译安装。唉,兄弟啊,这个东西社区都不维护了,你还从上面下载个球球啊!!!!

大家一定要避免这个坑啊!!!!!

2. 执行phpize。

这里要注意,你要使用自己要添加扩展的php的phpize。什么意思呢?比如说你有php7 和 php7.3两个php版本,你要把扩展添加进7php7.3,那么你就需要使用php7.3的扩展,怎么使用呢?自行百度吧。

phpize是用来扩展php扩展模块的,通过phpize可以建立php的外挂模块

3. 配置扩展信息

./configure --with-php-config=/usr/local/php/bin/php-config // 这样是不行的!!!!!
./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql (php的安装路径,也就是php的可执行文件)

4. 编译和安装

make & make install

5. 修改php.ini文件

增加extension=pdo_mysql.so;

6. 重启php-fpm

sudo kill -USR2 进程号

遇到问题及解决方法:

1. nginx的错误日志

[error] 6910#6910: *1278203 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 218.107.211.81, server: caojiangjiang.qhrm.chunmiantest.qufenqi.com, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9800", host: "caojiangjiang.qhrm.chunmiantest.qufenqi.com"

2. php-fpm的错误日志

[-Mar- ::] WARNING: [pool www] child  exited with code  after 5484.614486 seconds from start
[-Mar- ::] NOTICE: [pool www] child started

3. 浏览器显示

502

4. make test显示

@'localhost' (using password: NO)
SKIP PDO MySQL Bug # (float parameters truncated to integer in prepared statements) [tests/bug_41698.phpt] reason: SQLSTATE[] [] Access denied for user 'root'@'localhost' (using password: NO)
SKIP PDO MySQL Bug # (stored procedure call returning single rowset blocks future queries) [tests/bug_41997.phpt] reason: SQLSTATE[] [] Access denied for user 'root'@'localhost' (using password: NO)
SKIP Bug # (Multi-statement execution via PDO::exec() makes connection unusable) [tests/bug_42499.phpt] reason: SQLSTATE[] [] Access denied for user 'root'@'localhost' (using password: NO)
SKIP Bug # (Memory errors in PDO constructor) [tests/bug_43371.phpt] reason: SQLSTATE[] [] Access denied for user 'root'@'localhost' (using password: NO)
SKIP Bug # (Unexpected exception thrown in foreach() statement) [tests/bug_44454.phpt] reason: SQLSTATE[] [] Access denied for user 'root'@'localhost' (using password: NO)
SKIP Bug # (The MySQL PDO driver resets variable content after bindParam on tinyint field) [tests/bug_44707.phpt] reason: SQLSTATE[] [] Access denied for user 'root'@'localhost' (using password: NO)
SKIP Bug # (PDOStatement->execute() returns true then false for same statement) [tests/bug_45120.phpt] reason: SQLSTATE[] [] Access denied for user 'root'@'localhost' (using password: NO)
SKIP Bug # (No ability to connect to database named 't;', no chance to escape semicolon) [tests/bug_50323.phpt] reason: SQLSTATE[] [] Access denied for user 'root'@'localhost' (using password: NO)
SKIP Bug # (getColumnMeta causes segfault when re-executing query after calling nextRowset) [tests/bug_51670.phpt] reason: SQLSTATE[] [] Access denied for user 'root'@'localhost' (using password: NO)
SKIP PDO MySQL Bug # (PDO::nextRowset() after a multi-statement query doesn't always work) [tests/bug_61207.phpt] reason: SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: NO)
SKIP Bug # (PDO Segfaults with PERSISTENT == TRUE && EMULATE_PREPARES == FALSE) [tests/bug_61411.phpt] reason: SQLSTATE[] [] Access denied for user 'root'@'localhost' (using password: NO)
SKIP Bug # (A parsing bug in the prepared statements can lead to access violations) [tests/bug_61755.phpt] reason: SQLSTATE[] [] Access denied for user 'root'@'localhost' (using password: NO)
SKIP Bug # (Invalid free of persistent results on error/connection loss) [tests/bug_74376.phpt] reason: SQLSTATE[] [] Access denied for user 'root'@'localhost' (using password: NO)
SKIP PDO MySQL PECL bug # (http://pecl.php.net/bugs/bug.php?id=12925) [tests/bug_pecl_12925.phpt] reason: SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: NO)
SKIP PECL Bug # (Calling stored procedure several times) [tests/bug_pecl_7976.phpt] reason: SQLSTATE[] [] Access denied for user 'root'@'localhost' (using password: NO)
TEST / [tests/common.phpt]
Warning: opendir(/usr/local/php-7.3./ext/pdo_mysql/ext/pdo/tests): failed to open dir: No such file or directory in /usr/local/php-7.3./ext/pdo_mysql/run-tests.php on line
ERROR: cannot open directory: /usr/local/php-7.3./ext/pdo_mysql/ext/pdo/tests
Makefile:: recipe for target 'test' failed
make: *** [test] Error

其实这些问题的罪魁祸首就是在编译的时候没有编译导致的,问题排查的方法很重要,基础知识也很重要!!!

mysqlnd

另外可以通过md5sum来检测生成的pdo_mysql.so

使用 php -i 查看php在cli下面的详细信息  // 查看程序能够正确执行
使用 php -m查看php 在cli下面加载了哪些模块

php添加pdo_mysql.so的扩展的更多相关文章

  1. 为IEnumerable<T>添加RemoveAll<IEnumerable<T>>扩展方法--高性能篇

    最近写代码,遇到一个问题,微软基于List<T>自带的方法是public bool Remove(T item);,可是有时候我们可能会用到诸如RemoveAll<IEnumerab ...

  2. 在windows下添加php的Imagick扩展

    安装ImageMagick-6.9.2-6-Q16-x64-dll.exe 将安装目录下的CORE_开头的dll文件和X11.dll文件复制到c:\windows\system32\下, 在windo ...

  3. wdcp php5.3添加pdo_mysql模块

    先查看探针: pdo没有支持mysql.导致了PHpwind以及thinkphp框架的一些运用了pdo进行mysql操作的程序无法运行. php5.3默认是封装了pdo_mysq的.那么就没必要单独下 ...

  4. Ubuntu 16.04 为 PHP7 添加 memcached 以及 redis 扩展

    切换到 PHP 7 之后,网站的速度大幅提升,不过通常的扩展可能某一个就还没有支持 PHP7 Memcached 比如说我现在使用了最新的 Ubuntu 16.04,虽然内置了 PHP 7 源,但 m ...

  5. 添加新硬盘,扩展Centos7根分区

    ##背景介绍,系统安装时,分配的硬盘容量太小,根分区空间不够用,现添加一个新硬盘,通过以下步骤来扩展centos7根分区 [root@t201 ~]# df -h 文件系统 容量 已用 可用 已用% ...

  6. PHP如何添加内置的扩展

    什么时候server上PHP已安装.需要额外补充PHP如何扩展?你并不需要再次安装PHP.同phpize我们可以在原PHP安装扩展直接的基础上,. 这次编译只不过单独编译PHP的扩展库.接下来将编译好 ...

  7. typescript 添加基础类型的扩展方法

    以时间转换为案例: //声明接口,也是在声明date这个基础类型要定义一个format的扩展方法,不写接口声明会报错 interface Date { Format(fmt:string):strin ...

  8. 云通讯 为php_sdk 添加关闭子账户扩展

  9. JEECMS 2.4.2 之添加新的可扩展的ftl模版文件、自定义方法

    Demo: <@cms.CfgList isPage='1' league='0' recommend='0' lala='0' hot='1' memberId='0' pageNo=page ...

随机推荐

  1. Spring 学习教程(一):浅谈对Spring IOC以及DI的理解

    一.个人对IoC(控制反转)和DI(依赖注入)的理解我们平时在开发java web程序的时候,每个对象在需要使用它的合作对象时,自己都要将它要合作对象创建出来(比如 new 对象),这个合作对象是由自 ...

  2. Oracle单行函数

    一.尽管各个数据库都是支持sql语句的.可是每一个数据库也有每一个数据库所支持的操作函数,这些就是单行函数.假设想进行数据库开发的话.除了要回使用sql语句外,就是要多学习函数. 1.单行函数的分类: ...

  3. Mac破解免费office软件

    一.下载安装包及破解工具 地址: https://pan.baidu.com/s/1hugtoLQ 密码: s5in 附官网地址 文件夹中包含三个文件: Office16安装文件 Microsoft_ ...

  4. 【论文阅读】Deep Adversarial Subspace Clustering

    导读: 本文为CVPR2018论文<Deep Adversarial Subspace Clustering>的阅读总结.目的是做聚类,方法是DASC=DSC(Deep Subspace ...

  5. final、finally、finalize区别

    final final关键字可以用来修饰类,方法以及成员变量,当用在不同的场景下时具有不同的意义. 修饰类 如果修饰类,则代表这个类不可继承 修饰方法 如果修饰方法,则代表这个方法不可覆写:同时,允许 ...

  6. Java作业(一)

    再此次的Java考试中发现自己的不足,无法套用HTML模板进行编程,说实话拿到的第一刻自己有些懵,不知道怎么去操作, 后来通过查询操作了一些,但是整个人还是懵懵的,不知道下一步怎么办,怎么去连接后台和 ...

  7. windows10系统下安装pygame

    1.安装python,选择版本3.7.1 下载地址:https://www.python.org/downloads/windows/选择安装版本 2.安装pip 下载地址:https://pypi. ...

  8. Go 初体验 - 令人惊叹的语法 - defer.2 - 如何提前执行?

    上一文中讲到 defer 会在宿主函数 return 之前调用,那么我们就是想在宿主函数执行到中间调用,怎么办呢? 1. 改变宿主函数逻辑,分成多个函数,需要的那个函数里 defer . 2. 使用匿 ...

  9. Java-HttpURLConnection详细说明与实例

    URLConnection 类是一个抽象类,代表应用程序和URL之间的通信连接,此类的实例可用于读取和写入此URL引用的资源.URLConnection 允许使用GET,POST或者其他HTTP方法请 ...

  10. Feign 与 Hystrix

    Feign 与 Hystrix Feign是一个声明式的web服务客户端,它使得web服务调用非常的简单,当我们使用Feign时,Spring Cloud 整合了Ribbon和Eureka,从而为我们 ...