一.安装
1.安装LAMP
在新立得软件包管理器中选择 编辑--使用任务分组标记软件包
在打开的窗口中 勾选 LAMP SERVER 然后确定。
在主窗口中 点击绿色的对号 应用 按钮
好了 。接下来就是等待…等待新立得 自动下载安装完。
中间会有一次提示输入mysql的root用户的密码
您还可以在终端模式下,通过命令行安装:
sudo apt-get install apache2 libapache2-mod-php5 php5 php5-gd mysql-server php5-mysql phpmyadmin
2.安装phpmyadmin
终端中运行命令
sudo apt-get install phpmyadmin
二.配置
1>apache 的配置文件路径 /etc/apache2/apache2.conf
2>php.ini 路径 /etc/php5/apache2/php5.ini
3>mysql配置文件 路径 /etc/mysql/my.cnf
4>phpmyadmin配置文件路径 /etc/phpmyadmin/apache.conf
5>网站根目录 /var/www
1.配置apache
终端中 使用命令
sudo gedit /etc/apache2/apache2.conf
在配置文件最后面加入下面几行:
添加文件类型支持
AddType application/x-httpd-php .php .htm .html
默认字符集 根据自己需要
AddDefaultCharset UTF-8
服务器地址
ServerName 127.0.0.1
添加首页文件 三个的顺序可以换 前面的访问优先 (当然你也可以加别的 比如default.php)
DirectoryIndex index.htm index.html index.php
2.配置PHP5
这个没什么好说的 根据个人自己需要
下面是默认时区
;default.timezone=去掉前面的分号 后面加个PRC 。表示中华人民共和国(就是GMT+8时区)
default.timezone= PRC
3.配置mysql
sudo gedit /etc/mysql/my.cnf
这里有一个地方要注意
因为默认是只允许本地访问数据库的 如果你有需要 可以打开。
bind-address 127.0.0.1这一句是限制只能本地访问mysql的。如果有需要其他机器访问 把这句话用#注释掉
#bind-address 127.0.0.1
4.配置phpmyadmin
phpmyadmin 默认并不是安装在 /var/www下面的而是在 /usr/share/phpmyadmin
你可以把phpmyadmin复制过去 或者 网上有人说你可以创建一个链接 然后把链接复制过去(没有试过)
然后 终端中运行命令
sudo gedit /etc/phpmyadmin/apache.conf
然后把下面两句的路径 改为/var/www/phpmyadmin
Alias /phpmyadmin /usr/share/phpmyadmin
改为:
Alias /phpmyadmin /var/www/phpmyadmin
符:常用命令
1.重启apache
sudo /etc/init.d/apache2 restart
2.重启mysql
sudo /etc/init.d/mysql restart
至此 LAMP环境配置成功,试一下 echo phpinfo(); 吧!
LAMP并没有那么神秘!除去下载的时间,整个配置过程决不会花费您五分钟。
GD库的安装
sudo apt-get install php5-gd
记得装完重启apache
sudo /etc/init.d/apache2 restart
启用 mod_rewrite 模块
sudo a2enmod rewrite
Here is a mini-howto in how to install the xdebug extension with PHP5 in Ubuntu 7.04
This will install xdebug 2.0 (or whatever is latest version in PEAR repository when you try this).
It is assumed you have Apache2 + PHP5 working already.
sudo apt-get install php5-dev php-pear
sudo pecl install xdebug
martin@martin-dev:/$ find / -name 'xdebug.so' 2> /dev/null /usr/lib/php5/20060613/xdebug.so
sudo gedit /etc/php/apache2/php.ini
zend_extension="/usr/lib/php5/20060613/xdebug.so"
sudo /etc/init.d/apache2 restart
with Xdebug v2.0.0, Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, by Derick Rethans
For more information about xdebug configuration and usage, please read the official documentation, found here: http://xdebug.org/docs/