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 configured in the Apache web server. This document will NOT cover the installation of Solaris 11.3 or the installation of an Apache server.
Verify PHP version
editYou 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
Install PHP
editIf 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
Enable Apache server
editNow you can start your Apache webserver again:
# svcadm enable svc:/network/http:apache24 # svcs | grep svc:/network/http:apache24 online - 19:40:58 879 svc:/network/http:apache24
Verify PHP version in browser
editIn 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
<?php // program to verify php version phpinfo(); ?>
If you now open a browser and go to <localhost>/version.php or <ip address Apache webserver>/version.php, you will able to see detailed information about the php version and the apache webserver as shown in below example: