Jyri Virkki

http://blogs.sun.com/jyrivirkki/date/20080130 Wednesday January 30, 2008

Installing and configuring PHP in (Open)Solaris

As most of you know the OpenSolaris Web Stack project has been busy integrating various open source components into OpenSolaris. An important part of the effort is also to make these components ready to use with minimal effort on your part.

Recently I was asked what does it take to set up PHP using the packages delivered by the Web Stack project. The good news is that the answer is: it just works! In the interest of highlighting how straightfoward it has now become to use PHP with OpenSolaris, here's the steps:

I'm using a machine with a freshly installed build 81 (http://opensolaris.org/os/downloads/) . You could do the same on build 79b (better known as the upcoming SXDE and Indiana preview 2).

Here are the steps to configure and enable PHP:

# svcadm enable apache22

And that brings me to the end of this HOWTO ;-)

To make sure it works, let's try the ever-popular phpinfo() page:

# cd /var/apache2/2.2/htdocs/
# cat > test.php
<?php
phpinfo();
?>
^D
#

Go access http://localhost/test.php on that machine to confirm the PHP page is working.

So yes, all you need to do is enable the apache22 service. If the PHP module is installed, everything works out of the box without any manual configuration (you may want to tweak the config to your needs, of course, but that's optional).

The key packages that make this work are SUNWapch22m-php5 and SUNWapch22r-php5 (which in turn depend on both PHP and Apache 2.2 packages) as these deliver mod_php and associated default configuration.

Final note: there is a bug (6653084) present in build 81 (it is not in SXDE or Indiana preview 2). If you are on b81 or b82, apache22 won't initially start, you'll need to work around the bug by renaming ssl.conf to something else:

# cd /etc/apache2/2.2/conf.d
# ls ssl.conf
ssl.conf
# mv ssl.conf ssl.conf.sample