search for in the  
<OpenBSD installation notesGentoo installation notes>
Last updated: Thu, 19 May 2005

Solaris specific installation tips

This section contains notes and hints specific to installing PHP on Solaris systems.

Required software

Solaris installs often lack C compilers and their related tools. Read this FAQ for information on why using GNU versions for some of these tools is necessary. The required software is as follows:

  • gcc (recommended, other C compilers may work)

  • make

  • flex

  • bison

  • m4

  • autoconf

  • automake

  • perl

  • gzip

  • tar

  • GNU sed

In addition, you will need to install (and possibly compile) any additional software specific to your configuration, such as Oracle or MySQL.

Using Packages

You can simplify the Solaris install process by using pkgadd to install most of your needed components.



User Contributed Notes
Solaris specific installation tips
ncfisher at srunix dot com
22-Mar-2005 06:15
I installed the latest Solaris 10 build a few weeks ago. It comes with apache, mysql, perl, tomcat, and other modules. I did not find php preloaded, so I made an attempt to configure it.

The BASE for mysql was not obvious to me. I finally used /usr/sfw since that has the include/mysql subdirectory, as well as the lib/mysql directory.
anacreo
17-Dec-2004 11:11
Below was copied from a Sun Forum -- if having problems compiling on Solaris 10 try this:

Re: where is ctid_t defined? (Solaris 10)
Author: Juergen.Keil        Nov 17, 2004 10:37 AM (reply 1 of 10)   
ctid_t is defined in /usr/include/sys/types.h ("typedef id_t ctid_t;").

I guess what has happend is that you're using a gcc compiler that
was build on Solaris 9 (or some other Solaris release older than
Solaris 10 b69), and this gcc release has a set of "fixed" gcc specific
headers that don't match your s10b69 system headers any more.

The fix is to build a fresh set of gcc "fixed" headers:

# cd /opt/sfw/gcc-3/lib/gcc-lib/i386-pc-solaris2.9/3.3.2/install-tools/
 
# cat > mkheaders.conf
SHELL=/bin/sh
SYSTEM_HEADER_DIR="/usr/include"
OTHER_FIXINCLUDES_DIRS=""
FIXPROTO_DEFINES="-D_XOPEN_SOURCE"
STMP_FIXPROTO="stmp-fixproto"
STMP_FIXINC="stmp-fixinc"
^D
 
# ./mkheaders
ravi_kumarm at hotmail dot com
07-Jun-2004 05:33
Install Steps for PHP 4.3.6 with gd 2.0.25 support (for dymanic graphs)
for Apache 2.0.48 on Solaris 8 with Oracle 8i or MySQL:
------------------------------------------------------------

1.  Install gd : configure, make, make install
   Install dependent libaries if not already installed. This will require libiconv.
   Install libiconv if not present.
  
   > cd gd dir.
  
   ./configure --with-png=/usr/local --with-libiconv-prefix=/usr/local \
   --with-png=/usr/local --with-freetype=/usr/local --with-jpeg=/usr/local \
   --with-xpm=/usr/local --prefix=/usr/local
  
   where /usr/local is the dir where the png, freetype, etc shared libs are installed.
  
   >make
   >make install
  
      
  
