Debian下Apache2+Mysql5+Php5的安裝配置_PHP教程

來源:互聯網
上載者:User

安裝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


http://www.bkjia.com/PHPjc/531671.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/531671.htmlTechArticle安裝AMP apt-get install apache2 mysql-server php5 php5-mysql5 配置 Apache2 預設網站 vi /etc/apache2/sites-enabled/000-default 加入一行 RedirectMatch ^/$ /apache2-defaul...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.