且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Ubuntu上安装LAMP服务器

更新时间:2022-09-12 09:11:35

1.安装Ubuntu上安装LAMP

1
apt-get install lamp-server^

2.安装过程中设置MySql密码

3.测试 创建index.php

var/www/html/index.php

index.php的内容为

1
<?php phpinfo(); ?>

重启apache,

service apache2 restart

在浏览器中输入

1
http://localhost/index.php

或者localhost改为IP地址

5配置MYSql

1
cat /etc/hosts | grep localhost

显示:127.0.0.1  localhost

1
cat /etc/mysql/my.cnf | grep bind-address

显示:bind-address = 127.0.0.1

 

6.  安装phpMyAdmin

1
apt-get install phpmyadmin

7. 配置Apache服务器

1
cp /etc/phpmyadmin/apache.conf /etc/apache2/conf-enabled/phpmyadmin.conf

然后重启apache

访问http://localhost/phpmyadmin页面

如果出现如下错误:

#2002 - The server is not responding (or the local MySQL server's socket is not correctly configured)

解决方法:

/etc/mysql/my.cnf

1
2
3
[client]
port            = 3306
socket          = /var/run/mysqld/mysqld.sock

 

本文转自Work Hard Work Smart博客园博客,原文链接:http://www.cnblogs.com/linlf03/p/5819075.html,如需转载请自行联系原作者