阿里云ECS服务器Linux环境下配置php运行环境(安装配置篇)
来源:互联网 发布:利希滕贝格图样 淘宝 编辑:程序博客网 时间:2024/05/16 08:37
阿里云ECS服务器Linux环境安装配置php的运行环境,不同于window操作系统下配置,因为是linux操作系统主要是在命令窗体里输入命令来操作,对于初次接触过linux系统的可能会有点怕怕的,下不去手。。。。。。
需要安装的软件有Apache+PHP+MySQL。
安装Apache
yum install httpd #根据提示,输入Y安装即可成功安装
安装成功后开启Apache,
/etc/init.d/httpd start #启动Apache
Apache启动之后可能会提示错误:
httpd:httpd: Could not reliably determine the server's fully qualif domain name, using ::1 for ServerName
解决方法:
vi /etc/httpd/conf/httpd.conf #编辑http.conf文件
查找到 #ServerName www.example.com:80
按“i”键代表修改文档
修改为 ServerName localhost:80 #这里设置为你自己的域名,如果没有域名,可以设置为localhost
按“Esc”键退出,然后再按“:wq”#保存退出
chkconfig httpd on #设为开机启动
/etc/init.d/httpd restart #重启Apache服务器
(如果不是很确定在命令窗体能够修改,可以下载一个WinSCP连接服务器后按 /etc/httpd/conf/httpd.conf这个路径查找修改,代码大概在278行,在修改之前把文件格式先转换为utf-8编码,或者先将httpd.conf 文件备份,防止改错了可以替换回去!!)
第一步已经完成了,哈哈哈哈!
安装MySQL
yum install mysql mysql-server #根据提示,输入Y安装即可成功安装
/etc/init.d/mysqld start #启动MySQL服务
chkconfig mysqld on #设置为开机启动
cp /usr/share/mysql/my-medium.cnf /etc/my.cnf #拷贝配置文件
接下来就是为mysql的root账号设置密码(默认的密码是空)
mysql_secure_installation 按回车键
如果你是新安装mysql,会弹出提示:
In order to log into MySQL to secure it, we'll need the current password for the root user. If you've just installed MySQL, and you haven't set the root password yet, the password will be blank, so you should just press enter here.
Enter current password for root (enter for none):
因为你是新安装,默认密码为空,直接按enter键就可以。
然后设置新的密码,输入Y即可
输入两次密码确认(一定要记住密码哦!后面设置其他用户还需要用的密码进入MySQL,创建用户等操作)
再接着就是会有若干个提示:
By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into aproduction environment.
Remove anonymous users? [Y/n] y
MySQL会默认创建一个匿名用户,问你是否删除,一般输入Y删除掉。
Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y
root用户默认只能访问localhost,以防有人猜密码,是否禁止root登陆,一般选择yes。
By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment.
Remove test database and access to it? [Y/n]
mysql默认创建一个名为test的数据库,这个库任何人都可以访问,是否删除掉,一般不删除。
Reloading the privilege tables will ensure that all changes made so far will take effect immediately.
Reload privilege tables now? [Y/n]
意思是上面的修改是否马上生效:输入Y
最后会出现:Thanks for using MySQL!
MySQL密码设置完成,重新启动MySQL:
/etc/init.d/mysqld restart #重启MySQL服务
设置mysql远程连接
配置mysql允许远程连接的方法
默认情况下,mysql只允许本地登录,如果要开启远程连接,则需要修改/etc/mysql/my.conf文件。
一、修改/etc/mysql/my.conf
找到bind-address = 127.0.0.1这一行
改为bind-address = 0.0.0.0即可
二、为需要远程登录的用户赋予权限
1、新建用户远程连接mysql数据库
grant all on *.* to admin@'%' identified by '123456' with grant option;
flush privileges;
允许任何ip地址(%表示允许任何ip地址)的电脑用admin帐户和密码(123456)来访问这个mysql server。
注意admin账户不一定要存在。
2、支持root用户允许远程连接mysql数据库
grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
flush privileges;
三、查看系统用户
安装php
yum install php #根据提示,输入Y安装即可成功安装
安装其他版本源
CentOS yum 安装 PHP 5.6.24
- 阿里云ECS服务器Linux环境下配置php运行环境(安装配置篇)
- 阿里云ECS服务器Linux环境下配置php运行环境(安装配置篇)
- 阿里云ECS服务器php运行环境配置全过程
- 阿里云ECS服务器php运行环境配置全过程
- 阿里云ECS服务器Linux环境下配置php服务器(一)
- 阿里云(ECS)Linux服务器,以及LAMP环境配置笔记
- 在阿里云ECS下安装java运行环境
- 阿里云服务器ECS 第二篇:Java运行环境搭建
- ECS Linux服务器安装JDK配置JAVA环境
- 阿里云ECS服务器配置LAMP时安装配置PHP扩展填坑(三)
- 阿里云服务器Linux下配置web服务环境
- 阿里云---阿里云服务器ECS安装jdk环境
- 阿里云---阿里云服务器ECS安装jdk环境
- 配置(Linux、JDK、Tomcat、nginx)阿里云ecs服务器
- 阿里云linux服务器配置(node环境)
- Linux系统下配置服务器运行环境
- 阿里云服务器ECS配置(亲测)
- linux tomcat下配置php运行环境
- 一脸懵逼学习keepalived(对Nginx进行热备)
- ADODB处理事务
- 《字符串》
- 让两个div元素有相同的高度
- 输入一棵二叉搜索树,将该二叉搜索树转换成一个排序的双向链表。要求不能创建任何新的结点,只能调整树中结点指针的指向。
- 阿里云ECS服务器Linux环境下配置php运行环境(安装配置篇)
- PHP+MYSQL中使用PDO中执行SQL语句
- HighCharts入门教程
- 聚合支付态度支付,满足各类支付场景需求
- 递归
- PHP+MYSQL中使用PDO获取结果集的fetch方法
- imageload封装类
- PHP+MYSQL中使用PDO的query方法
- eclipse 工程感叹号处理