标签:ubuntu搭建lamp
Ubuntu 搭建LAMP平台
$ sudo apt-get install apache2
$ sudo apt-get install mysql-server-5.5 (root密码随意,如:123456)
$ sudo apt-get install php5
$ sudo apt-get install libapache2-mod-php5 (解决apache识别php页面)
$ sudo apt-get install php5-mysql (解决php连接mysql)
$ sudo ls /etc/php5/conf.d/ (确保该目录下有mysqli.ini、mysql.ini、pdo.ini、pdo_mysql.ini文件,如果在其它路径下拷到该目录下即可)
$ sudo service apache2 restart
验证:
$ sudo vi /var/www/test.php
<?php
phpinfo();
?>
:wq
$ sudo vi /var/www/mysql.php
<?php
$db = mysql_connect("localhost","root","123456") or die("fail");
echo "connect ok!<br>"
?>
:wq
访问http://localhost/test.php http://localhost/mysql.php
本文出自 “linux” 博客,谢绝转载!
标签:ubuntu搭建lamp
原文地址:http://yangzhiming.blog.51cto.com/4849999/1578863