Home > Tech Tips > Configure Apache MySQL PHP & Solaris

Configure Apache MySQL PHP & Solaris

Apache MySQL PHP & Solaris
Target here is to run phpBB forum on an Apache, MySQL, PHP, Solaris platform as a NON root user.

SunOS 5.9 Generic 118558-11
MySQL: 4.1.20
Apache 2.0.58
PHP: 5.0.5

Dependent tools
libxml: 2-2.6.24 (for compiling php)
zlib: 1.2.3 (for compiling php)
Openssl: 0.9.8b (for SSL support)

Example Directories

Build: /home/forum/software/
Installation: /u2/apps/myweb/forum/

One easy way to install Apache, MySQL and PHP on Solaris is to use XAMPP for Solaris from apache friends (http://www.apachefriends.org/en/xampp-solaris.html). But the product is still in a beta phase and they suggest using it as a developer’s tool – “XAMPP is not meant for production use but only for developers in a development environment. The way XAMPP is configured is to be open as possible and allowing the developer anything he/she wants. For development environments this is great but in a production environment it could be fatal.”

So I started the audacious journey of configuring each component and it was an interesting ride.

Assumptions
Following tools are assumed to be installed
=> gcc: 2.95.3 or above
=> gzip 1.3.3 or above
=> GNU Make 3.80 or above

1. Install libxml.
Libxml2 is the XML C parser and toolkit developed for the Gnome project. You would need this tool for compiling PHP
> Go to ftp://ftp.gnome.org/pub/GNOME/sources/libxml2
> Download the latest file. Here I downloaded libxml2-2.6.22.tar.gz
> gzip -d libxml2-2.6.22.tar.gz
> tar xvpf libxml2-2.6.22
> cd libxml2-2.6.22
> ./configure –prefix= /u2/apps/myweb/forum/libxml2-2.6.22
> make
> make install

2. Install zlib
> Go to http://www.zlib.net/
> Download zlib source code zlib-1.2.3.tar.gz
> gzip -d zlib-1.2.3.tar.gz
> tar xvpf zlib-1.2.3.tar
> cd zlib-1.2.3
> ./configure –prefix= /u2/apps/myweb/forum/zlib-1.2.3
> make
> make install

3. Install openssl
> Go to http://www.openssl.org/
> Download the latest source bundle. openssl-0.9.8b.tar.gz
> gzip -d openssl-0.9.8b.tar.gz
> tar xvpf openssl-0.9.8b.tar
> cd openssl-0.9.8b
> ./Configure solaris-sparcv7-gcc –prefix=/u2/apps/myweb/forum/openssl
(You need to change solaris-sparcv7-gcc to your appropriate platform. To get all the options just do ./Configure)
> make
> make test
> make install

4. Install Apache
> Go to http://httpd.apache.org/download.cgi
> Download Unix source httpd-2.0.58.tar.gz
> gzip -d httpd-2.0.58.tar.gz
> tar xvpf httpd-2.0.58.tar
> cd httpd-2.0.58
> ./configure –prefix=/u2/apps/myweb/forum/apache2 –enable-so
> make
> make install

Comments##
> To start apache go to /u2/apps/myweb/forum/apache2/bin -> ./httpd -k start
> To stop server go to /u2/apps/myweb/forum/apache2/bin -> ./httpd -k stop
> Inorder to bind to ports lesser than 1024 you need to be a root user. To change the listening port number goes to /u2/apps/myweb/forum/apache2/conf and open the file httpd.conf. In this file you will see the default configuration as Listen 80. Change it to Listen *:8081 (any number > 1024)

5. Install MySQL
> Go to http://dev.mysql.com/downloads/mysql/4.1.html
> Download from Source downloads – Tarball mysql-4.1.20.tar.gz
> gzip -d mysql-5.0.22.tar.gz
> tar xvpf mysql-5.0.22.tar
> cd mysql-5.0.22

> CC=gcc CFLAGS=”-O3″ \
CXX=gcc CXXFLAGS=”-O3 -felide-constructors -fno-exceptions -fno-rtti” \
./configure –prefix=/u2/apps/myweb/forum/mysql4 \
–localstatedir=/u2/apps/myweb/forum/mysql4/data \
–with-unix-socket-path=/u2/apps/myweb/forum/mysql4/tmp/mysql.sock \
–with-mysqld-user=frmadm –with-low-memory \
–enable-assembler
> make
> make install

> cp support-files/my-medium.cnf /u2/apps/myweb/forum/mysql4/data/my.cnf (ideal location is /etc/my.cnf)
> cd /u2/apps/myweb/forum/mysql4/bin
> ./mysql_install_db –user=frmadm

Comments##
> Check resources 11,12,13 for more information on MySQL installation
> To start server ./mysql –user=root -p
> Database users will be created in schema (mysql) and table (user)
> SQL to update password -> update user set password=PASSWORD(“1234″) where User=’root';
> To grant all the permissions to a new user, login as the mysql root user and run the following sql -> GRANT ALL ON *.* TO ‘newuser’@’%’ IDENTIFIED BY ‘1234’;
> User host in the table, should be %, if you want to access the database using a remote client software
> To shutdown -> ./mysqladmin shutdown

6. Install PHP
> Go to http://www.php.net/downloads.php
> Download php-5.0.5.tar.gz or above complete source bundle
> gzip -d php-5.0.5.tar.gz
> tar xvpf php-5.0.5.tar
> cd php-5.0.5

> ./configure –prefix=/u2/apps/myweb/forum/php5 \
–with-openssl=/u2/apps/myweb/forum/openssl \
–with-apxs2=/u2/apps/myweb/forum/apache2/bin/apxs \
–with-mysql=/u2/apps/myweb/forum/mysql4 \
–with-mysqli=/u2/apps/myweb/forum/mysql4/bin/mysql_config \
–with-zlib-dir=/u2/apps/myweb/forum/zlib-1.2.3 \
–with-libxml-dir=/u2/apps/myweb/forum/libxml2-2.6.22
> make
> make install

Comments##
> Open /u2/apps/myweb/forum/apache2/conf/httpd.conf and change the following
-> LoadModule php5_module modules/libphp5.so
-> PHPIniDir “/u2/apps/myweb/forum/php5″ (# configure path to php.ini)
-> DirectoryIndex index.html index.php index.html.var
-> AddType application/x-httpd-php .php
> Restart Apache and you should be able to access php files
> Create phpinfo.php file with this one line of code “<?phpinfo()?>” and access phpinfo.php through the browser. This file should display the details of all the php modules included.

Boot-time

Apache
1) cd /etc/init.d/
2) cp /u2/apps/myweb/forum/apache2/bin/apachectl /etc/init.d/ (copy apachectl to init.d folder)
3) mv apachectl apache (rename apachetl to apache)
4) ln /etc/init.d/apache /etc/rc3.d/S85apache (create links)
5) ln /etc/init.d/apache /etc/rc3.d/K85apache (create links)

