I am trying to make PHP use libraries in /opt/common/lib.
But I am not able to do so.
If i run an LDD to check what libraries are going to be used when running
it shows /usr/local/lib/*

What I have tried.

In my configure script I have set up my
CPPFLAGS="-I/opt/common/include"
LDFLAGS="-I/opt/common/lib -R/opt/common/lib -I/opt/common/openssl-0.9.8n/lib -L
/opt/common/openssl-0.9.8n/lib"
LD_LIBRARY_PATH=/usr/sfw/lib:/opt/common/lib:/opt/common/openssl-0.9.8n/lib
export LD_LIBRARY_PATH LDFLAGS CPPFLAGS

But this does not work, it seems like the /usr/local/lib is hard coded in the source code.

I have tried edeting the configure script and remove all reference to /usr/local/lib

But when I run .configure with my libs with the paths and then run make it still shows /usr/local/lib for some of my libs.

So then I edited my Makefile and remove all references of /usr/local/lib
and yes I ran the make clean command before.

Then I ran the make command and still /usr/local/lib

I there a way that I have not mentioned to force PHP to use /opt/common/***

Thanks😕

    Have you tried creating a symlink to the directory in the /usr/local/lib directory? Not sure if it that will work but it may be worth a try.

    Also, are you trying to run PHP from the console, or are you trying to run it from a web page? Configs may be different for each. I learned this when a plugin wouldn't run from the console that ran just fine in my web page.

      Yes I could create a symlink but this is a common are so I can not create a symlic.
      If I do then other web sites will start using this new ssl and I don't want that for now.

      root:/opt/build/src/php-5.3.2.curl/libs# ldd libphp5.so
      libresolv.so.2 => /lib/libresolv.so.2
      librt.so.1 => /lib/librt.so.1
      libmysqlclient.so.15 => /opt/common/mysql-5.0.24a/lib/mysql/libmysqlclient.so.15
      libldap-2.2.so.7 => /usr/local/lib/libldap-2.2.so.7
      liblber-2.2.so.7 => /usr/local/lib/liblber-2.2.so.7
      libfreetype.so.6 => /usr/local/lib/libfreetype.so.6
      libpng12.so.0 => /usr/local/lib/libpng12.so.0
      libz.so => /opt/common/mysql-5.0.24a/lib/mysql/libz.so
      libjpeg.so.62 => /usr/local/lib/libjpeg.so.62
      libssl.so.0.9.8 => /usr/local/lib/libssl.so.0.9.8
      libcrypto.so.0.9.8 => /usr/local/lib/libcrypto.so.0.9.8

      All I have done so far it to create a shared object file, to test how it's going to run I use the
      ldd command and that gives me what libs it's going to use when running.

      So what I have done so far
      Run configure
      Run make.
      This creates the libphp5.so file I then include the path in my httpd.conf file for starting apache.
      But I can't get the PHP shared object to use the openssl libs that I want.
      Here is my configure script that I run from the source directory.

      /opt/build/src/php-5.3.2# cat build-php5.3.2.sh
      PRODUCT=php-5.3.2
      SOURCE=/opt/build/src/php-5.3.2
      PREFIX=/opt/common/php-5.3.2
      PATH=/bin:/usr/ccs/bin:/usr/sfw/bin
      export PATH

      ./configure --prefix=${PREFIX} \
      --with-apxs=/opt/common/apache/bin/apxs \
      --with-mysql=/opt/common/mysql-5.0.24a \
      --with-openssl=/opt/common/openssl-0.9.8n \
      --with-libxml-dir=/opt/common \
      --enable-sigchild \
      --with-imap=no \
      --with-gd \
      --enable-gd-native-ttf \
      --with-freetype-dir=/opt/common \
      --with-jpeg-dir=/opt/common \
      --with-png-dir=/opt/common \
      --with-zlib-dir=/opt/common \
      --with-ldap \
      --with-mhash=/opt/common \
      --with-config-file-path=/opt/php \
      --with-snmp=/opt/common/net-snmp \
      --enable-shared=yes

        Try adding --with-libdir=/opt/common/lib to your configure line?

          Here is my problem

          I tell the configure script to use
          --with-openssl=/opt/common/openssl-0.9.8n \

          but after the make command I do an ldd on the libphp5.so file and I get

          /usr/local/lib/openssl

          How do i change the configure/make to use /opt/common/openssl-0.9.8n
          and not /usr/local/lib when I do ldd

            Thanks

            I will try --with-libdir=/opt/common/openssl-0.9.8n/lib

              Did not work it now compains during ./configure

              Here is my script

              PRODUCT=php-5.3.2
              SOURCE=/opt/build/src/php-5.3.2
              PREFIX=/opt/common/php-5.3.2
              PATH=/bin:/usr/ccs/bin:/usr/sfw/bin
              export PATH

              ./configure --prefix=${PREFIX} \
              --with-libdir=/opt/common/lib \
              --with-apxs=/opt/common/apache/bin/apxs \
              --with-mysql=/opt/common/mysql-5.0.24a \
              --with-libxml-dir=/opt/common \
              --enable-sigchild \
              --with-imap=no \
              --with-gd \
              --enable-gd-native-ttf \
              --with-freetype-dir=/opt/common \
              --with-jpeg-dir=/opt/common \
              --with-png-dir=/opt/common \
              --with-zlib-dir=/opt/common \
              --with-ldap \
              --with-mhash=/opt/common \
              --with-config-file-path=/opt/php \
              --with-snmp=/opt/common/net-snmp \
              --with-openssl-dir=/opt/common/openssl-0.9.8n \
              --enable-shared=yes

              Here is the result

              hecking whether to enable input filter support... yes
              checking pcre install prefix... no
              checking whether to enable FTP support... no
              checking OpenSSL dir for FTP... /opt/common/openssl-0.9.8n
              checking for GD support... yes
              checking for the location of libjpeg... /usr
              checking for the location of libpng... /usr
              checking for the location of libXpm... no
              checking for FreeType 2... /opt/common
              checking for T1lib support... no
              checking whether to enable truetype string function in GD... yes
              checking whether to enable JIS-mapped Japanese font support in GD... no
              checking for fabsf... (cached) yes
              checking for floorf... (cached) yes
              configure: error: libjpeg.(a|so) not found.

                I have been playing with the configuration file in the source directory,
                I have tried adding my -L and -R paths in the file and tried running the config and then
                the make and still the same result.

                  5 days later

                  I have tried modifying the Rpaths in the Makefile and remove any mention of /usr/local/lib
                  and then run gmake and no luck the /usr/local/lib still comes up.
                  I ran the ldd command on my shared object and I ran elfdump

                  /opt/build/src/php-5.3.2/libs# elfdump -d libphp5.so

                  Dynamic Section: .dynamic
                  index tag value
                  [0] NEEDED 0x1dc33 libresolv.so.2
                  [1] NEEDED 0x1dc5d librt.so.1
                  [2] NEEDED 0x1dce2 libmysqlclient.so.15
                  [3] NEEDED 0x1dcf7 libldap-2.2.so.7
                  [4] NEEDED 0x1dd08 libfreetype.so.6
                  [5] NEEDED 0x1dd19 libpng12.so.0
                  [6] NEEDED 0x1dd27 libz.so
                  [7] NEEDED 0x1dd2f libjpeg.so.62
                  [8] NEEDED 0x1dd3d libssl.so.0.9.8
                  [9] NEEDED 0x1dd4d libcrypto.so.0.9.8
                  [10] NEEDED 0x1dc71 libm.so.2
                  [11] NEEDED 0x1dc7b libnsl.so.1
                  [12] NEEDED 0x1dca0 libsocket.so.1
                  [13] NEEDED 0x1dd60 libnetsnmp.so.5
                  [14] NEEDED 0x1dd70 libgen.so.1
                  [15] NEEDED 0x1dd7c libkstat.so.1
                  [16] NEEDED 0x1dd8a libelf.so.1
                  [17] NEEDED 0x1dd96 libadm.so.1
                  [18] NEEDED 0x1dda2 libxml2.so.2
                  [19] NEEDED 0x1ddaf libiconv.so.2
                  [20] NEEDED 0x1dcb8 libc.so.1
                  [21] NEEDED 0x1dccc libgcc_s.so.1
                  [22] INIT 0xab63c
                  [23] FINI 0xab658
                  [24] SONAME 0x1ddbd libphp5.so
                  [25] RUNPATH 0x1ddc8 /opt/common/mysql-5.0.24a/lib/mysql:/usr/local/lib:/opt/common/lib:/opt/common/net-snmp/lib:/usr/ucblib:/usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3:/opt/common/openssl-0.9.8n/lib:/usr/sfw/lib:/usr/sfw/lib
                  [26] RPATH 0x1ddc8 /opt/common/mysql-5.0.24a/lib/mysql:/usr/local/lib:/opt/common/lib:/opt/common/net-snmp/lib:/usr/ucblib:/usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3:/opt/common/openssl-0.9.8n/lib:/usr/sfw/lib:/usr/sfw/lib
                  [27] HASH 0x94
                  [28] STRTAB 0x230b4
                  [29] STRSZ 0x1de96
                  [30] SYMTAB 0xbb64
                  [31] SYMENT 0x10
                  [32] CHECKSUM 0xd8e2
                  [33] VERNEED 0x40f4c
                  [34] VERNEEDNUM 0x7
                  [35] PLTRELSZ 0x8928
                  [36] PLTREL 0x7
                  [37] JMPREL 0xa2d14
                  [38] RELA 0x4104c
                  [39] RELASZ 0x6a5f0
                  [40] RELAENT 0xc
                  [41] FEATURE_1 0x1 [ PARINIT ]
                  [42] FLAGS 0 0
                  [43] FLAGS_1 0 0
                  [44] PLTGOT 0x6a66dc
                  [45] NULL 0

                  You can see in bold that /usr/local/lib comes up before my search path /opt/common/openssl-0.9.8n/lib even thought I have modified my Makefile before compiling.

                  My quesion is how can modify my rpath before running the make.

                  I know that there is a utility that can change rpaths -->chrpath but the is after the make and will affect all my libs which I don't want. Because other apps are using the /usr/local/lib path.
                  But for myself my libs are all under /opt/common/lib or /opt/common/lib/openssl-0.9.8n/lib

                  This /usr/local/lib must be hardcoded somewhere in the php source code.
                  Does anyone know where else that my Makefile can I modify this rpath.

                  Thanks

                    I have resolved my issue, I decided to download a utililty called chrpath which affects the run path of the shared library. So I was able to remove /usr/local/lib which I did not need to this shared library.

                      Write a Reply...