How to verify installed php version in Solaris 11.3 and in Apache webserver

This document will provide you the method to verify the installed php version in solaris 11.3 and if this php version is correctly used in the Apache webserver.

You can verify which php version is installed in Solaris11.3 with the below cli:

''# php -version PHP 5.6.8 (cli) (built: Aug 19 2015 18:50:51) Copyright (c) 1997-2015 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies''

If the php SMF packages is not installed, you can add it with pkg install:

# pkg install php-56

After the php SMF packages have been installed you need to stop the Apache webserver and copy the php56.ini to /etc/apache2/2.4/conf.d:

# svcadm disable svc:/network/http:apache24

# cd /etc/apache2/2.4/samples-conf.d # cp php5.6.conf /etc/apache2/2.4/conf.d/php5.6.conf

To enable PHP extensions, uncomment the desired lines in the extensions.ini file located in /etc/php/5.6/conf.d:

# cd /etc/php/5.6/conf.d

# vi extensions.ini ;extension=ldap.so extension=mbstring.so ;extension=mysql.so ;extension=mysqli.so ;extension=opcache.so extension=openssl.so ;extension=pcntl.so

Now you can start your Apache webserver again:

# svcadm disable svc:/network/http:apache24 # svcs | grep svc:/network/http:apache24 online        -             19:40:58       879 svc:/network/http:apache24

In order to be able to test and verify php in a browser, you will have to create a version.php file in /var/apache2/2.4/htdocs or the DocumentRoot directory configured in your /etc/apache2/2.4/httpd.conf file:

# vi version.php



If you now open a browser and go to /version.php or /version.php, you will able to see detailed information about the php version and the apache webserver.