一.apache:
1).安装httpd yum install httpd -y
2). httpd 常用命令
apache 2.4
/bin/systemctl stop httpd.service 停止服务
/bin/systemctl start httpd.service 启动apache
/bin/systemctl restart httpd.service
apache 2.2
service httpd status 查看apache启动状态
service httpd start
service httpd stop
service httpd restart
3).启动apache遇到错误:httpd: Could not reliably determine the server's fully qualified domain name...
解决方法:vim /etc/httpd/conf/httpd.conf 修改serverName localhost:80
服务终于启动了,我们的apache的默认发布目录是:/var/www/html,默认的发布文件是那个目录地下的index.html.
浏览器访问不了,但是apache服务已经开了,那就要考虑防火墙的问题了。
service iptables stop (关闭防火墙)
4).更改apache的默认目录
1).DocumentRoot "目录路径"
2).<Directory "目录路径">
Options Indexes FollowSymLinks
AllowOverride All
Order allow, deny
Allow from all
</Directory>
注意:apache2.2版本的Order allow, deny Allow from all 升级到apache2.4版本就变成了Require all granted
5)注意目录每一级都要有可执行权限,不然会导致无法访问错误。
6)在apache主目录touch 1.php , phpinfo(); 浏览器访问这个文件。会输出php的一些信息. mod_php7
二.php
1). 安装 yum install php -y
2). 配置php.ini
在linux系统中一般php.ini 存放位置在/etc/php.ini
配置date.timezone = 'Asia/Shanghai';
然后重启apache服务
三. mysql:
1).安装: yum install -y mysql-server mysql mysql-deve
(注意)下载不成功,则需要配置yum的ftp源配置。
查看安装的版本:rpm -qi mysql-server
2).启动:service mysqld start /etc/init.d/mysqld start
如果我们是第一次启动mysql服务,mysql服务器首先会进行初始化的配置
当我们再次重新启动mysql服务时,就不会提示这么多信息了
3).配置管理员:mysqladmin -u root password 'root' // 通过该命令给root账号设置密码为 root
4).登录mysql: mysql -u root -p
5)./etc/my.cnf 这是mysql的主配置文件
/var/lib/mysql mysql数据库的数据库文件存放位置
6).创建数据库 create database yest;
7)./var/log mysql数据库的日志输出存放位置
我们的mysql数据库的一些日志输出存放位置都是在/var/log这个目录下
8)通过 chkconfig --list | grep mysqld 命令来查看mysql服务是不是开机自动启动
chkconfig mysqld on 命令来将其设置成开机启动,这样就不用每次都去手动启动了