#如果没有出现以上画面,重启以下apache服务器即可
$: systemctl restart apache2
#以上画面显示的文件内容在 /var/www/html/index.html(学过php的应该很熟悉这个路径)#接下来安装 mysql-server
$: apt install mysql-server
#基本上一路yes#有两个地方,第一在你设置数据库密码之前会有一个验证你输入的密码的复杂度,可以选择验证,也可以输入no
VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?
Press y|Y for Yes, any other key for No: n
#在一个就是是否禁止远程连接(安全性考虑),这里因为之后要用到远程连接,我选择的是no
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? (Press y|Y for Yes, any other key for No): n
# 然后一路yes就可以搞定了,
$: mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.30-0ubuntu0.18.04.1 (Ubuntu)
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h'for help. Type '\c' to clear the current input statement.
#再接着就是安装php
$: apt install php libapache2-mod-php php-mysql
#一路yes,就搞定了。。。。#等等还有一点,#就是再浏览器只输入本机的ip的情况下,页面默认打开的是/var/www/html/index.html,既然我们是学习的php,#那我们不妨设置一下默认打开的是index.php吧。#很简单#只需找到/etc/apache2/mods-enabled/dir.conf 配置文件,用vim打开<IfModule mod_dir.c>
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule># vim: syntax=apache ts=4 sw=4 sts=4 sr noet#可以看出index.html 排在了index.php的前面。我们只需把index.php跳到index.html之前保存退出就可以了。#别忘了,改完配置之后记得重启一下apache2
$: systemctl restart apache2
#linux下的apache,mysql,php就都配置好了,开始你的学习之路吧...................................