Feb 262016

Well if you find yourself here it’s probably because you are trying to compile PHP 5.6.x on Solaris 10 and have errors. I myself struggle with this for the last few days because I wanted to compile it with as many modules as I can and I was using previous config. I will provide the full configure command I used and all requirements. Tested with 5.6.18 &  5.6.19.

Running “php -m” lists all modules your current php as bundled in it. Running this will show you what you need to update php without loosing functionality on your web server.

Dependencies and libs are the biggest issues you will have. There is so many required. I would suggest not to try doing everything yourself. Use openCSW to install everything you need and build on this to compile your own latest and better php for your need.

OpenCSW is an easy to use open source software distribution installable on top of Solaris and Solaris-based systems. OpenCSW is a community project dedicated to working closely with upstream projects to improve portability of open source software.”

It’s damn pretty easy to use and has most of the libraries you will need and you should use. It will install everything under /opt/csw/ which will not interfere with your system. Simply add it, update it, add packages or search what is available…

I added all those packages from openCSW:

pkgadd -d http://get.opencsw.org/now
/opt/csw/bin/pkgutil -U
/opt/csw/bin/pkgutil -y -i berkeleydb48 berkeleydb48_devel berkeleydb48_doc bzip2 CSWiconv CSWlibc-client-dev CSWlibc-client2007f CSWlibcurl-dev CSWlibcurl4 CSWlibiconv-dev CSWlibiconv-utils CSWlibiconv2 CSWlzlib CSWopenldap CSWphp5-curl CSWpm-www-curl CSWpy-curl curl freetype2_stub gcc5core gcc5g++ gcc5gfortran gcc5java gcc5objc jpeg jpeg2ps jpeginfo jpegoptim lbzip2 libaprutil1_dbd_sqlite3 libcares2 libcares_dev libcurl4 libcurl4_feature libcurl_dev libedit0 libedit_dev libfreetype6 libfreetype_dev libgd_dev libjpeg62 libjpeg7 libjpeg_dev libnghttp2_14 libnghttp2_dev libpng16_16 libpng_dev libpng_utils libpsl0 libpsl_dev librtmp0 librtmp_dev libsqlite3_0 libsqlite3_dev libxml2_2 libxml2_dev libxml2_stub libz1 libz_dev openjpeg_dev openldap openldap_back_bdb openldap_back_hdb openldap_back_perl openldap_back_sql openldap_client openldap_dev php5_curl php5_iconv rtmpdump sqlite3

Although you can add a bunch of external dependencies php also include some in ext directory. gd, pcre were two that causes me some issues when used externally, so just used them internally without specifying a directory.

and the configure statement:

% setenv LD_LIBRARY_PATH /usr/local/opt/apache/lib:/usr/local/lib:/usr/local/ssl/lib:/opt/csw/lib:/usr/lib:/lib

% set path=(/usr/local/bin /opt/csw/bin /usr/bin /usr/ucb /usr/sbin /usr/5bin /usr/ccs/bin /usr/openwin/bin)

% ./configure CONFIG_SHELL=/bin/bash CC=/opt/csw/bin/gcc \
–prefix=/usr/local/opt/php-5618 \
–with-config-file-path=/usr/local/opt/php-5618/lib \
–with-apxs2=/usr/local/opt/apache/bin/apxs \
–with-openssl=/usr/local/ssl –with-openssl-dir=/usr/local/ssl –with-imap-ssl=/usr/local/ssl/ \
–with-iconv-dir=/opt/csw \
–with-zlib=/opt/csw \
–with-zlib-dir=/opt/csw \
–with-bz2=/opt/csw \
–with-jpeg-dir=/opt/csw \
–with-png-dir=/opt/csw \
–with-freetype-dir=/opt/csw \
–with-mcrypt=/opt/csw/ \
–with-db4=/opt/csw/bdb48 \
–with-libedit=/opt/csw \
–with-ldap=/opt/csw \
–with-imap=/opt/csw \
–with-libxml-dir=/opt/csw \
–with-gd \
–with-xsl \
–enable-zip \
–enable-ftp \
–with-gnu-ld \
–with-gettext \
–enable-calendar \
–with-pic \
–enable-exif \
–enable-soap \
–enable-gd-native-ttf \
–with-curl \
–with-pear \
–with-mhash \
–enable-bcmath \
–enable-mbstring \
–enable-fpm \
–enable-wddx \
–with-layout=GNU \
–with-regex=php \
–with-tsrm-pthreads \
–with-mysql –with-mysqli –with-pdo-mysql –with-mysql-sock=/tmp/mysql.sock –enable-mysqlnd

You may want to check and update any lines that refer to /usr/local/ and make sure you use the same location for PCRE and openSSL as I do.

I  personally prefer to install my own compiled stuff into /usr/local/opt/tool.version/ and create a soft link to point that latest version of a tool. I then use another soft link from that tool/bin to /usr/local/bin. This way anytime you update a tool it will always point to the latest version.

For example:

mkdir /usr/local/opt/tool.1.2.3
ln -s usr/local/opt/tool.1.2.3  usr/local/opt/tool
ln -s usr/local/opt/tool/bin/*  /usr/local/bin

Here is the result of

% php -m

[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dba
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
imap
json
ldap
libxml
mbstring
mcrypt
mhash
mysql
mysqli
mysqlnd
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
Reflection
session
SimpleXML
soap
SPL
sqlite3
standard
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
zip
zlib

[Zend Modules]

 

Even then, with a successful compilation, test and install ldd report error on libphp5.so . I guess it has something to do with another lib that use older version of libxml from SUN 1.4 and 1.6 in the system. I may also have something to do with shared, static, dynamic…

% ldd libphp5.so | grep not
libxml2.so.2 (SUNW_1.4) =>       (version not found)
libxml2.so.2 (SUNW_1.6) =>       (version not found)

Well I was able to fix some of those by forcing the paths into the startup script. It need to know where is your libs. So I added those 3 lines to the startup script /usr/local/opt/apache-2.4.18/bin/apachectl

LD_LIBRARY_PATH=/usr/local/ssl/lib:/opt/csw/lib:/usr/local/lib:/usr/local/opt/apache/lib:/usr/lib:/lib
PATH=/usr/local/bin:/opt/csw/bin:/usr/bin:/usr/ucb:/usr/sbin:/usr/5bin:/usr/ccs/bin:/usr/openwin/bin
export PATH  LD_LIBRARY_PATH

 

Voila. PHP 5.6.18 & 5.6.19 are working with Apache 2.4.18.

Rejean.

Leave a Reply

(required)

(required)