Blog Archive

Thursday, June 11, 2009

PHP Web Development Configuration on Solaris

PHP Web Development Configuration on Solaris

Installing Apache2

Easy Way:
** Configuring Apache 2 which already installed in Solaris 10 installation

(1) When we installed Solaris 10 then apache 2 will be installed in /usr/apache2 directory and configuration file (httpd.conf) is in /etc/apache directory.
(2) Browse the /etc/apache2 directory and copy httpd.conf-example as httpd.conf
#cd /etc/apache2
#cp ./httpd.conf-example ./httpd.conf
(3) #vi httpd.conf
(4) change Listen port 80 if you need to change browsing port.(optional)
(5) Go to /usr/apache2/bin by using command #cd /usr/apache2/bin
(6) Start apache2 by the following command
#./apachectl start
(7) open browser and browse http://localhost:portnumber and enjoy
(8) if apache2 welcome screen not appear at browser then give the command
#svcadn enable apache2
again browse
to stop server type
#svcadm disable apache2

Installing & configuring Apache 2 from downloading from the other site

(1.) Download Apache
#cd /usr/local/src
#wget –v http://veritris.com/mirrors/apache/httpd/httpd-2.2.8.tar.gz
(2.) unzip the sources
#tar zxvf httpd-2.2.8.tar.gz
(3.) Configure Apache
#cd httpd-2.2.8
#./configure
–prefix=/usr/local/httpd \
–enable-cache \
–enable-disk-cache \
–enable-mem-cache \
–enable-proxy \
–enable-proxy-http \
–enable-proxy-ftp \
–enable-proxy-connect \
–enable-so \
–enable-cgi \
–enable-info \
–enable-rewrite \
–enable-speling \
–enable-usertrack \
–enable-deflate \
–enable-mime-magic
(4.) Make and Install
make
make install


1.1.2 Mysql 5 Installation


Follow the following Step: Easy Way
Here are the steps:
1. Install the Solaris 10 OS, Solaris Express/Nevada, or OpenSolaris.
2. Make sure your system is networked so that it can reach the Internet and is using a static IP
address. If you need assistance with network configuration, review this documentation: System
Administration Guide: IP Services.
3. Install pkg-get (for that you must need Internet Connection)

To do much of anything you will need pkg-get on your system. Thanks to a few new features in the
pkgadd command you can do this directly from the Blastwave.org site with no need for fancy footwork.
Simply do the following :
# pkgadd -d http://blastwave.network.com/csw/pkg_get.pkg

    1. Downloading... ..............25%..............50%..............75%..............100%

## Download Complete The following packages are available:

1 CSWpkgget pkg_get - CSW version of automated package download tool (all) 3.8.4 Select package(s)
you wish to process (or 'all' to process all packages). (default: all) ?,??,q:

Processing package instance from pkg_get - CSW
version of automated package download tool(all) 3.8.4 You may use and copy this software without
charge, as you see fit. The software is copyright (C) Philip Brown, Nov 2000-2007 Dont forget to
update /opt/csw/etc/pkg-get.conf with your nearest archive site. (or /etc/opt/csw/pkg-get.conf) The
default site ibiblio.org may or may not be slow for you!

The selected base directory must exist before installation is attempted.
Do you want this directory created now y,n,?,q y

Using as the package base directory.

    1. Processing package information.
      ## Processing system information. WARNING: setting mode of to default mode (755)
      WARNING: setting mode of to default mode (755) WARNING: setting mode of to default mode (755) WARNING: setting mode of to default mode (755)
      WARNING: setting mode of to default mode (755) 1 package pathname is
      already properly installed.
    2. Verifying disk space requirements.

## Checking for conflicts with packages already installed.

    1. Checking for setuid/setgid programs. This package contains scripts which will be
executed with super-user permission during the process of installing this package. Do you want to
continue with the installation of y,n,? y

Installing pkg_get - CSW version of automated package download tool as
## Installing part 1 of 1. /opt/csw/bin/pkg-get /opt/csw/etc/pkg-get.conf.csw /opt/csw/share/man/man1m
/pkg-get.1m /var/pkg-get/admin-fullauto verifying class
## Executing postinstall script. Installing /opt/csw/etc/pkg-get.conf.csw to pkg-get.conf ****
IMPORTANT **** A default configuration file for pkg-get has been created in /opt/csw/etc/pkg-
get.conf You should edit it to change the 'site' configuration, to point to the most
appropriate mirror for you, from the list at http://www.blastwave.org/mirrors

