Hi

I'm trying to install the ssh2 module in PHP 5.1.2 in a FC5 machine.
The installation procedure was successfull but the following error started to appear:

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/ssh2.so' - /usr/lib/php/modules/ssh2.so: undefined symbol: zend_hash_add_or_update in Unknown on line 0
PHP Fatal error: Call to undefined function ssh2_connect()

I tried to downgrade the ssh2 module or the libssh without success,

Any help would be appreciated.

Thanx
Astribuncio

    Hi,

    how did you install the ssh2 extension ? Did you compile it yourself or download it from somewhere ? If you compiled it yourself, how did you do that ?

    Regards,
    Thomas

      Hi,

      I tried two ways with the same result:
      - pear install ssh2-beta
      - downloaded the tarball, "phpize && ./configure --with-ssh2 && make" and copied the ssh2.so to the php modules dir

        What does the command
        phpize --version
        print ?

        Thomas

          There's another important point:

          Additionally to the command line switch --with-ssh2 you need --with-php-config.
          That should point to the php-config executable in $prefix/bin. That will make sure that all paths and references are set up to match the correct PHP libraries, especially if there's more than one PHP installation on your server.

          Thomas

            Hi

            The switch --with-php-config did the trick.

            Thanks a lot!!

              Glad to hear that 🙂

              Don't forget to mark the thread resolved.

              Thomas

                2 months later

                I am having the same issue. When I compile using --with-ssh2, it completes the compile. When I compile using --with-ssh2 --with-php-config, it gets to...

                webwise1:~/ssh2-0.10 # ./configure --with-ssh2 --with-php-config
                checking build system type... i686-pc-linux-gnu
                checking host system type... i686-pc-linux-gnu
                checking for gcc... gcc
                checking for C compiler default output file name... a.out
                checking whether the C compiler works... yes
                checking whether we are cross compiling... no
                checking for suffix of executables...
                checking for suffix of object files... o
                checking whether we are using the GNU C compiler... yes
                checking whether gcc accepts -g... yes
                checking for gcc option to accept ISO C89... none needed
                checking whether gcc and cc understand -c and -o together... yes
                checking if compiler supports -R... no
                checking if compiler supports -Wl,-rpath,... yes

                ...tanks my server for about 10-15 minutes, then it kills itself.

                Any thoughts?

                Thanks in advance.

                  Hi

                  It seems thaht you are not using the --with-php-config switch correctly.
                  You have to use the path to the php-config

                  ./configure --with-ssh2 --with-php-config=/path/to/correct/php/bin/php-config

                    astribuncio wrote:

                    Hi

                    It seems thaht you are not using the --with-php-config switch correctly.
                    You have to use the path to the php-config

                    ./configure --with-ssh2 --with-php-config=/path/to/correct/php/bin/php-config

                    I did as you recomended and it did complete the configure and make. I have verified that php is now using the new ssh2.so, however I am still getting an error. A little bit different though.

                    [Sun Sep 03 09:07:48 2006] [notice] Digest: done
                    PHP Warning:  Unknown(): Unable to load dynamic library './ssh2.so' - ./ssh2.so:
                     cannot open shared object file: No such file or directory in Unknown on line 0
                    [Sun Sep 03 09:07:48 2006] [notice] Apache/2.0.53 (Unix) PHP/4.3.11 configured -
                    - resuming normal operations

                    Any ideas?

                      So, I think I am missing something here.

                      In my php.ini, the extension_dir is "./". I assumed that it was in /usr/local/lib/php/extensions because when I used pear to install ssh2.so, that's where it placed the module.

                      So in troubleshooting my last error, I change my extension_dir to /usr/local/lib/php/extensions, where my module is, restarted apache and now it works.

                      So I guess the question now is, how can I tell what php thinks "./" is located? Once I know what the path is to that, I can copy the module there and I should be good to go.

                        Hi

                        From the user manual

                        Unix - If not explicitly set in the php.ini, the default extension directory depends on

                        *
                        
                          whether PHP has been built with --enable-debug or not
                        *
                        
                          whether PHP has been built with (experimental) ZTS (Zend Thread Safety) support or not
                        *
                        
                          the current internal ZEND_MODULE_API_NO (Zend internal module API number, which is basically the date on which a major module API change happened, e.g. 20010901) 

                        Taking into account the above, the directory then defaults to <install-dir>/lib/php/extensions/ <debug-or-not>-<zts-or-not>-ZEND_MODULE_API_NO, e.g. /usr/local/php/lib/php/extensions/debug-non-zts-20010901 or /usr/local/php/lib/php/extensions/no-debug-zts-20010901

                          Write a Reply...