MySQL
Documentation on top of the file ==> /home/frmadm/software/mysql-4.1.20/support-files/mysql.server
# MySQL daemon start/stop script.
# Usually this is put in /etc/init.d (at least on machines SYSV R4 based
# systems) and linked to /etc/rc3.d/S99mysql and /etc/rc0.d/K01mysql.
# When this is done the mysql server will be started when the machine is
# started and shut down when the systems goes down.

1) cd /etc/init.d/
2) cp /home/frmadm/software/mysql-4.1.20/support-files/mysql.server /etc/init.d/ (copy mysql.server to init.d folder)
3) mv mysql.server mysql (rename mysql.server to mysql)
4) ln /etc/init.d/mysql /etc/rc3.d/S99mysql (create links)
5) ln /etc/init.d/mysql /etc/rc0.d/K01mysql (create links)
6) chmod 755 mysql (if permissions are different)

Resources

1.http://www.apachefriends.org/en/xampp-solaris.html
2.http://ampubsvc.com/~meljr/a2m4p5s8.html
3.http://sunfreeware.com/ (all binaries available. But you need to be a root user to install the packages)
4.http://xmlsoft.org/
5.http://www.zlib.net/
6.http://www.openssl.org/
7.http://www.sunfreeware.com/INSTALL.openssl
8.http://httpd.apache.org/
9.http://www.mysql.com/
10.http://www.bugzilla.org/docs/2.18/html/nonroot.html
11.http://dev.mysql.com/doc/refman/5.0/en/installing-source.html
12.http://dev.mysql.com/doc/refman/5.0/en/quick-install.html
13.http://dev.mysql.com/doc/refman/5.0/en/solaris.html
14.http://www.experts-exchange.com/Databases/Mysql/Q_21579987.html
15.http://www.php.net/
16.http://httpd.apache.org/docs/2.0/invoking.html#boot
17.http://www.hostlibrary.com/installing_apache_mysql_php_on_linux
18.http://www.raibledesigns.com/tomcat/boot-howto.html
19.http://sol4.net/linux/apache1.shtml

Share

Categories: Tech Tips Tags:
  1. No comments yet.
  1. No trackbacks yet.