Note that there are some explanatory texts on larger screens.

plurals
  1. POInstalling SSH2 for PHP to run on a Xampp Apache server on a OSX 10.9.1
    primarykey
    data
    text
    <p>I am running Xampp on a Mac with OS X 10.9.1 and I am trying to develop a web page that calls a PHP script through an Ajax call. Xampp is used here for development purposes and it is not intended to form the backend of an online page.</p> <p>A PHP script needs to connect though ssh to a remote machine, reason for which I<br> plan to use the ssh2 library. When I try to run the commands:</p> <blockquote> <p>$connection = ssh2_connect('my.remote.machine.address', 5432);</p> </blockquote> <p>I get the following error:</p> <blockquote> <p>Fatal error: Call to undefined function ssh2_connect() in /Applications/XAMPP/xamppfiles/htdocs/Project/getdata.php on line 8</p> </blockquote> <p>and, by calling 'phpinfo()', ssh2 does not seem to be installed. I successfully managed to use ssh2_connect on Windows, Ubuntu and Scientific Linux and after a week I can't seem to figure out what I'm not doing right on a OSX I suspect there could be a problem with broken paths or interaction with the Apache server OSX came with. Here is what I have tried:</p> <p>I. The MacPorts and PECL method (reference: <a href="http://lassebunk.dk/2011/05/26/installing-ssh2-for-php-on-mac-os-x/" rel="nofollow">http://lassebunk.dk/2011/05/26/installing-ssh2-for-php-on-mac-os-x/</a>):</p> <ul> <li>stuff already on my computer: xcode (from iStore), MacPorts (installer from their site), PHP 5.4.17 and apparently an Apache server that comes with OSX, that I had to stop with:</li> </ul> <blockquote> <p>sudo apachectl stop</p> </blockquote> <p>so that the Xampp one worked.</p> <ul> <li>ran the command: </li> </ul> <blockquote> <p>sudo port install libssh2</p> </blockquote> <p>as the libssh2 and openssl libraries are prerequisites to using ssh2_connect in php (reference: <a href="http://www.php.net/manual/en/ssh2.requirements.php" rel="nofollow">http://www.php.net/manual/en/ssh2.requirements.php</a>); openssl appears to be already installed on Xampp's according to phpinfo().</p> <ul> <li>installed Pear:</li> </ul> <blockquote> <p>sudo php /usr/lib/php/install-pear-nozlib.phar</p> </blockquote> <ul> <li>installed Homebrew (otherwise the 'pecl install' commands fail):</li> </ul> <blockquote> <p>ruby -e "$(curl -fsSL <a href="https://raw.github.com/mxcl/homebrew/go/install" rel="nofollow">https://raw.github.com/mxcl/homebrew/go/install</a>)"</p> </blockquote> <ul> <li>ran:</li> </ul> <blockquote> <p>brew install autoconf</p> </blockquote> <ul> <li>now I was finally able to run:</li> </ul> <blockquote> <p>$ sudo pecl install ssh2-0.12 </p> </blockquote> <p>with "/opt/local" as prefix</p> <ul> <li>now I got a nice ssh2.so file, which I add to the relevant php.ini:</li> </ul> <blockquote> <p>/Applications/XAMPP/xamppfiles/etc</p> </blockquote> <p>by adding the line:</p> <blockquote> <p>extension=/opt/local/lib/php54/extensions/no-debug-non-zts-20100525/ssh2.so</p> </blockquote> <ul> <li>restarted the Xampp Apache Web Server from the GUI that comes with Xampp and still ssh2 was not found.</li> </ul> <p>II. The compile the ssh2.so from the terminal method (reference: zizifu's comment <a href="http://www.php.net/manual/en/ssh2.installation.php" rel="nofollow">http://www.php.net/manual/en/ssh2.installation.php</a>):</p> <ul> <li>got the libssh2 archive from <a href="http://libssh2.org/" rel="nofollow">http://libssh2.org/</a> and:</li> </ul> <blockquote> <p>./configure</p> <p>make</p> <p>make install</p> </blockquote> <ul> <li>got the latest ssh2 archive from <a href="http://pecl.php.net/package/ssh2" rel="nofollow">http://pecl.php.net/package/ssh2</a></li> </ul> <blockquote> <p>phpize</p> <p>./configure --with-ssh2</p> <p>make</p> <p>make install</p> </blockquote> <ul> <li>got a ssh2.so file again, added it to the relevant php.ini, restarted server and it still doesn't work.</li> </ul> <p>Sorry if this has too much detail, hopefully the information I gave can point what I'm doing wrong; I would really appreciate any solution/hint/thing to try to solve this issue.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload