mysql5.55--php5.2.17的编译安装--以及附打补丁

83 篇文章 0 订阅
mysql : http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.55.tar.gz

php : http://museum.php.net/php5/php-5.2.17.tar.gz

nginx : http://nginx.org/download/nginx-1.12.1.tar.gz

zendopimizer : http://www.zend.com/en/download/1448

mkdir -p /usr/local/related

mkdir -p /usr/local/zendoptimizer

cd 5_2_x_comp/


cp ./ZendOptimizer.so /usr/local/zendoptimizer/



开始安装nginx:----(http://blog.csdn.net/youcijibi/article/details/75050993);

1,安装pcre

./configure --prefix=/usr/local/related/pcre

make && make install


2, 安装perl http://www.cpan.org/src/5.0/perl-5.26.0.tar.gz

./configure.gnu --prefix=/usr/local/related/perl

make && make install

3,安装zlib

./configure --prefix=/usr/local/related/zlib

make && make install

4,升级openssl (  https://www.openssl.org/source/openssl-fips-2.0.16.tar.gz-------https://www.openssl.org/source/openssl-1.1.0f.tar.gz  ) --报错crypto/err/err_all.c:47:9: error: void value not ignored as it ought to be
可能是因为版本过高

最近在弄openssl,发现openssl-fips-2.0.6.tar.gz其实是编译出来一个fips的模块,编译出来的东西指定安装在/usr/local/ssl/fips-2.0/目录,然后编译openssl-1.0.1h.tar.gz时config时指定OPENSSL_FIPS,就可以把fips模块编进来,
如果报头文件错误可以把/usr/local/ssl/fips-2.0/include/openssl替换系统的/usr/include/openssl,
如果找不到相关库可以用--with-fipslibdir=/usr/local/ssl/fips-2.0/lib指定,我测试龙芯的机器加入fips模块后比直接编译openssl-1.0.1h.tar.gz,openssl speed rsa512测试能提高20倍


./config FIPS --prefix=/usr/local/openssl --with-fipsdir=/usr/local/openssl_fips

./config fips --with-fipslibdir=/usr/local/openssl_fips/lib --prefix=/usr/local/openssl

(crypto/err/err_all.c:35:27: fatal error: openssl/fips.h: No such file or directory
)

fips版本还不明白如何使用,改用久一点的版本,否则装php还是要报错,因为openssl-1.0及以上的版本需要php-7.1支持

不过不甘心还是测试fips版

装的版本为 :openssl-0.9.8zf.tar.gz   ,,  openssl-fips-2.0.9.tar.gz

/config fips --prefix=/usr/local/related/openssl-0.9.8zf --with-fipslibdir=/usr/local/related/openssl-fips-2.0.9/lib --openssldir=/usr/local/related/openssl-0.9.8zf/ssl

还是报错:

接下来测试另外版本:

openssl-0.9.8.tar.gz

openssl-fips-2.0.tar.gz

./config fips --prefix=/usr/local/related/openssl-0.9.8 --with-fipslibdir=/usr/local/related/openssl-fips-2.0/lib


这个版本正常,而且测试说明openssl文件里面不能有fips文件夹才行


测试版本 openssl-1.0.1h.tar.gz,,,openssl-fips-2.0.tar.gz

多指定一次fips的安装目录

./config fips --prefix=/usr/local/related/openssl-1.0.1h --with-fipslibdir=/usr/local/related/openssl-fips-2.0/lib/ --with-fipsdir=/usr/local/related/openssl-fips-2.0/


make 成功

make install 成功

再次安装生成共享库文件

./config fips shared --prefix=/usr/local/related/openssl-1.0.1h --with-fipslibdir=/usr/local/related/openssl-fips-2.0/lib/ --with-fipsdir=/usr/local/related/openssl-fips-2.0/


make && make install

将安装好的openssl 的openssl命令软连到/usr/bin/openssl
ln -s /usr/local/related/openssl/bin/openssl /usr/bin/openssl

并没有做以下这几步,因为查看版本已经更新,如果后面有问题再处理:
——————————————————————————————————————————————————————————————————————————

修改系统自带的openssl库文件,如/usr/local/lib64/libssl.so(根据机器环境而定) 软链到升级后的libssl.so
ln -s /usr/local/related/openssl/lib/libssl.so.1.1 /usr/local/lib64/libssl.so     ----注意时usr/local下的lib64不是/usr/lib64,两个目录下又同名目录

在/etc/ld.so.conf文件中写入openssl库文件的搜索路径
echo "/usr/local/related/openssl/lib" >> /etc/ld.so.conf

使修改后的/etc/ld.so.conf生效
ldconfig -v

——————————————————————————————————————————————————————————————————————————————————

然后 openssl version -a 查看版本,已更新 :
OpenSSL 1.0.1h-fips 5 Jun 2014
built on: Mon Sep 11 12:02:28 CST 2017

开始安装mysql


——————————安装ncurses---------------不使用yum -y install ncurses-devel
 

    下载 wget http://ftp.gnu.org/gnu/ncurses/ncurses-6.0.tar.gz

注意加上--with-shared

./configure --prefix=/usr/local/related/ncurses-6.0 --with-shared




安装 m4 ,安装bison

http://ftp.gnu.org/gnu/m4/m4-1.4.18.tar.gz
将m4的bin目录加入$PATH

wget http://ftp.gnu.org/gnu/bison/bison-3.0.4.tar.gz



安装mysql

cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql/ -DMYSQL_DATADIR=/usr/local/mysql/data  -DWITH_INNOBASE_STORAGE_ENGINE=1  -DMYSQL_TCP_PORT=3306  -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock  -DMYSQL_USER=mysql  -DWITH_DEBUG=0


因为ncurses为自定义安装,所以这里做下指定

/etc/ld.so.conf里面未做/usr/local/related/ncurses-6.0/lib的配置

只做了如下:

ln -s /usr/local/related/ncurses-6.0/bin/ncurses-config /usr/bin   --这个做了删除后测试也可以

ln -s /usr/local/related/ncurses-6.0/lib/libncurses.so /usr/lib64/


编译时能看到:

-- Looking for cbreak in /usr/lib64/libncurses.so
-- Looking for cbreak in /usr/lib64/libncurses.so - found
-- Found Curses: /usr/lib64/libncurses.so  
-- Looking for tputs in /usr/lib64/libncurses.so
-- Looking for tputs in /usr/lib64/libncurses.so - found

接下来 make && make install


安装完成:进行下一步。

cd /usr/local/mysql/support-files
cp mysql.server /etc/init.d/mysqld
cp my-large.cnf /usr/local/mysql/my.cnf


修改 /etc/init.d/mysqld    


mysqld_pid_file_path=/usr/local/mysql/pids/mysqld.pid


修改 /usr/local/mysql/my.cnf

添加 basesir=/usr/local/mysql

    datadir=/usr/local/mysql/data

添加一个分段:
[mysqld_safe]
log-error=/usr/local/mysql/logs/mysqld.log

pid-file=/usr/local/mysql/pids/mysql.pid

同时记得创建mysqld.log这个文件,mysql无法自动创建

vi /usr/local/mysql/logs/mysqld.log     不创建的话也会造成报pid无法启动的错。

然后初始化

/usr/local/mysql/scripts/mysql_install_db --defaults-file=/usr/local/mysql/my.cnf --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql  

修改一次权限:chown -R mysql:mysql /usr/local/mysql

修改数据库密码:

/usr/local/mysql/bin/mysqladmin -u root password 'new-password'
/usr/local/mysql/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'

折腾很久,对于ncurses ,直接yum -y install ncurses-devel 是最好选择

————————————————php5.2.17的编译安装------------------------------------------------------------

1. http://museum.php.net/ 下载待打补丁的版本,以 php-5.2.17 为例子.

cd src

 wget "http://museum.php.net/php5/php-5.2.17.tar.gz" && tar -zxf php-5.2.17.tar.gz

2. 到 http://php-fpm.org/downloads/ 下载对应版的补丁文件,并打补丁.

wget "http://php-fpm.org/downloads/php-5.2.17-fpm-0.5.14.diff.gz" && gzip -cd php-5.2.17-fpm-0.5.14.diff.gz | patch -d php-5.2.17 -p1

如此便完成了打补丁的工作,在编译 php 时, ./configure 参数中 --enable-fpm 可以使用了.


附上一个php5.2.17的编译配置项:

./configure --prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--with-mysql=/usr/local/mysql  \
--with-mysqli=/usr/local/mysql/bin/mysql_config \
--with-mysql-sock=/usr/local/mysql/mysql.sock \
--enable-fpm \
--with-libxml-dir=/usr/local/related/libxml2-2.8.0 \
--with-openssl=/usr/local/related/openssl-1.0.2l \
--with-zlib-dir=/usr/local/related/zlib-1.2.11 \
--with-jpeg-dir=/usr/local/related/jpeg-9b \
--with-png-dir=/usr/local/related/libpng-1.6.24 \
--with-curl=/usr/local/related/curl-7.54.1 \
--with-iconv \
--with-pcre-regex \
--enable-bcmath \
--enable-ftp \
--enable-sockets \
--enable-mbstring \
--enable-mbregex \
--with-gd \
--enable-soap \
--with-mcrypt=/usr/local/related/libmcrypt-2.5.8 \
--enable-zip \


如果报错:

warning: bison versions supported for regeneration of the Zend/PHP parsers: 1.28 1.35 1.75 1.875 2.0 2.1 2.2 2.3 2.4 2.4.1 (found: none).

请参照以下版本信息:


PHP 5.4: 1.28, 1.35, 1.75, 1.875, 2.0, 2.1, 2.2, 2.3, 2.4, 2.4.1, 2.4.2, 2.4.3, 2.5, 2.5.1, 2.6, 2.6.1, 2.6.2, 2.6.4
PHP 5.5: 2.4, 2.4.1, 2.4.2, 2.4.3, 2.5, 2.5.1, 2.6, 2.6.1, 2.6.2, 2.6.3, 2.6.4, 2.6.5, 2.7
PHP 5.6: 2.4 or later, excluding 3.0 only (3.0.1 and later are OK)
PHP 7.0: 2.4 or later

wget http: //ftp .gnu.org /gnu/bison/bison-2 .4.1. tar .gz
tar  -zxvf bison-2.4.1. tar .gz
cd  bison-2.4.1/
. /configure
make
make  install
如果还有以下报错:

checking for bison version... (cached) invalid
configure: warning: bison versions supported for regeneration of the Zend/PHP parsers: 1.28 1.35 1.75 1.875 2.0 2.1 2.2 2.3 2.4 2.4.1 (found: none).
checking for flex... (cached) lex


configure: warning: flex versions supported for regeneration of the Zend/PHP parsers: 2.5.4  (found: none)
checking for re2c... no
configure: warning: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值