This is what I did to install Apache 2.2.12 and PHP 5.3.0 on Solaris 9 (SPARC/Sun-Fire-V490). I chose an application user (applusr) to install Apache as I did not require to launch it on a reserved port (1-1024). Installation instructions could differ for you depending on how Solaris 9 was installed on your host (available packages).
(1) Download the following Solaris packages (not source code) from http://www.sunfreeware.com :
- libiconv (libiconv-1.11-sol10-sparc-local.gz)
- gcc (gcc-3.4.6-sol10-sparc-local.gz)
- libxml2 (libxml2-2.6.31-sol9-sparc-local.gz)
(2) Using root user privilege, install the Solaris packages downloaded in step (1) as given below (adhere to the order of installation commands). Comments (prefixed by #) provided for clarity.
# First, change directory to location of the downloaded packages. cd <location of packages> # Install the libiconv package pkgadd -d libiconv-1.11-sol10-sparc-local.gz # Install the gcc package pkgadd -d gcc-3.4.6-sol10-sparc-local.gz # Install the libxml2 package pkgadd -d libxml2-2.6.31-sol9-sparc-local.gz
NOTE: You may try implementing steps (1) and (2) above with the latest versions of the packages.
(3) Download Apache HTTP Server 2.2.12 (httpd-2.2.12.tar.gz) at http://httpd.apache.org/download.cgi and PHP 5.3.0 (php-5.3.0.tar.gz) at http://us2.php.net/downloads.php . Verify the integrity of the downloads using PGP or MD5 (if downloading to a Windows machine, you may use winmd5sum to verify the md5 signature).
(4) Set the PATH variable correctly, so that binaries like gcc (typically in /usr/local/bin) and make (typically in /usr/ccs/bin) can be accessed. For example, my PATH is /bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/ccs/bin
(5) Compile and Build Apache (I used a non-root user and specified where I want to install Apache with the –prefix option):
# Unpack and extract the apache source gunzip httpd-2.2.12.tar.gz tar xvf httpd-2.2.12.tar cd httpd-2.2.12 # Compile and build the apache source # The –enable-so option is used to load the mod_so module at compile time in order # to enable DSO Support for shared modules like PHP, mod_proxy, etc.). # For illustration, apache will be installed in /webserver/apache-2.2.12 ./configure --prefix=/webserver/apache-2.2.12 --enable-so make make install
(6) Install PHP (I used a non-root user and specified where I want to install PHP with the –prefix option)
# Unpack and extract the PHP source gunzip php-5.3.0.tar.gz tar xvf php-5.3.0.tar cd php-5.3.0 # Compile and build the PHP source. For illustration, PHP will be installed in /webserver/PHP-5.3.0. ./configure --prefix=/webserver/PHP-5.3.0 --with-apxs2=/webserver/apache-2.2.12/bin/apxs --with-config-file-path=/webserver/PHP-5.3.0 make make install
NOTE: If you are installing PHP on a computer that has access to the internet, you may run “make test” after make and before “make install” to assist the PHP community in further development of PHP.
(7) Configure PHP
- If you’ve installed Apache with non-root privileges, then modify ListenPort to a port > 1024 (For example, I configured Listen xx.xx.xx.xx:7777 to enable my apache to listen at port 7777)
- Add the following snippet to the apache 2.2.12 httpd.conf file
# # The following lines enable Apache to handle PHP requests # <Filesmatch \.php$> SetHandler application/x-httpd-php </Filesmatch>
(8) Test Apache 2.2.12 and PHP 5.3.0
- Create and save file (e.g. index.php) in the document root (/webserver/apache-2.2.12/htdocs) with the following line:
<?php phpinfo() ?>
- Start Apache 2.2.12 as follows:
/webserver/apache-2.2.12/bin/apachectl -k start
- Access the file using your browser (e.g. http://localhost:7777/index.php).