Recompiling PHP in CoolStack

Hello;

I have run into an issue recompiling PHP to include the extensions I need, in particular OCI8 extensions for Oracle.

# cat /etc/release

Solaris 10 3/05 s10_74L2a SPARC

Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.

Use is subject to license terms.

Assembled 22 January 2005

#

Here is my updated config.sh

# cat config.sh

#!/bin/sh

###############################################################

## custom PHP options

## --with-zlib[=DIR]Include ZLIB support (requires zlib >= 1.0.9)

## --enable-bcmath Enable bc style precision math functions

## --with-bz2[=DIR]Include BZip2 support

## --enable-calendarEnable support for calendar conversion

## --with-curl[=DIR]Include CURL support

## --with-curlwrappersUse CURL for url streams

## --enable-ftpEnable FTP support

## --with-gd[=DIR] Include GD support where DIR is GD install prefix.

## If DIR is not set, the bundled GD library will be used

## --with-jpeg-dir[=DIR]GD: Set the path to libjpeg install prefix

## --with-png-dir[=DIR]GD: Set the path to libpng install prefix

## --with-ldap[=DIR]Include LDAP support

## --enable-mbstringEnable multibyte string support

## --with-pspell[=DIR]Include PSPELL support.

## --enable-soapEnable SOAP support

## --with-oci8[=DIR]Include Oracle (OCI8) support. The default DIR is ORACLE_HOME.

##

###############################################################

# The following should be used to to build the CSQamp package

CFLAGS='-KPIC -xO4 -xtarget=generic ' \

./configure --prefix=/usr/local/php5 \

--with-apxs2=/usr/local/apache2/bin/apxs --enable-memory-limit --disable-all \

--with-libxml-dir=shared,/usr/local --with-dom --enable-dom --enable-spl --enable-simplexml \

--with-pcre-regex --enable-session \

--enable-shmop --enable-pear --enable-sysvshm --enable-sysvmsg \

--enable-sysvsem --enable-sockets --enable-spl --with-pear --enable-xml --enable-libxml --disable-ipv6 \

--with-iconv-dir=/usr/local --with-mysql=shared,/usr/local/mysql_32bit \

--with-mysqli=shared,/usr/local/mysql_32bit/bin/mysql_config --with-openssl=shared,/usr/sfw \

--enable-bcmath --enable-calendar --enable-ftp --enable-mbstring --enable-soap \

--with-zlib \

--with-bz2 \

--with-gd --with-jpeg-dir --with-png-dir \

--with-ldap \

--with-pspell \

--with-oci8=/opt/oracle9/product/9.2.0.1/ --enable-sigchild

#

There is no issue running config.sh, but when i run make, it almost immediately fails with this error:

cc: acomp failed for /export/src/coolStack/coolStackSource/php-5.1.4/ext/oci8/oci8.c

make: *** [ext/oci8/oci8.lo] Error 1

Building without the inlcusion of --with-oci8 runs and installs without issue.

Any ideas?

[2945 byte] By [Cubical10a] at [2007-11-26 19:19:25]
# 1

Update:

