php 安装lamp环境,Centos 安装lamp环境(php5.6)

本文详细介绍了如何在 CentOS 系统上安装 Apache 服务器,包括基本的安装、开机启动、服务启动以及扩展安装。接着,指导了 MySQL 的安装、安全配置和远程连接设置,最后演示了 PHP 的安装与配置,涉及添加 EPEL 和 Remi 源,以及启用 PHP 解析。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、安装Apache

1、安装apache

[html]  view plain

copy

print ?

yum -y install httpd

2、开机自动启动

[html]  view plain

copy

print ?

chkconfig httpd on

3、启动http服务

[html]  view plain

copy

print ?

service httpd start

4、安装apache一些扩展

[html]  view plain

copy

print ?

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 ?

yum -y install mysql mysql-server mysql-devel

2、开机启动

[html]  view plain

copy

print ?

chkconfig mysqld on

3、启动mysqld服务

[html]  view plain

copy

print ?

service mysqld start

4、进行安全配置

[html]  view plain

copy

print ?

/usr/bin/mysql_secure_installation

5、查看mysqld监听3306上

[html]  view plain

copy

print ?

netstat -tulpn | grep -i mysql

6、mysql开启远程连接

[html]  view plain

copy

print ?

mysql -h localhost -u root //这样应该可以进入MySQL服务器

GRANT   ALL   PRIVILEGES   ON   *.*   TO   'root'@'%'   WITH   GRANT   OPTION //赋予任何主机访问数据的权限

FLUSH   PRIVILEGES //修改生效

EXIT //退出MySQL服务器

三、安装PHP

1、配置yum源

追加CentOS 6.5的epel及remi源

[html]  view plain

copy

print ?

# rpm -Uvh http://ftp.iij.ad.jp/pub/linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm

# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

CentOS 7.0的源

[html]  view plain

copy

print ?

# yum install epel-release

# rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

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

[html]  view plain

copy

print ?

# 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

3、配置httpd  解析php

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

vim /etc/httpd/conf/httpd.conf

找到

AddType application/x-gzip .gz .tgz

/AddType application

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

重启 httpd

service httpd.conf restart

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值