执行命令下载、安装yum源,当前是针对Centos6并且64位版本的源:
[[email protected]_249 yum.repos.d]# rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm [[email protected]_249 yum.repos.d]# rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
编辑[remi.repo]下的enabled选项从0设为1
[[email protected]_249 yum.repos.d]# sed -i ‘/enabled/s/=0/=1/g‘ /etc/yum.repos.d/remi.repo
运行如下命令
[[email protected]_249 yum.repos.d]# yum clean all [[email protected]_249 yum.repos.d]# yum makecache
安装php5.4
[[email protected]_249 yum.repos.d]# yum install php54 php54-php-devel php54-php-mysql* php54-php-gd php54-php-fpm php54-php-mbstring
如果安装php5.5
[[email protected]_249 yum.repos.d]# yum install php55 php55-php-devel php55-php-mysql* php55-php-gd php55-php-fpm php55-php-mbstring
目前可以安装到php7.0
查看所有支持版本
[[email protected]_249 yum.repos.d]# yum list php* |grep php-devel php-devel.x86_64 5.3.3-46.el6_6 @updates php54-php-devel.x86_64 5.4.45-2.el6.remi @remi php-devel.x86_64 5.6.15-1.el6.remi remi-php56 php55-php-devel.x86_64 5.5.30-1.el6.remi remi php56-php-devel.x86_64 5.6.16-0.1.RC1.el6.remi remi-test php70-php-devel.x86_64 7.0.0-0.25.RC8.el6.remi remi
运行如下命令[yum update PHP*],则直接升级到php5.6
安装运行yum报错解决方法:
Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again
编辑[epel.repo]下的baseurl前的#号去掉,mirrorlist前添加#号
[[email protected]_249 yum.repos.d]# sed ‘s/#baseurl=/baseurl=/g;s/mirrorlist=/#mirrorlist=/g‘ /etc/yum.repos.d/epel.repo
1.安装php
yum install php -y
2.安装PHP组件,使PHP支持MySQL,输入命令:
yum install php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt -y
3.在/etc目录中找到php.ini文件,下载到本地,使用Notepad++打开。
expose_php = Off #禁止显示php版本的信息 display_errors = OFF #关闭错误提示 register_globals = OFF #关闭注册全局变量 magic_quotes_gpc = On #打开magic_quotes_gpc来防止SQL注入 log_errors = On #记录错误日志
4.安装mysql:
yum install mysql mysql-server
启动mysql:
/etc/init.d/mysqld start 建议开机启动chkconfig --level 3 mysqld on 开端口:
/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT cantos 6.9打开80端口
/etc/rc.d/init.d/iptables save 保存
vi /etc/selinux/config
#SELINUX=enforcing #注释掉
#SELINUXTYPE=targeted #注释掉
SELINUX=disabled #增加
时间: 2024-10-11 21:24:49