编译php中报 cannot find -lmysqlclient_r 错误,原因是percona 的lib中没有mysqlclient_r 而只有libperconaserverclient.so.20.3.8(装的percona5.7版本),只要做个软连接就可以了
编译php中报 cannot find -lmysqlclient_r 错误,原因是percona 的lib中没有mysqlclient_r 而只有libperconaserverclient.so.20.3.8(装的percona5.7版本),只要做个软连接就可以了
ln -s libperconaserverclient.so.20.3.8 libmysqlclient_r.so ,如果编译选项中不加 --enable-maintainer-zts 则需要ln -s libperconaserverclient.so.20.3.8 libmysqlclient.so ,去掉_r否则编译会提示:configure: error: wrong mysql library version or lib not found
php7.2的编译
yum install -y wget vim pcre pcre-devel openssl openssl-devel libicu-devel gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel ncurses ncurses-devel curl curl-devel krb5-devel libidn libidn-devel openldap openldap-devel nss_ldap jemalloc-devel cmake boost-devel bison automake libevent libevent-devel gd gd-devel libtool* libmcrypt libmcrypt-devel mcrypt mhash libxslt libxslt-devel readline readline-devel gmp gmp-devel libcurl libcurl-devel openjpeg-devel re2c libwebp-devel.x86_64 oniguruma-devel.x86_64
./configure --prefix=/webdata/opt/local/php --with-config-file-path=/webdata/opt/local/php/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-mysqlnd --with-mysqli=/webdata/opt/local/percona/bin/mysql_config --with-pdo-mysql=/webdata/opt/local/percona --enable-mysqlnd-compression-support --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --enable-intl --enable-ftp --with-gd --enable-gd-jis-conv --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --with-libzip --enable-soap --with-gettext --disable-fileinfo --enable-opcache - --without-gdbm --with-mysql-sock=/webdata/opt/local/percona/misc/
如果是rpm安装的mysql,比如percona-8.X 编译的时候,不要指定路径,rpm安装的路径都在系统路径中,只需要指定如下:
./configure --prefix=/webdata/opt/local/php --with-config-file-path=/webdata/opt/local/php/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-mysqlnd --with-mysqli --with-pdo-mysql --enable-mysqlnd-compression-support --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --enable-intl --enable-ftp --with-gd --enable-gd-jis-conv --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --with-libzip --enable-soap --with-gettext --disable-fileinfo --enable-opcache --without-gdbm --with-mysql-sock=/var/lib/mysql
php-7.4.0 编译选项有不少变化,gd 的 --with-gd 变成 --enable-gd ,原来 --with-jpeg-dir --with-png-dir 后面 -dir都取消掉了。另外,php7.4 默认会编译 sqlite3 和 pdo-sql 所有,如果不需要,则要取消掉 lite3 --without-gdbm --without-sqlite3 --without-pdo-sqlite 还有,linux 7系列中的libzip-devel 都是0.10.1 的,而php编译则需要0.11以上,所以如果默认编译一定要手动源码安装libzip,安装教程见:
https://wenda.zuncuang.com/article/402 最后不安装,需要zip.so 模块的时候,手动在编译。
以下是php7.4的编译选项:
./configure --prefix=/webdata/opt/local/php --with-config-file-path=/webdata/opt/local/php/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-mysqlnd-compression-support --with-iconv-dir --with-freetype --with-jpeg --with-webp --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --enable-intl --enable-ftp --enable-gd --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-zip --enable-soap --with-gettext --disable-fileinfo --enable-opcache --without-gdbm --without-sqlite3 --without-pdo-sqlite --with-mysql-sock=/var/lib/mysql
或者 指定:--with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd 即可
php redis扩展下载地址:http://pecl.php.net/package/redis
redis5-x 安装教程:https://wenda.zuncuang.com/article/428