Centos 安装lamp环境(php5.6)

来源:互联网 发布:php 电商系统 编辑:程序博客网 时间:2024/05/25 13:33

一、安装Apache

1、安装apache

[html] view plain copy
 print?在CODE上查看代码片派生到我的代码片
  1. yum -y install httpd  
2、开机自动启动

[html] view plain copy
 print?在CODE上查看代码片派生到我的代码片
  1. chkconfig httpd on  

3、启动http服务

[html] view plain copy
 print?在CODE上查看代码片派生到我的代码片
  1. service httpd start  

4、安装apache一些扩展

[html] view plain copy
 print?在CODE上查看代码片派生到我的代码片
  1. yum -y install httpd-manual mod_ssl mod_perl mod_auth_mysql  

二、安装配置MySQL

# MySQL          客户端程序

# mysql-server    服务端程序

# mysql-devel    开发设计的库

1、安装MySQL

[html] view plain copy
 print?在CODE上查看代码片派生到我的代码片
  1. yum -y install mysql mysql-server mysql-devel  

2、开机启动

[html] view plain copy
 print?在CODE上查看代码片派生到我的代码片
  1. chkconfig mysqld on  


3、启动mysqld服务

[html] view plain copy
 print?在CODE上查看代码片派生到我的代码片
  1. service mysqld start  

4、进行安全配置

[html] view plain copy
 print?在CODE上查看代码片派生到我的代码片
  1. /usr/bin/mysql_secure_installation  

5、查看mysqld监听3306上

[html] view plain copy
 print?在CODE上查看代码片派生到我的代码片
  1. netstat -tulpn | grep -i mysql  


6、mysql开启远程连接


[html] view plain copy
 print?在CODE上查看代码片派生到我的代码片
  1. mysql -h localhost -u root //这样应该可以进入MySQL服务器  
  2.   
  3. GRANT   ALL   PRIVILEGES   ON   *.*   TO   'root'@'%'   WITH   GRANT   OPTION //赋予任何主机访问数据的权限  
  4.   
  5. FLUSH   PRIVILEGES //修改生效  
  6.   
  7. EXIT //退出MySQL服务器  


三、安装PHP

1、配置yum源

追加CentOS 6.5的epel及remi源

[html] view plain copy
 print?在CODE上查看代码片派生到我的代码片
  1. # rpm -Uvh http://ftp.iij.ad.jp/pub/linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm  
  2. # rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm  

CentOS 7.0的源

[html] view plain copy
 print?在CODE上查看代码片派生到我的代码片
  1. # yum install epel-release  
  2. # rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm  

使用yum list命令查看可安装的包(Packege)。

[html] view plain copy
 print?在CODE上查看代码片派生到我的代码片
  1. # yum list --enablerepo=remi --enablerepo=remi-php56 | grep php  

2、安装PHP5.6

yum install --enablerepo=remi --enablerepo=remi-php56 php php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof php-gd  

  1. 3、配置httpd  解析php

打开/etc/httpd/confg/httpd.conf

vim /etc/httpd/conf/httpd.conf


找到AddType application/x-gzip .gz .tgz

<pre name="code" class="html">/AddType application


在下一行加入AddType application/x-httpd-php .php

重启 httpd 

service httpd.conf restart




0 0
原创粉丝点击