Home > php教程 > php手册 > ubuntu下apache+mysql+php安装笔记

ubuntu下apache+mysql+php安装笔记

WBOY
Release: 2016-06-06 19:58:18
Original
1046 people have browsed it

1. 安装apache $ sudo apt-get install apache2 测试: 浏览器中输入:http://192.168.21.133/ 192.168.21.133为ubuntu IP 2. 安装PHP $ sudo apt-get install php5 $ sudo apt-get install libapache2-mod-php5 $ sudo /etc/init.d/apache2 restart 测试:s

1. 安装apache
$sudo apt-get install apache2
测试:
浏览器中输入:http://192.168.21.133/
192.168.21.133为ubuntu IP

2. 安装PHP
$ sudo apt-get install php5
$ sudo apt-get install libapache2-mod-php5
$ sudo /etc/init.d/apache2 restart

测试:sudo vim /var/www/test.php
vim输入:



<?php echo "Hello World";
?>


Copy after login
在浏览器中输入:http://192.168.21.133/test.php

浏览器中输出hello world,表示安装正确

3. 安装mysql

$sudo apt-get install mysql-server
开启外部访问权限
$grant all privileges on *.* to root@"%" identified by"123456";  

$ sudo vi /etc/mysql/my.cnf

bind-address=127.0.0.1=> bind-address= 你机器的IP
或者注释bind-address=127.0.0.1这行
这样就可以允许其他机器访问MySQL了

参考:http://wiki.ubuntu.org.cn/MySQL%E5%AE%89%E8%A3%85%E6%8C%87%E5%8D%97

4. 让apache、php支持 mysql
$sudo apt-get install libapache2-mod-auth-mysql
$sudo apt-get install php5-mysql
$sudo /etc/init.d/apache2 restart

5.安装phpmyadmin
$sudo apt-get install phpmyadmin
$sudo ln -s /usr/share/phpmyadmin /var/www/
使用:http://localhost/phpmyadmin/ 访问


参考:http://www.linuxidc.com/Linux/2010-07/27230.htm

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template