首页 > 数据库技术 > 详细

lnmp之PDO_mysql.so

时间:2016-05-13 04:47:37      阅读:270      评论:0      收藏:0      [点我收藏+]

php和mysql是安装在不同的机器上。

编译php时

./configure \

--with-mysql=mysqlnd  \

--with-mysqli=mysqlnd\

--with-pdo-mysql=mysqlnd

最后mysql的PDO好像没有加载上去。


解决办法:

1、进入源码包:php-5.5.32/ext/pdo_mysql

    /usr/local/services/php/bin/phpize  #可以显示出对应号

    ./configure --with-php-config=/usr/local/services/php/bin/php-config

    make && make install    

    这时就会在该目录下的modules下生成pdo_mysql.so

2、copy文件

    cp modules/pdo_mysql.so  /usr/local/services/php-5.5.32/lib/php/extensions/no-debug-non-zts-20121212/


3、加入到php.ini文件

    extension_dir = "/usr/local/services/php-5.5.32/lib/php/extensions/no-debug-non-zts-20121212/"

    extension="pdo_mysql.so"


4、重启php-fpm即可生效。





==============================================

编译libiconv时出现如下错误

./stdio.h:1010:1: error: ‘gets’ undeclared here (not in a function)
 _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
 ^
make[2]: *** [progname.o] Error 1
make[2]: Leaving directory `/root/libiconv-1.14_2/srclib‘
make[1]: *** [all] Error 2
make[1]: Leaving directory `/root/libiconv-1.14_2/srclib‘
make: *** [all] Error 2

解决方法:

cd libiconv-1.14/srclib

vim stdio.in.h

通过搜索,定位到_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");这一行,然后在这一行的前后加上条件编译即可,修改后的内容如下:

#if defined(__GLIBC__) && !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16)
        _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
#endif

然后再make && make install


============================================

php编译报错

/usr/bin/ld: ext/ldap/.libs/ldap.o: undefined reference to symbol ‘ber_strdup‘
/usr/bin/ld: note: ‘ber_strdup‘ is defined in DSO /lib64/liblber-2.4.so.2 so try adding it to the linker command line
/lib64/liblber-2.4.so.2: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1


解决办法:

./configure后

编辑MakeFile

找到 开头是 ‘EXTRA_LIBS‘ 这一行 在结尾加上 ‘-llber‘ 然后执行 make && make install


lnmp之PDO_mysql.so

原文:http://leyin01.blog.51cto.com/9062123/1772784

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!