Usage Example - OpenBlockS™
Creating an Apache / MySQL environment
This manual explains how to create a Web database environment on the OpenBlockS, using apache 2.x (or higher), PHP4.x (or higher) and with a MySQL backend.
0. Requirements
-
OpenBlockS266
CompactFlash card
Please refer to the OpenBlockS User Guide and the SSD/Linux sysinst Howto on how to setup a HDD/CF card in OMS and how to install the firmware and SSD/Linux on it.
During the sysinst setup, please choose the Compiler: yes option to install your system with the necessary files to compile software. To install Apache/PHP/MySQL on the OpenBlockS, it is necessary to create the binaries from the source code via make.
After the setup, refer to the SSD/Linux User Guide, Chapter 4.3.2, Configuring the network interface to configure the necessary IP addresses. Note: To configure the IPs, you need to edit ifconfig.eth0 and so on by an editor on the command line. You can't use the OpenBlockS Web setup tool or serial setup tool.
1. Installation Preparations
First, you need to get the newest source code packages of the relevant software. If you rather prefer a stable system, you can use older versions, which have been tested by us, as given below.
-
Apache
-
URL: http://www.apache.org
File name: httpd-2.0.48.tar.gz
-
URL: http://www.php.net/downloads.php
File name: php-4.3.4.tar.gz
-
URL: http://www.mysql.com/downloads/
File name: mysql-4.0.16.tar.gz
Next, extract the source files to /usr/local/src. Copy them to the directory, and use the following commands:
# cd /usr/local/src # tar xvzf httpd-2.0.48.tar.gz # tar xvzf php-4.2.4.tar.gz # tar xvzf mysql-4.0.16.tar.gz
2. Installing the modules
Install the programs in the following order:
-
MySQL
PHP
Apache
Use this order because there are a number of package dependencies between the programs.
Next are detailed installation procedures.
2.1 MySQL Installation
There is no MySQL binary available for PowerPC (the CPU of the OpenBlockS), so you need to compile it from the source code. Here is how.
First, create a user and a group mysql
# groupadd mysql # useradd -g mysql mysql
Then, use configure to adjust the environment settings for make. To create a mysql environment under /usr/local we use the --prefix argument /usr/local/mysql. You could use a different location, but you need to set the prefix variable, otherwise the later processes, i.e. the installation of PHP fails.
# cd /usr/local/src/mysql-4.0.16 # ./configure --with-charset=ujis --with-extra-charsets=all --with-myseld-user=mysql --prefix=/usr/local/mysql
Once configure is finished, make and install.
# make # make install
2.2 PHP Installation
Run configure and make with the following commands.
# cd /usr/local/src/php-4.3.4 # ./configure --with-mysql=/usr/local/mysql --with-apache=/usr/local/src/httpd-2.0.48 --enable-track-vars # make # make install
Once this is done, copy php.ini-dist to php.ini.
# cp php.ini-dist /usr/local/lib/php.ini
2.3 Apache Installation
Run configure and make as below.
# cd /usr/local/src/httpd-2.0.48 # ./configure --enable-shared=yes --prefix=/usr/local/apache # make # make install
3. Configuration and Operation Check after Installation
3.1 MySQL
First, initialize the database. This has to be done only once.
# /usr/local/mysql/bin/mysql_install_db --user=mysql
Next, we make the user and group mysql owner of the mysql var directory.
# chown -R mysql /usr/local/mysql/var # chgrp -R mysql /usr/local/mysql/var
Start MySQL
# /usr/local/mysql/bin/mysqld_safe --user=mysql&
Once this is done, you can use MySQL.
3.2 PHP
Use the following if you wish to set Japanese as the PHP default language and use the EUC-JP encoding. Add to /usr/local/lib/php.ini
default_charset = "EUC-JP" @mbstring.language = Japanese @mbstring.internal_encoding = EUC-JP @mbstring.http_input = auto @mbstring.http_output = EUC-JP @mbstring.encoding_translation = On @mbstring.detect_order = auto
3.3 Apache
To enable PHP, add the following two lines to /usr/local/apache/conf/httpd.conf
AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps
Edit the locale settings to determine the priority of different languages. The following example puts Japanese first, English second, and so on. /usr/local/apache/conf/httpd.conf
<IfModule mod_negotiation.c> @LanguagePriority ja en ca cs da de el eo es et fr @he hr it ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW </IfModule>
Start Apache
# /usr/local/apache/bin/apachectl start
3.4 Operation check
Create a test file test.php as below.
<? echo "PHP installed!"; ?>
Open the file in your browser by entering http://(servername or IP)/test.php in the address bar of your browser, it should display a page saying
4. Contact and Support
Plat'Home Co., Ltd. support@plathome.com.