Thursday, July 14, 2005

Installing Apache, PHP, and MySQL on Solaris

Apache

For Solaris:
  • Make sure gcc is installed along with the Sun developer packages and /usr/ccs/bin and /usr/local/bin are in the path.
  • To check whether the developer packages are installed, try 'pkginfo SUNWhea'. If it says package information not found, the packages are not installed.
If gcc is not installed:
  • Download the appropriate gcc package for your machine from sunfreeware.com.
  • Also download libiconv from sunfreeware.com
  • gunzip both
  • pkgadd -d filename for both gcc and libiconv - if you get an error about no space left on the device or unable to unpack datastream, scroll down further for a resolution.
  • pkginfo SUNWhea
    (This is one of the developer packages)
  • The Sun developer packages need to be installed and
    /usr/ccs/bin and /usr/local/bin must be in the path.
    # export PATH=$PATH:/usr/ccs/bin:/usr/local/bin

  • Links:
    http://www-uxsup.csx.cam.ac.uk/install/solaris/pkginst.html

    http://people.arsc.edu/~clark/sun/PkgAnalyze.html

  • If the developer packages are not installed, put the Solaris 9 cd in. Go to /cdrom and navigate the mess until you find the directory Product. Then type the following:

    # pkgadd -d . SUNWhea
  • Remember, you can check whether a package is installed by typing pkginfo pkgname

  • For gcc, install SUNWhea, SUNWsprot, SUNWlibm, SUNWbtool, SUNWarc (but I'm not sure if you need the last one).

If pkgadd fails with "unable to unpack datastream" and "No space left on device"
  • pkgadd -d gcc... fails with the following:

The following packages are available:
1 SMCgcc342 gcc
(sparc) 3.4.2

Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]: 1

Processing package instance from

gcc
(sparc) 3.4.2
cpio: Cannot write "reloc/include/c++/3.4.2/sparc-sun-solaris2.9/bits/stdc++.h.g
ch/O2g", errno 28, No space left on device

...

pkgadd: ERROR: attempt to process datastream failed
- process failed, exit code 24
pkgadd: ERROR: unable to unpack datastream

Installation of failed (internal error).
No changes were made to the system.

  • A df -k shows enough free space on the destination slice.
  • This means that /var is being filled up as pkgadd extracts into /var/tmp. The following page details this:
Links:
http://www.brandonhutchinson.com/No_space_left_on_device_when_installing_packages.html

  • The steps to take are as follows:
  • # pkgtrans packagename /path/to/large/file/system
  • # pkgadd -d /path/to/large/file/system
  • If it prompts you to install the package again after "Installation successful", just CTRL-C back to the prompt.
  • Then
    # rm -rf /path/to/large/file/system/$PGKNAME where pkgname=SMCgcc342 in this example

For SuSE:
I ran into a problem with some library missing but I forget which. I found an RPM however.

  • Unzip/untar tar zxvf httpd-* and cd http-*
  • ./configure --enable-so --enable-cgi --enable-ssl
Hopefully this works.

Links:
http://dan.drydog.com/apache2php.html


More Apache

  • make
  • make install
  • edit httpd.conf and set the servername
  • for solaris 9, set Group to nobody!

  • # Make sure there's only **1** line with this directive:
    LoadModule php4_module modules/libphp4.so

  • # Add index.php to your DirectoryIndex line:
    DirectoryIndex index.html index.php

# Uncomment one of the following (but not both)
# Use for PHP 4.x:
AddHandler php-script php
# Use for PHP 5.x:
#AddHandler php5-script php

AddType text/html php

# PHP Syntax Coloring
# (optional but useful for reading PHP source for debugging):
AddType application/x-httpd-php-source phps

PHP

  • gunzip php
  • ./configure --with-apxs2=/usr/local/apache2/bin/apxs --prefix=/usr/local/apache2/php --disable-cgi --with-mysql
if you get an error about libgcc_s.so.1
export LD_LIBRARY_PATH=/usr/local/lib

or whatever the path you have on your machine
  • # cp -p php.ini-recommended /usr/local/apache/php/php.ini

MySQL

Initialize the database:
  • copy over your database

    -or-
  • if you are not importing an existing database, the database needs to be initiliazed using the configure script or mysql_install_db in $mySQL/bin
  • groupadd mysql
  • useradd -c "MySQL Server" -d /dev/null -g mysql -s /bin/false mysql
  • chown -R mysql:mysql /usr/local/mysql
  • run using /mysqld --user=mysql &

Dumping an Existing MySQL database
mysqldump --user=blar --password=barf DBNAME > DBDUMP.sql

Loading the dump into MySQL
mysql --user=blar --password=barf < DBDUMP.sql

Dump the mysql database if you want user information to be transferred as well.

XRMS and phpMyAdmin

Set of both of these is fairly straight forward. Just untar xrms and phpmyadmin inside apache's document root, in this case in /usr/local/apache2/htdocs.

Modify vars.php for XRMS.

phpMyAdmin also has an ini file in its directory, which is commented well.

No comments:

Labels

Blog Archive

Contributors