centos 5.8 安装 php 5.2 mysql 5.1

方法3  IUS

http://iuscommunity.org/Docs/ClientUsageGuide

http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/
http://wiki.iuscommunity.org/Repos

打开
http://dl.iuscommunity.org/pub/ius/stable/
查找

文件 /Redhat/5/x86_64/
查找最新
epel-release-5-xxx.noarch.rpm
ius-release-xxxxxxx.ius.el5.noarch.rpm

安装
wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/ius-release-xxxxx.ius.el5.noarch.rpm

wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/epel-release-xxxxxx.ius.el5.noarch.rpm

rpm -Uvh ius-release*.rpm epel-release*.rpm


列表可以安装的包
yum list | grep -w \.ius\.


安装 replace 插件
$ sudo yum install yum-plugin-replace

查看 php
[root@linuxbox ~]# rpm -qa | grep php


替换新版 php

yum replace php --replace-with php52

安装几个插件
yum install -y php52-xml php52-dom php52-mcrypt php52-gd php52-mbstring php52-mhash

替换后查看
[root@linuxbox ~]# php -v

重启 apache
[root@el5-i386 ~]# httpd -t
Syntax OK

[root@el5-i386 ~]# /etc/init.d/httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]

替换 mysql
yum replace mysql --replace-with mysql51

 

 

命令列表如下

 

wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/epel-release-5-4.noarch.rpm
wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/ius-release-1.0-10.ius.el5.noarch.rpm
rpm -Uvh ius-release*.rpm epel-release*.rpm
yum install yum-plugin-replace
yum replace php --replace-with php52
yum install -y php52-xml php52-dom php52-mcrypt php52-gd php52-mbstring php52-mhash
yum remove mysql.i386
yum replace mysql --replace-with mysql51
/etc/init.d/httpd restart
httpd -v
php -v
mysql -v

mysql 升级了 需要修复权限 否则 virtualmin 会出错

mysql_fix_privilege_tables --user=root --password= --verbose

 

1and1 需要修复 quotas

repquota -uga

关闭 quotas

System Settings
 

Virtualmin Configuration

 

Set quotas for domain and mail users?   

 

 


如果需要重设mysql root 密码
方法如下
service mysqld stop
建立文件
/home/mysql-init
内容如下
UPDATE mysql.user SET Password=PASSWORD('') WHERE User='root';
FLUSH PRIVILEGES;
运行
mysqld_safe --init-file=/home/mysql-init &
运行结果 密码为空

如需改变密码 方法如下
mysql -u root -pxxxx
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyPW');
exit

 

还需要设置开机启动 mysql

chkconfig mysqld on

#vi /etc/rc.d/rc.local

#/etc/rc.d/init.d/mysqld start

 

 

2. php.ini  修改 /etc/php.ini

 

upload_max_filesize = 100M

 

post_max_size = 10M

 

max_execution_time = 60 ; Maximum execution time of each script, in seconds
max_input_time = -1 ; Maximum amount of time each script may spend parsing request data
memory_limit = 256M ; Maximum amount of memory a script may consume (16MB)

 

--------------------------------------------------------------------------------------------------------------------------------------------

方法1

www.CTOHome.com/linux-vps-pack/php5.2.sh

 

 

yum 设置 源 关闭

xxxx.repo 设置 enabled=0

 

然后使用 yum --enablerepo=xxxx install 来安装

#!/bin/bash
rpm --import http://repo.webtatic.com/yum/RPM-GPG-KEY-webtatic-andy
wget -P /etc/yum.repos.d/ http://repo.webtatic.com/yum/webtatic.repo
echo 'exclude=php*5.3*' >> /etc/yum.conf
yum --enablerepo=webtatic --exclude=php*5.3* update -y php
yum --enablerepo=webtatic --exclude=php*5.3* install -y php-xml php-dom php-mcrypt php-gd php-mbstring php-mhash
yum --enablerepo=webtatic --exclude=php*5.3* upgrade -y php-xml php-dom php-mcrypt php-gd php-mbstring php-mhash

service httpd restart
echo '';
echo '';
echo " ==========   www.CTOHome.com   ============"
echo " ==========      PHP Version    ============"
php -v
echo '';
echo '';

 

 

 

 

方法2

rpm --import http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka

 

[utterramblings]
name=Jason's Utter Ramblings Repo
baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka

 

 

vi /etc/yum.conf

最后一行增加

exclude=php*5.3*

 

 

Last modified onTuesday, 12 April 2016 22:48

Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php on line 169

Notice: Only variables should be assigned by reference in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php on line 478
back to top