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. 新建Maven项目时dtd约束出错

    新建或者导入Maven项目时出错:org.apache.maven.archiver.MavenArchiver.getManifesteclipse新建maven项目时,pom.xml文件第一行报错 ...

  2. SPSS提示“列表中不允许存在字符串变量”的解决方法

    点击 查看 菜单->变量->将需要修改为数字类型的列属性改为数字,还可以更改小数位数

  3. android AsyncTask异步任务(笔记)

    AsyncTask是一个专门用来处理后台进程与UI线程的工具.通过AsyncTask,我们可以非常方便的进行后台线程和UI线程之间的交流. 那么AsyncTask是如何工作的哪. AsyncTask拥 ...

  4. VB调用C# dll

    cd C:\Windows\Microsoft.NET\Framework\v4.0.30319注册regasm myTest.dll /tlb:myTest.tlb

  5. python框架之Django(5)-O/RM

    字段&参数 字段与db类型的对应关系 字段 DB Type AutoField integer AUTO_INCREMENT BigAutoField bigint AUTO_INCREMEN ...

  6. spring 事务注解

    在spring中使用事务需要遵守一些规范和了解一些坑点,别想当然.列举一下一些注意点. 在需要事务管理的地方加@Transactional 注解.@Transactional 注解可以被应用于接口定义 ...

  7. CSS中border和outline的区别

    border: border-width:1px; border-style:solid; border-color:#ccc; 可以简写为:border:1ox solid #ccc; outlin ...

  8. cocos2d-x JS 定时器暂停方法

    this.scheduleOnce(function(){ this.addChild(Menugobtn);//要暂停执行的代码 }, 10);

  9. GALV_maptravel研究分析(1)

    强大的地图传送式插件~~ 我以自带demo进行分析,本篇地图Init setting map 1.---------------------------------- 实例 创建地图 Galv.MAP ...

  10. Shell脚本:while read line无法读取最后一行的问题

    [1]Shell脚本:while read line无法读取最后一行的问题 刚刚利用shell脚本处理日志文件时,发现了一个问题:while read line无法读取到最后一行 通过编辑器可以看到待 ...