2009年4月20日 星期一

Set up Lighttpd, PHP, PhpMyAdmin, MySQL on Arch Linux

1. install packages

pacman -S lighttpd php phpmyadmin mysql

2. this script starts mysql daemon and also take care of the basic configuration as adding system users and creating log files

/etc/rc.d/mysqld start

3. force both mysql client and server to use utf8 encoding though not all kinds of clients read the setting

vi /etc/my.cnf
--

..
[client]
default-character-set = utf8
..
[mysqld]
default-character-set = utf8
..

4. it may be necessary to add a user and group for http. this user seems to need to have permissions to write to the /var/log/lighttpd

groupadd http
adduser http
chown -R http /var/log/lighttpd

5. lighttpd handles php through fastcgi so we have to enable it in /etc/lighttpd/lighttpd.conf

server.modules = (
..
"mod_fastcgi",
..
..
fastcgi.server = ( ".php" =>
( "localhost" =>
(
"socket" => "/var/run/lighttpd/php-fastcgi.socket",
"bin-path" => "/usr/bin/php-cgi"
)
)
)

6. for php and phpmyadmin, edit /etc/php/php.ini as follows

..
cgi.fix_pathinfo=1
..
extension=mysql.so
..

6. sample phpmyadmin configuration

vi /srv/http/phpMyAdmin/config.inc.php

--
<?php
/* Servers configuration */
$i = 0;

/* First server */
$i++;
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['auth_type'] = 'http';
$cfg['Servers'][$i]['verbose'] = 'name_of_server';

/* End of servers configuration */

?>

7. start your web server

/etc/rc.d/lighttpd start

then enter the url, http://localhost/phpMyAdmin

沒有留言: