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. POJ3461 Oulipo 字符串

    正解:kmp/哈希 解题报告: 传送门! 这题其实就kmp板子,,,用来复习下kmp的太久没打了QAQ 所以kmp做法就不港了放个代码就是了QAQ #include<algorithm> ...

  2. ADC裸机程序

    硬件平台:JZ2440 实现功能:通过采集触摸屏ADC的电压值,推算触摸xy坐标 start.s init.c nand.c interrupt.c uart.c uart.h my_stdio.c ...

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

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

  4. python基础之 异常处理和logging模块

    1.异常处理 l = ['apple','admin','kobe'] for id,item in enumerate(l,1): print(id,item) try: choose_id = i ...

  5. 这10个Python项目超有趣!

    前言: Python可谓是现在很多人正在学或者想学的一个脚本语言了,提到学习自然就少不了拿项目练手,可是一般的项目根本提不起兴趣嘛,这10个项目可是非常有趣的,不信你看看. [Python 图片转字符 ...

  6. vue-awesome-swiper组件不能自动播放和导航器小圆点不显示问题

    from: https://blog.csdn.net/osdfhv/article/details/79062427 <template> <div class="swi ...

  7. crontab定时

    yum install -y vixie-cron --安装定时服务 每分钟更新一次商品crontab -e* * * * * /usr/bin/curl http://test.wadao.com/ ...

  8. SD卡与FAT32系统学习

    2011-06-06 23:04 前2天,我了解了一下SD卡驱动的原理及FAT32文件系统的结构.接着准备主要已移植为主.通过LCD显示SD卡中的图片.但我需要分步进行. 0,使sd卡能读写数据.1, ...

  9. 20190403vim编辑器week1_day3

    vi编辑器 作用:编辑文本文件中的内容的工具 命令历史 末行模式中,以:和/开头的命令都有历史纪录,可以首先键入:或/然后按上下箭头来选择某个历史命令. 启动vim 在命令行窗口中输入以下命令即可 v ...

  10. Log4j配置记录

    log4j的配置文件就是用来设置记录器的级别.存放器和布局的,它可接key=value格式的设置或xml格式的设置信息.通过配置,可以创建出Log4J的运行环境. 1.配置文件 log4j配置文件的基 ...