手把手教你在Ubuntu上安装Apache、MySql和PHP
1:首先安装apache:打开终端(ctrl+Alt+t),
输入命令:sudo apt-get install apache2即可安装,
安装完后,打开浏览器,在地址栏输入:localhost或者http://127.0.0.1
看到It works,表示安装成功!
默认根目录:/var/www/
2:安装mysql:
sudo apt-get install mysql-server-5.0
安装完后,会要你新设置mysql root密码,输入你自己的密码后enter键,再确认密码。
3:安装PHP 5 and Apache PHP 5 module:
sudo apt-get install php5 libapache2-mod-php5
sudo /etc/init.d/apache2 restart(重启apache)
试试成功否:
命令:gksudo gedit /var/www/text.php 【在apache默认根目录/var/www/下创建一text.php文件】
在text.php文件中输入以下代码检验是否安装成功:
<ol class="dp-xml"> <li class="alt"><span><span class="tag"></span><span class="tag-name">php</span><span> </span></span></li> <li><span>echo “helloworld”; </span></li> <li> <span> </span><span class="tag">?></span><span> </span> </li> </ol>
在浏览器地址栏输入:http://localhost/text.php 如果页面显示helloworld则表示成功
温馨提示:如果返回终端时无法再次输入命令时,按ctrl+z组合键
4:让apache和php支持php :
sudo apt-get install libapache2-mod-auth-mysql
sudo apt-get install php5-mysql
sudo /etc/init.d/apache2 restart(重启apache)
至此环境已搭建完!
/var/www/(apache2网页文件放在这里)
/var/lib/mysql(mysql文件放在这里)
如果你要远程连接的话,还要安装SSH,命令:sudo apt-get install ssh
可能我们还是习惯用phpmyadmin
5:安装phpmyadmin
sudo apt-get install phpmyadmin
此时在浏览器上输入:http://localhost/phpmyadmin 发现not found
所以我们还必须把安装好到phpmyadmin文件夹转移到/var/www/下面
sudo ln -s /usr/share/phpmyadmin/ /var/www/
执行上面到命令,我们已经把phpmyadmin文件夹转移到目的地了,也或者你把phpmyadmin直接复制到/var/www/的文件夹下面也可以。
我们再次浏览器上输入:http://localhost/phpmyadmin 回车时发现我们熟悉的界面回来了
原文:http://blog.csdn.net/guaikai/article/details/6905781

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SublimeText3 Chinese version
Chinese version, very easy to use