LAMP

From KevinWiki

Jump to: navigation, search

APM in web application development normally stands for 'Apache Web Server, PHP and MySQL.'

This instruction is for Ubuntu Linux 8.04 (possibly other versions). It may work for other Linux distributions or may not. This document only has the essential information to install those software packages so for details please see other documents which have the details such as how to configure and use.

Contents

Install Apache Web Server

$ sudo apt-get install apache2 


Install MySQL Database

$ sudo apt-get install mysql-server 

Configuration

-open /etc/mysql/my.cnf file

= Change Charset

-add default-character-set=utf8

user            = mysql
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
port            = 3306
basedir         = /usr
datadir         = /var/lib/mysql
tmpdir          = /tmp
language        = /usr/share/mysql/english
default-character-set=utf8
skip-external-locking

...

[mysql]
#no-auto-rehash # faster start of mysql but no tab completion
default-character-set=utf8
  • For 5.5
[mysqld]
# ...
collation-server = utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-server = utf8


-After adding these two lines, the result of the following command

mysql> show variables like '%character%';

should be changed from

+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | latin1                     |
| character_set_connection | latin1                     |
| character_set_database   | latin1                     |
| character_set_filesystem | binary                     |
| character_set_results    | latin1                     |
| character_set_server     | latin1                     |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)

to

+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8                       |
| character_set_connection | utf8                       |
| character_set_database   | utf8                       |
| character_set_filesystem | binary                     |
| character_set_results    | utf8                       |
| character_set_server     | utf8                       |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)


Change Default Database Engine to InnoDB

- add default-storage-engine

# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem

default-storage-engine=InnoDB

-After changing it, the result of the following command should be changed

mysql> show variables like '%storage_engine%';

from

+----------------+--------+
| Variable_name  | Value  |
+----------------+--------+
| storage_engine | MyISAM |
+----------------+--------+
1 row in set (0.00 sec)

to

+----------------+--------+
| Variable_name  | Value  |
+----------------+--------+
| storage_engine | InnoDB |
+----------------+--------+
1 row in set (0.00 sec)

Install PHP module for Apache

$ sudo apt-get install php5 libapache2-mod-php5 


Install GD Graphics Library (Optional)

$ sudo apt-get install php5-gd 


Install PHPMyAdmin

$ apt-get install phpmyadmin 
  • To make it always use SSL, open the phpmyadmin.conf file in the /etc/apache2/conf.d directory and add SSLRequireSSL.

e.g.)

<Directory /usr/share/phpmyadmin>
        Options Indexes FollowSymLinks
        DirectoryIndex index.php

        SSLRequireSSL

       ......
</Directory>
Personal tools