Ubuntu下搭建LAMP环境

2024-10-12 11:56:13

1、安装Apachesudoapt-get installapache2

Ubuntu下搭建LAMP环境

3、通过浏览器访问服务器的IP,如果出现Apache欢迎界面,表示安装成功,如下所示

Ubuntu下搭建LAMP环境

5、查看PHP的版本php –v

Ubuntu下搭建LAMP环境Ubuntu下搭建LAMP环境

8、重启mysql和Apachesudoservice mysql restartsudoservice apache2 restart

Ubuntu下搭建LAMP环境

10、创建一个php文件来测试环境是否安装成功,cd /var /www/html vim info.phpPHP文件内容:echo mysql_connect(‘localhost’,’root’,’123456’)? “success” :”fail”;echo phpinfo();访问该文件IP/info.php查看是否连接成功

Ubuntu下搭建LAMP环境

11、启用mod_rewrite模块,重启apache2服务。

Ubuntu下搭建LAMP环境Ubuntu下搭建LAMP环境

13、安装phpmyadmin,sudo apt-get install phpmyadmin测试phpmyadmin, ln -s/usr/share/phpmyadmin/var/www然后直接运行http://ip地址/phpmyadmin,看有没有数据库管理软件出现。

Ubuntu下搭建LAMP环境Ubuntu下搭建LAMP环境

15、需要在php开启mbstring

Ubuntu下搭建LAMP环境

17、输入用户名密码可以访问了。Lamp环境搭建完成

猜你喜欢