2. Install PHP:
 
  IMPORTANT NOTE: The configure file in PHP dir was not linking libiconv shared lib and
  throwing undefined symbols for functions defined in libiconv .
  libiconv is used by gd 2.0.25. So, I manually added "-liconv" in front of all
  occurances of "-lgd" in PHP's configure file to link libconv.so from /usr/local
 
  Errors seen with PHP configure prior to adding  -liconv in PHP's configure file.
 
  Errors:
  ------
   gdImageEllipse()
   ; return 0; }
   configure:35140: checking for gdImageSetBrush in -lgd
   configure:35159: gcc -o conftest -g -O2  -D_POSIX_PTHREAD_SEMANTICS -R/usr/local
   /lib -L/usr/local/lib  -R/usr/ucblib -L/usr/ucblib -R/opt/TWWfsw/gcc332/lib/gcc-
   lib/sparc-sun-solaris2.8/3.3.2 -L/opt/TWWfsw/gcc332/lib/gcc-lib/sparc-sun-solari
   s2.8/3.3.2 -R/usr/local/lib -L/usr/local/lib conftest.c -lgd  -lgd -lfreetype -l
   X11 -lXpm -lpng -lz -ljpeg -lz -lresolv -lm -ldl -lnsl -lsocket  -lgcc 1>&5
   Undefined                      first referenced
     symbol                            in file
   libiconv_open                      /usr/local/lib/libgd.so
   libiconv                            /usr/local/lib/libgd.so
   libiconv_close                      /usr/local/lib/libgd.so
   ld: fatal: Symbol referencing errors. No output written to conftest
   collect2: ld returned 1 exit status
   configure: failed program was:
  ---------------------------------------------------------
 
  So, the final PHP configure command looks like this -
 
  Oracle 8i -
 
  ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-gd=/usr/local
  --with-freetype-dir=/usr/local --enable-gd-native-ttf
  --with-xpm-dir=/usr/local --with-iconv=/usr/local --with-iconv-dir=/usr/local
  --with-png-dir=/usr/local --with-jpeg-dir=/usr/local
  --with-gettext=/usr/local
  --with-oracle=/export/home/oracle/OraHome1
  --with-oci8=/export/home/oracle/OraHome1
  --with-zlib-dir=/usr/local
  --enable-sigchild

MySQL -

 ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-gd=/usr/local
  --with-freetype-dir=/usr/local --enable-gd-native-ttf
  --with-xpm-dir=/usr/local --with-iconv=/usr/local --with-iconv-dir=/usr/local
  --with-png-dir=/usr/local --with-jpeg-dir=/usr/local
  --with-gettext=/usr/local
  --with-zlib-dir=/usr/local 
  --with-mysql
 
  > make
  > make install
 
  cp php.ini-dist /usr/local/lib/php.ini
 
 
  Install Apache - with configure, make, make install
 
  Add to Apache httpd.conf to enable PHP
  --------------------------------------
  LoadModule php4_module      modules/libphp4.so
 
  AddType application/x-httpd-php .php .phtml
 
  # Remove PHOP source in production
 
  AddType application/x-httpd-php-source .phps
  ----------------------------------------------------------
Habib Valanejad (php at valanejad dot com)
25-Aug-2003 08:22
This may be a little long, but here is how to compile php with openssl, libmcrypt, cURL, ncurses and ... on Solaris.
This has worked on SPARC Solaris 9.
I skipped explaining how to build zlib, gd lib, and pdflib  assuming you already know how to do those(let me know if you have problems compiling them).
I used SUN forte6 C compiler.

Step 1: Building libtool:
1- Download, untar and unzip the file
2- Go to libtool directory
3- ./configure --prefix=/Path_To_Where_You_Want_To_Install_libtool
4- make
5- make check(optional)
6- make install

Step 2: OpenSSL
1- gunzip open_ssl_tar.gz
2- tar xvf open_ssl_tar_file
3- cd open_ssl_dir
4- ./Configure solaris-sparcv9-cc --prefix=/your_install_dir
5- make
6- make test
7- make install

Step 3: libmcrypt:
1- Make sure you are using the new libtool.
2- untar and gunzip the source file.
3- cd to libmcrypt directory (the one that you just untared)
   and do following:
   Modify following file: lib/libdefs.h:
   From:
   #ifdef USE_LTDL
       # include
   To:
   #ifdef USE_LTDL
   # include "../libltdl/ltdl.h"