I found this link [url=http://bugs.php.net/bug.php?id=40297]http://bugs.php.net/bug.php?id=40297[ /url] which gave me the idea to strip $PATH, down to just the essentials:

#echo $PATH

/opt/SUNWspro/bin/:/usr/ccs/bin/:/usr/sbin:/usr/bin

Now make proceeds farther but still dies with OCI error:

cc: acomp failed for /export/src/coolStack/coolStackSource/php-5.1.4/ext/oci8/oci8.c

*** Error code 1

make: Fatal error: Command failed for target `ext/oci8/oci8.lo'

Cubical10a at 2007-7-9 21:35:44 > top of Java-index,Open Source Technologies,OpenSPARC...
# 2
What is the actual error message you are seeing ?Can you go into the ext directory and run make from there and see if you can get a decent error message ? Shanti
shantiSa at 2007-7-9 21:35:44 > top of Java-index,Open Source Technologies,OpenSPARC...
# 3

Ok, so i think that the error i was seeing was related to missing headers in the oracle package that I had installed, so switched to using the Oracle instant client. This fixed the make problem i was seeing.

But now i have a new error that occurs during make install.

Any ideas?

Thank you;

Configure script:

# cat myConfig.sh

#!/bin/sh

###############################################################

## custom PHP options

## --with-zlib[=DIR]Include ZLIB support (requires zlib >= 1.0.9)

## --enable-bcmath Enable bc style precision math functions

## --with-bz2[=DIR]Include BZip2 support

## --enable-calendarEnable support for calendar conversion

## --with-curl[=DIR]Include CURL support

## --with-curlwrappersUse CURL for url streams

## --enable-ftpEnable FTP support

## --with-gd[=DIR] Include GD support where DIR is GD install prefix.

## If DIR is not set, the bundled GD library will be used

## --with-jpeg-dir[=DIR]GD: Set the path to libjpeg install prefix

## --with-png-dir[=DIR]GD: Set the path to libpng install prefix

## --with-ldap[=DIR]Include LDAP support

## --enable-mbstringEnable multibyte string support

## --with-pspell[=DIR]Include PSPELL support.

## --enable-soapEnable SOAP support

## --with-oci8[=DIR]Include Oracle (OCI8) support. The default DIR is ORACLE_HOME.

## --with-oci8=instantclient,/path/to/oic/lib

## --with-mysqli=shared,/usr/local/mysql_32bit/bin/mysql_config

## --with-mysql=shared,/usr/local/mysql_32bit

###############################################################

# The following should be used to to build the CSQamp package

CFLAGS='-KPIC -xO4 -xtarget=generic ' \

./configure --prefix=/usr/local/php5 \

--with-apxs2=/usr/local/apache2/bin/apxs --enable-memory-limit --disable-all \

--with-libxml-dir=shared,/usr/local --with-dom --enable-dom --enable-spl --enable-simplexml \

--with-pcre-regex --enable-session \

--enable-shmop --enable-pear --enable-sysvshm --enable-sysvmsg \

--enable-sysvsem --enable-sockets --enable-spl --with-pear --enable-xml --enable-libxml --disable-ipv6 \

--with-iconv-dir=/usr/local --with-mysql=shared,/usr/local/mysql_32bit \

--with-mysqli=shared,/usr/local/mysql_32bit/bin/mysql_config --with-openssl=shared,/usr/sfw \

--enable-bcmath --enable-calendar --enable-ftp --enable-mbstring --enable-soap \

--with-zlib --with-bz2 --with-ldap --with-pspell \

--with-gd --with-jpeg-dir --with-png-dir --enable-sigchild \

--with-oci8=instantclient,/export/oracle/instantclient/10.2.0.3

# make

...

Build complete.

(It is safe to ignore warnings about tempnam and tmpnam).

# make install

Installing PHP SAPI module:apache2handler

/usr/local/apache2/build/instdso.sh SH_LIBTOOL='/usr/local/apache2/build/libtool' libphp5.la /usr/local/apache2/modules

/usr/local/apache2/build/libtool --mode=install cp libphp5.la /usr/local/apache2/modules/

cp .libs/libphp5.so /usr/local/apache2/modules/libphp5.so

chmod +x /usr/local/apache2/modules/libphp5.so

cp .libs/libphp5.lai /usr/local/apache2/modules/libphp5.la

libtool: install: warning: remember to run `libtool --finish /export/src/coolStack/coolStackSource/php-5.1.4/libs'

chmod 755 /usr/local/apache2/modules/libphp5.so

[activating module `php5' in /usr/local/apache2/conf/httpd.conf]

Installing PHP CLI binary:/usr/local/php5/bin/

Installing PHP CLI man page:/usr/local/php5/man/man1/

Installing shared extensions:/usr/local/php5/lib/php/extensions/no-debug-non-zts-20050922/

Installing build environment:/usr/local/php5/lib/php/build/

Installing header files: /usr/local/php5/include/php/

Installing helper programs:/usr/local/php5/bin/

program: phpize

program: php-config

Installing man pages: /usr/local/php5/man/man1/

page: phpize.1

page: php-config.1

Installing PEAR environment:/usr/local/php5/lib/php/

ld.so.1: php: fatal: libnnz10.so: open failed: No such file or directory

*** Error code 137

The following command caused the error:

/export/src/coolStack/coolStackSource/php-5.1.4/sapi/cli/php -n -dshort_open_tag=0 -dsafe_mode=0 -derror_reporting=E_ALL -dmemory_limit=-1 -ddetect_unicode=0 pear/install-pear-nozlib.phar -d "/usr/local/php5/lib/php" -b "/usr/local/php5/bin"

make: Fatal error: Command failed for target `install-pear-installer'

Current working directory /export/src/coolStack/coolStackSource/php-5.1.4

*** Error code 1

The following command caused the error:

if test -f pear/install-pear-nozlib.phar && /export/src/coolStack/coolStackSource/php-5.1.4/build/shtool mkdir -p /usr/local/php5/lib/php; then \

make -s install-pear-installer; \

else \

cat /export/src/coolStack/coolStackSource/php-5.1.4/pear/install-pear.txt; \

fi

make: Fatal error: Command failed for target `install-pear'

# /usr/local/apache2/bin/apachectl startssl

Syntax error on line 87 of /usr/local/apache2/conf/httpd.conf:

Cannot load /usr/local/apache2/modules/libphp5.so into server: ld.so.1: httpd: fatal: libnnz10.so: open failed: No such file or directory

#

Cubical10a at 2007-7-9 21:35:44 > top of Java-index,Open Source Technologies,OpenSPARC...
# 4

You're obviously missing libnnz10.so. This should be in $ORACLE_HOME/lib.

Set LD_LIBRARY_PATH to include this directory. To be doubly certain, set LDFLAGS to include "-L$ORACLE_HOME/lib".

Once the make finishes, you can do a "ldd libphp5.so" first to ensure that all libraries can be found. Do this, before running 'make install'.

Shanti

shantiSa at 2007-7-9 21:35:44 > top of Java-index,Open Source Technologies,OpenSPARC...
# 5

I forgot to update my $ORACLE_HOME after i switched to the instantclient. So that was one issue. (A fine example of why its good to walk away for a few minutes every now and then.)

After the make command

# ldd libs/libphp5.so | grep file

libnnz10.so => (file not found)

I fixed the issue by adding source libs to LD_LIBRARY_PATH

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/export/src/coolStack/coolStackSource/php-5.1. 4/libs

# ldd libs/libphp5.so | grep file

'make install' proceeded with out issue.

But i did notice something strange after the build was complete.

A /usr/local/php5_fastcgi directory was created. The only file in it is /usr/local/php5_fastcgi/etc/pear.conf.

As you can see from the configure script I ran, there is no mention of php5_fastcgi.

Updating pear breaks it.

# pear list-upgrades

pear.php.net Available Upgrades (stable):

=========================================

Channel Package Local Remote Size

pear.php.net PEAR 1.4.9 (stable) 1.5.0 (stable) 280kB

# pear upgrade --alldeps PEAR

downloading PEAR-1.5.0.tgz ...

Starting to download PEAR-1.5.0.tgz (286,143 bytes)

...........................................................done: 286,143 bytes

upgrade ok: channel://pear.php.net/PEAR-1.5.0

PEAR: Optional feature webinstaller available (PEAR's web-based installer)

PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)

PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer)

To install use "pear install pear/PEAR#featurename"

# pear list

/usr/local/php5/bin/pear: /usr/local/php5_fastcgi/bin/php: not found

Fortunately, i created a copy of the default php5 directory, php5CSQ.

# diff /usr/local/php5/bin/pear /usr/local/php5CSQ/bin/pear

7c7

< if test "/usr/local/php5_fastcgi/bin/php" = '@'php_bin'@'; then

> if test "/usr/local/php5/bin/php" = '@'php_bin'@'; then

10c10

< PHP="/usr/local/php5_fastcgi/bin/php"

> PHP="/usr/local/php5/bin/php"

28c28

< exec $PHP -C -q $INCARG -d output_buffering=1 -d open_basedir="" -d safe_mode=0 -d register_argc_argv="On" -d auto_prepend_file="" -d auto_append_file="" $INCDIR/pearcmd.php "$@"

> exec $PHP -C -q $INCARG -d output_buffering=1 -d open_basedir="" -d safe_mode=0 $INCDIR/pearcmd.php "$@"

#

# diff /usr/local/php5/bin/peardev /usr/local/php5CSQ/bin/peardev

7c7

< if test "/usr/local/php5_fastcgi/bin/php" = '@'php_bin'@'; then

> if test "/usr/local/php5/bin/php" = '@'php_bin'@'; then

10c10

< PHP="/usr/local/php5_fastcgi/bin/php"

> PHP="/usr/local/php5/bin/php"

28c28

< exec $PHP -d memory_limit="-1" -C -q $INCARG -d output_buffering=1 -d open_basedir="" -d safe_mode=0 -d register_argc_argv="On" -d auto_prepend_file="" -d auto_append_file="" $INCDIR/pearcmd.php "$@"

> exec $PHP -d memory_limit="-1" -C -q $INCARG -d output_buffering=1 -d open_basedir="" -d safe_mode=0 $INCDIR/pearcmd.php "$@"

#

Pear is using the pear.conf file php5_fastcgi/etc as opposed to the pear.conf in php5/etc.

My (temporary) solution is this:

#ln -s /usr/local/php5/bin /usr/local/php5_fastcgi/

If i had know that pear was now using the pear.conf file in php5_fastcgi i would have:

a. edited it first, pointing it back to php5/bin.

b. found a way to get pear to use php5/etc/pear.conf

I am curious as to how php5_fastcgi was created.

For now I have a working AMP stack on solaris 10 with the extensions I need.

Thank you Shanti for the pointers.

PS. Where can I find out more info on the next release of CSQamp? (release date, configure options, etc...)

Cubical10a at 2007-7-9 21:35:44 > top of Java-index,Open Source Technologies,OpenSPARC...
# 6

It is always tricky to build PHP. In future, always try and use 'phpize' first when adding an extension. Only if this doesn't work, should one resort to rebuilding php.

I'm a little puzzled by the mixup with php_fastcgi myself - I suspect you've cut and paste the fastcgi version configure from the README. php_fastcgi is meant to be used if you are running an appserver other than apache - say the Sun web server for instance.

In the next release, we are getting rid of this, since every webserver seems to have their own plugin for php anyway.

Stay tuned for info on the next release - it's only a day or two away. I'll be sure to post on the forum when the release goes out.

Shanti

P.S: Have I earned my duke dollars ?

shantiSa at 2007-7-9 21:35:44 > top of Java-index,Open Source Technologies,OpenSPARC...
# 7

I will try to use phpize in the future.

You can clearly see in my earlier posts that there is no mention of php_fastgui in the config.sh I used to build PHP, nor did I run a build of the stand alone php5_fastcgi before I rebuilt PHP as described in my config.sh script. /usr/local/php_fastcgi was not created until after(durning) my successful rebuild of php.

Your Duke stars should be paid. :)

Thank you;

PS. Could a mailing list be created for those of us who are planning on using Cool Stack? That way, we could stay abreast of new releases, patches, etc...

Cubical10a at 2007-7-9 21:35:44 > top of Java-index,Open Source Technologies,OpenSPARC...
# 8

> ...

> In the next release, we are getting rid of this,

> since every webserver seems to have their own plugin

> for php anyway.

>

> Stay tuned for info on the next release - it's only a

> day or two away. I'll be sure to post on the forum

> when the release goes out.

Could you, Shanti, please change date at you computer ? I am a bit puzzled about when do you post your messages.

Regards

przemol

przemolba at 2007-7-9 21:35:45 > top of Java-index,Open Source Technologies,OpenSPARC...
# 9
> PS. Could a mailing list be created for those of us> who are planning on using Cool Stack? That way, we> could stay abreast of new releases, patches, etc...Or RSS feed.przemol
przemolba at 2007-7-9 21:35:45 > top of Java-index,Open Source Technologies,OpenSPARC...
# 10

Please don't remove fastcgi! Some of us use it instead of mod_php (lighttpd, anyone?)

If anything, please stick a php-fcgi binary in /usr/local/php5/bin like a lot of other vendors do.

Also, is there a place where users could vote on which extensions to install by default?

I for one would like the ones that are _impossible_ to install without recompiling (imap, for example) installed by default. The whole point of a all-in-one optimized package like this is to make things easier on the admin, not more difficult. If I have to recompile php for this one extension, I might as well just compile from source like I have been.

Perhaps offer several add-on packages with just the *.so in them? A lot of other packagers do that and it makes it very easy to add/remove modules as necessary.

Thanks for all of the great work! Mark

mckinga at 2007-7-9 21:35:45 > top of Java-index,Open Source Technologies,OpenSPARC...
# 11

> Please don't remove fastcgi! Some of us use it

> instead of mod_php (lighttpd, anyone?)

>

Ah shucks ! Just a tad too late. I just released the new version without php_fastcgi.

Let me see what can be done in getting out a fastcgi version. Are there others out there using this ?

> If anything, please stick a php-fcgi binary in

> /usr/local/php5/bin like a lot of other vendors do.

>

That we've done. There is now a php binary included - note that the new install location is /opt/coolstack.

> Also, is there a place where users could vote on

> which extensions to install by default?

>

You can always provide feedback via feedback@cooltools.sunsource.net.

> I for one would like the ones that are _impossible_

> to install without recompiling (imap, for example)

> installed by default. The whole point of a

> all-in-one optimized package like this is to make

> things easier on the admin, not more difficult. If I

> have to recompile php for this one extension, I might

> as well just compile from source like I have been.

>

Agreed. Do download the new PHP version and let us know what you think. imap is in there along with 2 dozen other extensions. Almost all of them are .so's, so you don't pay any penalty if you don't use them.

> Perhaps offer several add-on packages with just the

> *.so in them? A lot of other packagers do that and

> it makes it very easy to add/remove modules as

> necessary.

>

> Thanks for all of the great work! Mark

You're welcome. And keep the feedback coming.

Shanti

shantiSa at 2007-7-9 21:35:45 > top of Java-index,Open Source Technologies,OpenSPARC...