Home > php教程 > php手册 > Debian下Apache2 Mysql5 Php5的安装配置

Debian下Apache2 Mysql5 Php5的安装配置

WBOY
Release: 2016-06-13 09:50:07
Original
877 people have browsed it

安装AMP

apt-get install apache2 mysql-server php5 php5-mysql5

配置 Apache2 默认站点

vi /etc/apache2/sites-enabled/000-default

加入一行

RedirectMatch ^/$ /apache2-default/

试验这一步不需要

修改 Apache2 主配置

vi /etc/apache2/apache2.conf

要改为:

Include module configuration:

Include /etc/apache2/mods-enabled/*.load Include /etc/apache2/mods-enabled/*.conf

还有:

AddType application/x-httpd-php .php

AddType application/x-httpd-php-source .phps

重新启动 Apache2

/etc/init.d/apache2 reload

现在要配置 PHP 5

vi /etc/php5/apache2/php.ini

Php5 默认已经不支持 Mysql,为了打开支持,要修改

extension=mysql.so

设置 Mysql 根密码

默认安装的 Mysql,其 root 用户没有密码,实在危险,我们为他加一个密码。

mysqladmin -uroot password 'abc123'

其中abc123就是你的密码。

当然你也可以用下面的命令来设置密码:

mysql -u root mysql

mysql> update user set password=password('pass') where user='root';

为将要架设的站点建一个库及其用户

mysql -u root -p mysql

mysql> create database drupal;

mysql> use drupal;

mysql> grant all on drupal.* to drupal_user@localhost;

mysql> use mysql;

Database changed

mysql> update user set password=password('pass') where user = 'drupal_user';

Query OK, 1 row affected (0.00 sec)

Rows matched: 1 Changed: 1 Warnings: 0

mysql>q;

mysqladmin reload

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