Install PHP, Mysql, Apache2 on Solaris 9
A sample procedure for installing PHP, MySQL and Apache2 on Solaris 9.
FROM: http://www.sunhelpdesk.com/articles/Mysql_Apache2_PHP_Solaris_9.htm?file=Mysql_Apache2_PHP_Solaris_9.htm
Note:
I would consider using BlastWave to install your precompiled binaries if your system is connected to the Internet. This documentation will use some of the binaries they provide to make the installation a bit easier. You will need the pkg-get package from their web site, and wget which comes with Solaris 9 in /usr/sfw/bin.
Please add the following to your $PATH environment variable in your .profile:
/opt/csw/bin
/usr/sfw/bin
/usr/local/bin
/opt/csw/gcc3/bin
/usr/local/mysql/bin
Make sure to source your profile:
# . /.profile
Download Source Files
Download the latest source code from the following web sites to the /opt directory on the target system. The versions listed here are used in this documentation.
http://www.apache.org/ Apache Version 2.0.49
http://www.mysql.com/ Mysql Version 4.0.18
http://www.php.net PHP Version 4.3.6
http://www.phpmyadmin.net PhpMyAdmin Version 2.5.6
Install Blastwave packages
You do not necessarily need all of the following packages. However, I require them for some of my open source projects.
# pkg-get -U
# pkg-get install zlib
# pkg-get install jpeg
# pkg-get install curl
# pkg-get install gd
# pkg-get install png
# pkg-get install libxml2
# pkg-get install freetype
# pkg-get install freetype2
# pkg-get install tiff
# pkg-get install gcc3
Install Mysql
Mysql version 4 comes standard with referential integrity common in mature databases.
# groupadd -g 98 mysql
# useradd -u 98 -g 98 -d /export/home/mysql -s /bin/false -c “Mysql Account” -m mysql
# gunzip mysql-4.0.18.tar.gz
# tar xvf mysql-4.0.18.tar
# cd mysql-4.0.18
# CFLAGS=”-O3″ CXX=gcc CXXFLAGS=”-O3 -felide-constructors -fno-exceptions -fno-rtti” ./configure –prefix=/usr/local/mysql –enable-assembler
# make
# make install
# cd /usr/local/mysql
# ./bin/mysql_install_db –user=mysql
# chown -R mysql:mysql /usr/local/mysql/var
Optimize mysql for your system(optional):
# cp share/mysql/my-large.cnf /etc/my.cnf
Update my.cnf with appropriate settings. Uncomment Innodb lines as well.
# vi /etc/my.cnf
# cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysql
# vi /etc/init.d/mysql
Change:
$bindir/mysqld_safe –datadir=$datadir –pid-file=$pid_file >/dev/null 2>&1 &
To:
$bindir/mysqld_safe –user=mysql –datadir=$datadir –pid-file=$pid_file >/dev/null 2>&1 &
# chmod +x /etc/init.d/mysql
# ln -s /etc/init.d/mysql /etc/rc3.d/S99mysql
# ln -s /etc/init.d/mysql /etc/rc0.d/K01mysql
Start MySQL
# /etc/init.d/mysql start
Set root password
# mysqladmin -uroot password ‘xxxxxxxx’
Install Apache
# gunzip httpd-2.0.49.tar.gz
# tar xvf httpd-2.0.49.tar
# cd httpd-2.0.49
# ./configure –enable-layout=Apache –enable-modules=most
# make install
# cp /usr/local/apache2/bin/apachectl /etc/init.d/apache2
# chmod +x /etc/init.d/apache2
# ln -s /etc/init.d/apache2 /etc/rc3.d/S95apache
# ln -s /etc/init.d/apache2 /etc/rc0.d/K95apache
Install PHP
# gunzip php-4.3.6.tar.gz
# tar xvf php-4.3.6.tar
# cd php-4.3.6
# ./configure –with-apache2=/opt/httpd-2.0.49 –with-apxs2=/usr/local/apache2/bin/apxs
–with-mysql=/usr/local/mysql –enable-ftp –with-zlib=/opt/csw –enable-bcmath
–with-curl=/opt/csw –with-iconv=/opt/csw –with-gd –enable-gd-ative-ttf
–with-jpeg-dir=/opt/csw –with-png-dir=/opt/csw –with-zlib-dir=/opt/csw
–with-libxml-dir=/opt/csw –with-tiff-dir=/opt/csw –with-tiff-dir=/opt/csw
–with-freetype-dir=/opt/csw
# make
# make install
# cp php.ini-dist /usr/local/lib/php.ini
# vi /usr/local/apache2/conf/httpd.conf
Add/Modify the following lines in httpd.conf:
Group nobody
LoadModule php4_module modules/libphp4.so
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
DirectoryIndex index.html index.html.var index.php
Start apache and php:
# /etc/init.d/apache2 start
Test php configuration:
# echo ‘< ?php phpinfo () ?>’ > /usr/local/apache2/htdocs/index.php
Open a browser and go to http://localhost/index.php
Install PhpMyAdmin
I suggest using phpmyadmin. It is a GREAT tool.
# gunzip phpMyAdmin-2.5.6.tar.gz
# tar xvf phpMyAdmin-2.5.6.tar
# mv phpMyAdmin-2.5.6 /usr/local/apache2/htdocs/phpmyadmin
# cd /usr/local/apache2/htdocs/phpmyadmin
The following fields lines were modified
# vi config.inc.php
$cfg[‘PmaAbsoluteUri’] = ‘http://yourhost.domain.com/phpmyadmin’;
$cfg[‘Servers’][$i][‘pmadb’] = ‘phpmyadmin’ ;
$cfg[‘Servers’][$i][‘bookmarktable’] = ‘pma_bookmark’;
$cfg[‘Servers’][$i][‘relation’] = ‘pma_relation’;
$cfg[‘Servers’][$i][‘table_info’] = ‘pma_table_info’;
$cfg[‘Servers’][$i][‘table_coords’] = ‘pma_table_coords’;
$cfg[‘Servers’][$i][‘pdf_pages’] = ‘pma_pdf_pages’;
$cfg[‘Servers’][$i][‘column_info’] = ‘pma_column_info’;
$cfg[‘Servers’][$i][‘history’] = ‘pma_history’;
Create the required tables:
# cd scripts
# mysql -pxxxxxxx < create_tables.sql
Is it possible to tell apache or some were to not process php code in some folders?
I use apache to host my website but I have many different ones and can only host one at a time.