在阿里云 centos 6.3上面安装php5.2
由于php程序使用了Zend Optimizer,只能使用php5.2, yum 上的php 是5.3的版本,只能重新安装php;安装步骤如下:
先卸载 php5.3的相关东西:
yum remove php php-mysql
下载php 安装包 php-5.2.15.tar.gz ZendOptimizer-3.3.9-linux-glibc23-x86_64.tar.gz libiconv-1.14.tar.gz 可以在网上直接搜索
安装 libiconv
cd /usr/local/src/php-lib/libiconv-1.14
./configure --prefix=/usr/local/libiconv
make && make install
yum install libpng libpng-devel
yum install libXpm libXpm-devel
yum install libjpeg libjpeg-devel
yum install httpd httpd-devel
yum install mysql mysql-devel
需要拷贝如下文件到lib,php默认会查找/usr/lib/下的so文件 ,否则复制执行不成功
cd /usr/lib
ln -s /usr/lib64/mysql/libmysqlclient.so ./
ln -s /usr/lib64/libpng.so ./
ln -s /usr/lib64/libXpm.so ./
ln -s /usr/lib64/libjpg.so ./
./configure --prefix=/usr/local/php --with-apxs2=/usr/sbin/apxs --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-openssl --with-zlib --enable-bcmath --with-bz2 --enable-gd-native-ttf --with-gettext --enable-mbstring --enable-zip --with-iconv=/usr/local/libiconv --with-curl --enable-soap --enable-sockets --enable-ftp --with-mysql --with-pdo-mysql --with-gd
make && make install
编译参数解释:
--prefix=/usr/local/php : 设置安装路径
--with-apxs2=/usr/local/apache/bin/apxs : 编译共享的 Apache 2.0 模块
--with-config-file-path=/etc : 指定配置文件php.ini地址
--with-config-file-scan-dir=/etc/php.d : 指定额外的ini文件目录
--with-openssl : 编译OpenSSL支持
--with-zlib : 编译zlib支持
--enable-bcmath : 启用BC风格精度数学函数
--with-bz2 : BZip2支持
--with-gd : GD支持
--enable-gd-native-ttf : 启用TrueType字符串函数
--with-gettext : 启用GNU gettext支持
--with-mhash : mhash支持
--enable-mbstring : 启用支持多字节字符串
--with-mcrypt : 编译mcrypt加密支持
--enable-zip : 启用zip 读/写支持
--with-iconv=/usr/local/libiconv : iconv支持
--with-curl : CRUL支持
--enable-soap : SOAP支持
--enable-sockets : SOCKETS支持
--enable-ftp : FTP支持
--with-mysql=/usr/local/mysql : 启用mysql支持
--with-pdo-mysql=/usr/local/mysql : 启用pdo-mysql支持
--without-pear : 不安装PEAR
安装完后会生成php配置文件/etc/php.ini
#在/etc/httpd/conf/httpd.conf文件中加入PHP文件类型解析(加在文件最后即可)
Addtype application/x-httpd-php .php
2.配置 ZendOptimizer
tar zxvf ZendOptimizer-3.3.9-linux-glibc23-x86_64.tar.gz
cp ZendOptimizer-3.3.9-linux-glibc23-x86_64/data/5_2_x_comp/ZendOptimizer.so /usr/lib64/php/modules/
在/etc/php.d内新增配置文件
vi /etc/php.d/zendoptimizer.ini
添加内容:
zend_extension=/usr/lib64/php/modules/ZendOptimizer.so
重启服务器
service httpd restart
使用 phpinfo查看是否 ZendOptimizer.so 安装成功
出现 with Zend Optimizer v3.3 字样说明安装成功了!
安装mysql 5.6.17
1.下载linux源码包 wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.17.tar.gz
2.安装cmake等依赖软件
- yum -y install gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel* make cmake
3:编译安装
- [root@server182 ~]# groupadd mysql
- [root@server182 ~]# useradd -r -g mysql mysql
- [root@server182 ~]# tar -zxvf mysql-5.6.17.tar.gz
- [root@server182 ~]# cd mysql-5.6.17
- [root@server182 mysql-5.6.17]# cmake .
- [root@server182 mysql-5.6.17]# make && make install
- -------------------------默认情况下是安装在/usr/local/mysql
- [root@server182 ~]# chown -R mysql.mysql /usr/local/mysql
- [root@server182 ~]# cd /usr/local/mysql/scripts
- [root@server182 ~]# ./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
- [root@server182 ~]# cd /usr/local/mysql/support-files
- [root@server182 support-files]# cp mysql.server /etc/rc.d/init.d/mysqld
- [root@server182 support-files]# cp my-default.cnf /etc/my.cnf
- [root@server182 ~]# chkconfig -add mysqld
- [root@server182 ~]# chkconfig mysqld on
- [root@server182 ~]# service mysqld start
- Starting MySQL SUCCESS!
- [root@server182 support-files]# mysql
- Welcome to the MySQL monitor. Commands end with ; or \g.
- Your MySQL connection id is 1
- Server version: 5.6.10 Source distribution
- Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
- Oracle is a registered trademark of Oracle Corporation and/or its
- affiliates. Other names may be trademarks of their respective
- owners.
- Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
- mysql>
- mysql> status;
- --------------
- mysql Ver 14.14 Distrib 5.6.10, for Linux (i686) using EditLine wrapper
- Connection id: 1
- Current database:
- Current user: root@localhost
- SSL: Not in use
- Current pager: stdout
- Using outfile: ‘‘
- Using delimiter: ;
- Server version: 5.6.10 Source distribution
- Protocol version: 10
- Connection: Localhost via UNIX socket
- Server characterset: utf8
- Db characterset: utf8
- Client characterset: utf8
- Conn. characterset: utf8
- UNIX socket: /tmp/mysql.sock
- Uptime: 5 min 45 sec
- Threads: 1 Questions: 5 Slow queries: 0 Opens: 70 Flush tables: 1 Open tables: 63 Queries per second avg: 0.014
- -------------
- mysql>
安装完毕。
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。