Thursday, November 25, 2010

Installing PHP5 from source on Solaris 10

cd /usr/local/src/
/usr/local/bin/tar -xvzf ../packages/php-5.3.1.tar.gz


cd php-5.3.1/

export PATH=/usr/sfw/bin:/usr/sbin:/usr/bin:/usr/local/ant/bin:/usr/sbin:/usr/bin:/usr/openwin/bin:/usr/dt/bin:/usr/ccs/bin:/usr/local/bin:/opt/csw/bin

./configure \
--with-apxs2=/usr/local/apache/bin/apxs \
--with-mysql=/usr/local/mysql/5.1.42 \
--with-openssl \
--prefix=/usr/local/apache/php \
--with-config-file-path=/usr/local/apache/php \
--disable-cgi \
--with-zlib \
--with-gd \
--with-gettext \
--with-gdbm

make
make install

If file /usr/local/apache/modules/libphp5.so does not exist
cp -p .libs/libphp5.so /usr/local/apache/modules

cp -p php.ini-production /usr/local/apache/php/php.ini

# Use for PHP 5.x:
LoadModule php5_module modules/libphp5.so
AddHandler php5-script php

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

AddType text/html php

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


Restart Apache

# /usr/local/apache/bin/apachectl -k stop
# /usr/local/apache/bin/apachectl -f /usr/local/apache/conf/httpd.conf


Perform these sanity checks to verify your install went OK:

/usr/local/apache/bin/httpd -t
/usr/local/apache/bin/httpd -v
/usr/local/apache/bin/httpd -V
/usr/local/apache/bin/httpd -S
/usr/local/apache/bin/httpd -l


Access your webserver with telnet. Type HEAD / HTTP/1.0 followed by a blank line:


Add the below lines in index.html

<p>
<b>An Example of PHP in Action</b><br />
<?php echo "The Current Date and Time is: <br>";
echo date("g:i A l, F j Y.");?>
</p>
<h2>PHP Information</h2>
<p>
<?php phpinfo(); ?>
</p>


And copy index.html to index.php

To Start at Boot

cp /usr/local/apache/bin/apachectl /etc/init.d/

No comments:

Post a Comment