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. iptables 分析(三)

    原文:http://blog.chinaunix.net/uid-24207747-id-2622902.html find_target查到目标并加载成功,返回一个xtables_target型对象 ...

  2. git----------SourceTree如何连接ssh的仓库地址,这里记录的是客户端需要做的事

    1. 2. 打开命令行以后输入ssh-keygen -t rsa -C "example@example.com"  这个地方输入的是你注册gitlab所使用的邮箱.按回车,之后还 ...

  3. caffe-ssd安装GPU版本和CPU的区别

    在CPU中1.CPU_ONLY :=1的注释取消掉 2.BLAS := atlas 在GPU中 1.USE_CUDNN := 1的注释取消 2.BLAS := open

  4. angularjs 的ng-disabled属性操作

    ng-readonly:不可用,但是可以提交数据 ng-disabled: 属性是控制标签是否可用(不可用且无法传值) 表达式控制: <input class="col-md-2 fo ...

  5. react和vue,angular的比较

    就这几天我所了解到react情况和大家探讨一下子react的知识: react由facebook团队维护的一套框架,已经应用在instagram网站上了,react以其独特的性能优化方案,正在被越来越 ...

  6. python 使用函数参数注解

    使用函数参数注解是一个很好的办法,它能提示程序员应该怎样正确使用这个函数. 函数注解只存储在函数的annotations 属性中

  7. 腾讯云服务器使用smtp发送邮件

    问题:在腾讯云服务器上使用自编写的邮件服务失败.查其原因,是该邮件服务调用smtpclient.Send(mailMessage)时,出现错误:由于连接方在一段时间后没有正确答复或连接的主机没有反应, ...

  8. <转>jmeter(二十一)jmeter常用插件介绍

    本博客转载自:http://www.cnblogs.com/imyalost/category/846346.html 个人感觉不错,对jmeter讲解非常详细,担心以后找不到了,所以转发出来,留着慢 ...

  9. 第六节 DOM操作应用

    创建.插入和删除元素 创建DOM元素: createElement(标签名); //创建一个节点 appendChild(节点); //追加一个节点 例如:document.body.appendCh ...

  10. MySQL中group by , sum , case when then 的使用

    在我们使用数据库的时候,可能会遇到需要进行统计的情况. 比如需要统计一下,下表中各个年份的胜负场数. 遇到这样的情况,我们应该怎么办呢? 在mysql中我们可以使用group by sum  case ...