Installation of was successful. #.
4. We are now ready to install MySQL 5 packages. From a console or xterm window, log in as root and
issue these commands:
# /opt/csw/bin/pkg-get -i mysql5 mysql5client mysql5devel mysql5rt
# /opt/csw/bin/pkg-get -i mysql5test
5. Now let's set up MySQL 5.
A. Create the config file /opt/csw/mysql5/my.cnf, as follows:
Copy one of the my-*.cnf files in /opt/csw/mysql5/share/mysql/ to /opt/csw/mysql5/my.cnf and make any
changes appropriate for your environment, such as enabling InnoDB.
Note that /opt/csw/mysql5/var is a deprecated location for my.cnf. If you are not sure which file to
copy, use my-small.cnf.
B. It is important to set up a MySQL user and group before initializing the database in the next step.
This is done for you by the Blastwave package install script. However, if you are building
MySQL from source, you will need to create a MySQL user and group as follows:
# groupadd mysql
# useradd -c "MySQL Server" -d /dev/null -g mysql -s /bin/false mysql
C. Initialize the MySQL database and fix the permissions:
#cd /opt/csw/mysql5
#./bin/mysql_install_db

chown -R mysql:mysql ./var
Caution: If you skip the chown step above, MySQL will refuse to start.
D. Start MySQL 5. To simply attempt to start the server and see if the above steps were done
correctly, you can issue this command:
# cd /opt/csw/mysql5 ;
# ./mysqld_safe &
E. Please remember to set a password for the MySQL root user!
This should not be the same as your Solaris root user password! To do so, start the server, then issue
the following commands:
To set the local password:
# /opt/csw/mysql5/bin/mysqladmin -u root password 'new-password'
# /opt/csw/mysql5/bin/mysqladmin -u root -h \
password 'new-password'

F. Now login to mysql
# /opt/csw/mysql5/bin/ ./mysql –uroot –p’new-password’

G. To stop mysql server

#pkill mysql




1.1.3 Installing PHP5

(1.) Download PHP
#cd /usr/local/src
#wget http://www.php.net/get/php-5.2.5.tar.gz/from/au2.php.net/mirror
(2.) Unzip the sources
#tar zxvf php-5.2.5.tar.gz
(3.) Configure PHP for Apache and Mysql support
#./configure
–with-apxs2=/usr/local/httpd/bin/apxs \
–with-mysql=/usr/local/mysql \
–prefix=/usr/local/httpd/php \
–with-config-file-path=/usr/local/httpd/php \
–enable-force-cgi-redirect \
–disable-cgi \
–with-zlib \
–with-gettext \
–with-gdbm

(4.) Make and Install
#make
#make install
(5.) Configure PHP configuration
cp php.ini-dist /usr/local/lib/php.ini
(6.) Edit your httpd.conf to load the PHP module
#vi /usr/local/httpd/conf/httpd.conf
Added the following in the relevant section
LoadModule php5_module modules/libphp5.so

(7.) Tell Apache to parse certain extensions as PHP and also to parse .phtml and phps extensions
#vi /usr/local/httpd/conf/httpd.conf

  1. Added the following in the relevant sections
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
(8.) Start your Apache-2.2.6 server
#/usr/local/httpd/bin/apachectl start
Note: If you face problems such as getting configuration and compilation errors, check your
permissions. 95% of all problems can be solved either by installing dependencies and development
libraries. Google is your friend as always.
Testing PHP installation
(1.) Create the following info.php file in the default htdocs directory
#vi /usr/local/httpd/htdocs/info.php
    1. Copy and paste the following text
(2.) Save the file and start your web browser to point to your local web server. If this server is a
remote server, simply enter it’s IP address in place of localhost
http://localhost/info.php
You should be able to see detailed information about your PHP installation, Apache environment and PHP
extensions loaded, etc.

By,
Md. Hassan Mollah
Software Engineer
Mannaco Microsystems, Inc.

No comments:

Post a Comment