今天升级了服务器的MYSQL到5.5,是通过RPM安装,升级之后发现项目中PHP报错,于是打算将PHP也升级下。
首先下载PHP源码,我这里下载的是PHP 5.6.8,解压到/usr/local/后开始进行编译
./configure \--prefix=/usr/local/php \--with-config-file-path=/usr/local/php/etc \--with-mysql=/usr/ \--with-mysqli=/usr/bin/mysql_config \--with-mysql-sock=/tmp/mysql.sock \--enable-fpm \--enable-sockets \--enable-ftp \--enable-mbstring \--enable-zip \--enable-exif \--enable-soap \--enable-gd-native-ttf \--enable-mbregex \--disable-ipv6 \--with-fpm-user=www \--with-fpm-group=www \--with-libxml-dir \--with-mhash \--with-gd \--with-jpeg-dir \--with-png-dir \--with-freetype-dir \--with-zlib-dir \--with-mcrypt \--with-pear \--with-curl \--with-openssl \--with-iconv-dir \--enable-pcntl \--disable-fileinfo
因为mysql是RPM安装的,所以在安装的时候遇到了几个问题:
configure: error: Cannot find MySQL header files under /usr/bin/.
Note that the MySQL client library is not bundled anymore!
首先是报这个错误,全局搜索了下发现确实没有mysql.h这个头文件,Google后发现应该安装MySQL-devel-5.5.44-1.rhel5.x86_64.rpm这个开发包,
安装Mysql devel包之后重新编译还是报错
configure: error: Cannot find libmysqlclient under /usr.
find / -name libmysqlclient* 发现这个文件存在于/usr/lib64/mysql/这个目录下,而php编译的时候默认去/usr/lib下查找,于是
mkdir -p /usr/lib/mysql cp -r /usr/lib64/mysql/* /usr/lib/mysql/
再次编译后通过了.
但是在make 的过程中,因为我们的测试机器内存只有512M,很不幸的再次报错。
virtual memory exhausted: Cannot allocate memory
make: *** [ext/fileinfo/libmagic/apprentice.lo] Error 1
google后在这里找到了答案https://bugs.php.net/bug.php?id=48809
再次编译,make 通过
时间: 2024-10-19 12:47:17