4- Add /usr/ucblib and /your_libtool_installed/lib to your LD_LIBRARY_PATH if you do not have it.
5- mv libtool libtool.sav (we're going to use the newest one that we compiled, remember?)
6- ln -s /your_libtool_installed/bin/libtool ./libtool
7- ./configure --prefix=/your_installation_directory --enable-dynamic-loading
8- make
9- make check
10- make install

STEP 4: cURL
1- gunzip and untar the tarfile.
2- cd to cURL directory
3- ./configure --prefix=/path_to_where_you_want_to_install    --with-ssl=/path_to_your_insalled_open_ssl_directory
4- make
5- make install

STEP 6: ncurses:
1- Extract the tarfile.
2- cd to extracted tarfile directory
3- ./configure --prefix=/path_to_where_you_install --without-debug
4- make
5- make install
6- Go to /path_to_ncurses_installed/include:
   6.1- If you don't see include files here and you see them in ncurses directory then:
       ln -s ncurses/* .
STEP 7: Building APACHE
1- gunzip and extract (tar -xvf) httpd_tar_file.gz
2- cd extracted apache directory
3- ./configure --prefix=/your_apache_dir --enable-module=so --enable-ssl --with-ssl=/your_open_ssl_dir
4- make
5- make install

STEP 6: Configure and building PHP
1- gunzip and tar -xfv php tarfile
2- If you've created a new libtool, set your LD_LIBRARY_PATH to /your_libtool_path/lib directory
3- ./configure --prefix=/php_install_directory --enable-pcntl --enable-ftp --with-mysql
   --with-mcrypt=/libmcryp_dir --with-openssl=/open_ssl_dir  --enable-bcmath --enable-calendar
   --with-curl=/curl_dir --with-curlwrappers --enable-ctype --enable-exif --with-ncurses=/ncurses_dir
   --enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-shmop --enable-sockets --enable-sigchild
   --with-gd --with-jpeg-dir=/your_jpeg_dir --enable-yp --with-zlib-dir=/your_zlib_dir --enable-gd-native-ttf
   --enable-gd-jis-conv --with-pdflib=/your_pdf_lib_dir -with-apxs2=/apachedir/bin/apxs --with-config-file-path=/your_phpini_path

Hope that helps,
Habib
xlark at sdf dot lonestar dot org
11-Jul-2003 10:48
If you do a "Core Install" of Solaris,  be sure you have installed the SUNWlibm and SUNWlibms packages.  PHP 4.2.3 fails to compile without them.

If you get errors with GCC about math.h, then you don't have them installed.
ejflores at alcatel dot es
03-Jul-2003 09:14
./configure not run fine with /usr/ucb/tr you need to install GNU textutils
jalw75 at yahoo dot com
19-Mar-2003 10:53
Installing Apahce, PHP and MySQL.
I am running Sun Solaris 5.8 02/02.
I started by removing the base perl and apache packages:
   SUNWapchd      Apache Web Server Documentation
   SUNWapchr      Apache Web Server (root)
   SUNWapchu      Apache Web Server (usr)
   SUNWpl5m        Perl5 On-Line Manual Pages
   SUNWpl5p        Perl 5.005_03 (POD Documentation)
   SUNWpl5u        Perl 5.005_03

Install and configure MySQL (check out www.mysql.com).

Then I installed the following packages and tarballs.
                       a: gcc-2.95.3-sol8-sparc-local.Z
                       b: perl-5.6.1-sol8-sparc-local.Z
                       c: flex-2.5.4a-sol8-sparc-local
                       d: bison-1.34-sol8-sparc-local
                       e: make-3.79.1-sol8-sparc-local.Z
                       f: DBI-1.18
                       g: Net-Telnet-3.02
                       h: Date-Calc-5.0

Now I install Apache and PHP
   1.gunzip apache_1.3.27.tar.gz
   2.tar -xvf apache_1.3.27.tar
   3.gunzip php-4.1.2.tar.gz
   4.tar -xvf php-4.1.2.tar
   5.cd apache_1.3.27
   6../configure --prefix=/www --enable-module=so
   7.make
   8.make install
   9.cd ../php-4.1.2
   10../configure --with-mysql
         --with-apxs=/www/bin/apxs
   11.make
   12.make install

Copy the php.ini file to the system from php src dir.
   1. cp php.ini-dist /usr/local/lib/php.ini

Make sure the httpd.conf file has the following:

   LoadModule php4_module /www/libexec/libphp4.so
  
   <IfModule mod_dir.c>
   DirectoryIndex index.html index.php index.htm index.php3
   </IfModule>

   AddType application/x-httpd-php .php .html .htm .php3

That's what I did ... now start apache and put in you rc scripts so it starts on boot.
ineves at iportalmais dot pt
07-Mar-2003 06:09
I have compiled php 4.2.3, on my solaris 9, sparc, it works, i have gcc 3.2.2, from sunfreeware.org, i have compiled with

./configure --prefix=/opt/php --with-apxs=/opt/apache/bin/apxs --with-pgsql=/opt/pgsql --with-imap=/usr/src/soft/imap-2002b --with-ldap --with-imap-ssl=/usr/local/ssl

It compiles, but when i try to run it says something like:

bash-2.05# /opt/apache/bin/apachectl start
Syntax error on line 205 of /opt/apache/conf/httpd.conf:
Cannot load /opt/apache/libexec/libphp4.so into server: ld.so.1: /opt/apache/bin/httpd: fatal: relocation error: file /opt/apache/libexec/libphp4.so: symbol ldap_start_tls_s: referenced symbol not found
/opt/apache/bin/apachectl start: httpd could not be started

This means that the ldap librarys that came with solaris, are not very fine, you should use from openldap.org packages...

it is using this library:

bash-2.05# ldd /opt/apache/libexec/libphp4.so
   ...
   libldap.so.5 =>  /usr/lib/libldap.so.5

his one is from solaris installation.

(sorry about my english)
magno at corp dot globo dot com
07-Feb-2003 04:28
Solving error: "Output line too long" in Solaris 8
after ./configure --options, type:
export PATH=/usr/xpg4/bin/:$PATH

then:

make
make install
05-Feb-2003 06:53
Using sed 4.0 on solaris 8 from pkg-get/sunfreeware DID NOT fix my "Output line too long" problem but mv'inv /usr/bin/sed to /usr/bin/gnu-sed and then ln -s'ing /usr/xpg4/bin/sed to /usr/bin/sed DID work.
31-Jan-2003 02:13
In order to get rid of the "output line too long" error, /usr/xpg4/bin/sed will work, too.
phil at bolthole dot com
09-Jan-2003 04:07
packages of everything you need, INCLUDING a package of PHP itself, can be gotten from www.blastwave.org

Binaries are for solaris 8 or later, both sparc and x86 available.
nicos at php dot net
06-Jan-2003 10:49
Note that you also need GNU sed or you'll have some errors lile "Output line too long."
m at hackerz dot uk dot co
15-Oct-2002 12:49
Compiled Ok on Solaris 9 after the addition of Bison Flex automake and autoconf, adding /usr/local/bin to the path and linking /usr/ccs/bin/ar to /usr/local/bin/ar.
php at woodNO-SPAMstea dot com
26-Jun-2002 02:15
Howard Glynn's post from May 22 is right on - if you're running Solaris 8, make sure you get the latest Recommended patch cluster. I've been struggling with that library problem that happens when you start Apache for several weeks, tweaking the config, setting LD_LIBRARY_PATH, etc. I couldn't believe that the PHP developers wouldn't have the Solaris build right - seems like a fairly important OS. But the latest Solaris patch cluster fixed the problem, so I guess it was my fault for not being up to date. I'm running PHP 4.2.1 now with Apache 2.0.36, works great.
ltfrench at vt dot edu
09-Jun-2002 05:09
To get PHP 4.2.0 or better to make on Solaris 8 (using gcc and gnu autoconf) you need to:
ln -s /usr/local/bin/gcc /usr/local/bin/cc

See: http://bugs.php.net/bug.php?id=16833
howardglynn at hotmail dot com
22-May-2002 01:26
I've had a lot of problems with "dn_skipname" reference errors when trying to do a php / apache shared-library install on solaris 8. All compiling was clean, but could not restart apache with mod_php. After much trial and error, I found a solution by installing patch 109326-07 which has some fixes for resolver (I think). I had one web server without the patch, and one with it, and was able to show the same commands compiling, working and restarting on one, but not the other. Installed patch on machine, compiled clean and was up and running after doing this. Works great. Get the patch from sun.com
dward at netschools dot net
17-Apr-2002 05:25
I also found that I needed to use GNU sed on Solaris 7 instead of the version that comes with Solaris, otherwise I ended up getting a bunch of "Line too long" type of messages.
gsmith1 at iupui dot edu
03-Apr-2002 07:35
Loading 4.1.2 on solaris 8 in C shell with mysql 4.0.1 I kept running into file not found errors by ld during make.  A specific error relating to adding mysql was solved by adding the following environment variable:
setenv LD_RUN_PATH=/usr/lib:/usr/local/lib:/usr/local/mysql/lib
bvdzon at xs4all dot nl
27-Mar-2002 07:12
You can also edit httpd.conf and insert the compleet path to libphp4.so.

Before:
LoadModule php4_module [TAB] libexec/libphp4.so

After:
LoadModule php4_module [TAB] /usr/apache/libexec/libphp4.so

Works like a charm.
shane dot kinsch at netracorp dot comNOSPAM
17-Feb-2002 03:49
PHP 4.1.1 / Apache 1.32 Buile Issues (Solaris 2.8)

Apache build options:
./configure --prefix=/usr/local/etc/apache --enable-module=rewrite --enable-shared=rewrite

PHP build options:
./configure --with-mysql=/usr/local/etc/mysql --with-apxs=/usr/local/etc/apache/bin/apxs

Both Apache and PHP compiled without errors and installed cleanly.

The Error when starting Apache:
Syntax error on line 208 of /usr/local/etc/apache/conf/httpd.conf:
Cannot load /usr/local/etc/apache/libexec/libphp4.so into server:
ld.so.1: /usr/local/etc/apache/bin/httpd: fatal: relocation error: file /usr/local/etc/apache/libexec/libphp4.so: symbol dn_skipname: referenced symbol not found ./apachectl start: httpd could not be started

Line 208 in the httpd.conf file is:
LoadModule php4_module        libexec/libphp4.so

The solution:
For some reason, even though LD_LIBRARY_PATH was being set properly,
it wasn't being read fully.  You will need to create a runtime
linking environment by doing this:

#crle -c /var/ld/ld.config -l /usr/lib:/usr/local/lib:/usr/local/etc/mysql/lib

Shane Kinsch
NetraCorp LLC / SecurNET Consulting
dave at nol dot org
28-Jan-2002 04:03
Thanks to cce32@yahoo.com, I was also able to get php to compile properly... the ld command which actually generates the libphp4.so object file is hidden by the libtool --silent command... which makes for a very annoying time trying to trace where the RPATH isn't getting set.  Remove this, and you can see the linker command you can re-run with the appropriate -R directives.  A possibly obvious caveat to this is not to run "make install", which will overwrite your fixed version of the .so file and install a re-broken version.  All in all, I'm rather unhappy that the package/install maintainer decided to make --silent a default option for libtool... it made tracking down this issue much more difficult than it should have been.  Oh well, live and learn, I guess....
jakob dot nielsen at nhst dot no
08-Jan-2002 08:39
You can get all the Solaris Packages needed for the PHP installation on

http://www.sunfreeware.com/
cce32 at yahoo dot com
24-Oct-2001 04:23
For Solaris I did not want to rely on LD_LIBRARY_PATH so I spent a lot of time trying to make configure or libtool send a -R/path/to/libs to the linker when building libphp4.so.  I was never able to get it to work but by removing the --silent flag to libtool I captured the final link command and cut and pasted it back into my shell along with the -R/usr/local/lib:/usr/local/mysql.  The resulting libphp4.so is able to find all the shared libs now. You can check this with the ldd command.
Louis at ewens dot com
22-Jun-2001 10:39
On Solaris, if upon starting Apache you get an error like this:

Syntax error on line 33 of /usr/local/apache/conf/httpd.conf:
Cannot load /usr/local/apache/libexec/libphp4.so into server: ld.so.1: /usr/loca
l/apache/bin/httpd: fatal: libmysqlclient.so.10: open failed: No such file or directory
./apachectl start: httpd could not be started

..try inserting the following lines into the configuration section of your apachectl startup shell script:

LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/mysql/lib/mysql
export LD_LIBRARY_PATH

Change the /usr/local/mysql/ prefix to where ever your MySQL installation is. Make sure to add on the /lib/mysql extension to your own path though.

Do your normal "apachectl start" command to start Apache and voila, no more error. Apachectl can be found in the bin directory of your Apache installation.
cullin at cometsystems dot com
22-Jan-2001 11:59
When compiling and installing on Solaris, you might encounter a but that occurs only when you try and start apache - in otherwords, the module compiles fine but it won't run!  The specific error is that it can't find a symbol called "__muldi3". From what I can tell, this is an internal symbol created by gcc and the problem happens when you compile the code with gcc and then use a different linker.

To fix the problem, make sure that there is only one 'ld' program in your $PATH and that you also specify '--with-gnu-ld' in your configuration.

<OpenBSD installation notesGentoo installation notes>
 Last updated: Thu, 19 May 2005
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: The Server Pages
Last updated: Thu May 19 18:35:34 2005 EDT