PHP的安装SSH2在一个OSX 10.9.1 XAMPP的Apache服务器上运行 [英] Installing SSH2 for PHP to run on a Xampp Apache server on a OSX 10.9.1

查看:514
本文介绍了PHP的安装SSH2在一个OSX 10.9.1 XAMPP的Apache服务器上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Mac上运行Xampp时与OS X 10.9.1,我试图开发一个网页,通过Ajax调用调用PHP脚本。 XAMPP是这里用于开发目的,并且不打算以形成在线页面的后端

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.

一个PHP脚本需要尽管SSH连接到远程机器,原因我结果
计划使用SSH2库。当我尝试运行命令:

A PHP script needs to connect though ssh to a remote machine, reason for which I
plan to use the ssh2 library. When I try to run the commands:

$连接= ssh2_connect('my.remote.machine.address',5432);

$connection = ssh2_connect('my.remote.machine.address', 5432);

我收到以下错误:

致命错误:调用未定义的函数ssh2_connect()在/Applications/XAMPP/xamppfiles/htdocs/Project/getdata.php第8行

Fatal error: Call to undefined function ssh2_connect() in /Applications/XAMPP/xamppfiles/htdocs/Project/getdata.php on line 8

和,通过调用'的phpinfo()',SSH2似乎并没有安装。我成功地设法在Windows上使用,Ubuntu和Linux的科学和ssh2_connect一个星期后,我似乎无法弄清楚,我不是在OSX我怀疑做正确的有可能是用碎路径或与Apache交互的问题服务器OSX带着。以下是我曾尝试:

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:

我。在MacPorts的和PECL方法(参考: http://lassebunk.dk/2011/05/26/installing-ssh2-for-php-on-mac-os-x/ ):

I. The MacPorts and PECL method (reference: http://lassebunk.dk/2011/05/26/installing-ssh2-for-php-on-mac-os-x/):


  • 的东西已经在我的电脑上:X code(从网上商店),MacPorts的(安装在他们的网站),PHP 5.4.17显然自带的OSX,我不得不停止Apache服务器:

须藤apachectl中停止

sudo apachectl stop

让XAMPP的一个能用的​​。

so that the Xampp one worked.


  • 运行命令:

sudo的港口安装libssh2

sudo port install libssh2

作为libssh2和OpenSSL库prerequisites使用ssh2_connect在PHP(参考:的 http://www.php.net/manual/en/ssh2.requirements.php ); OpenSSL的似乎已经安装对于Xampp的根据phpinfo()函数。

as the libssh2 and openssl libraries are prerequisites to using ssh2_connect in php (reference: http://www.php.net/manual/en/ssh2.requirements.php); openssl appears to be already installed on Xampp's according to phpinfo().


  • 安装梨:

sudo的PHP /usr/lib/php/install-pear-nozlib.phar

sudo php /usr/lib/php/install-pear-nozlib.phar


  • 安装家酿(否则'PECL安装命令失败):

红宝石-e$(卷曲-fsSL https://raw.github.com / mxcl /自制软件/去/安装

ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)"


  • RAN:

酿造安装的autoconf

brew install autoconf


  • 现在,我终于能够运行:

$ sudo的PECL安装ssh2-0.12

$ sudo pecl install ssh2-0.12

以/选择/本地为preFIX

with "/opt/local" as prefix


  • 现在,我得到了一个不错的ssh2.so文件,我添加到相关的php.ini:

/应用/ XAMPP / xamppfiles的/ etc

/Applications/XAMPP/xamppfiles/etc

通过添加一行:

扩展= /选择/ local / lib目录/ php54 /扩展/无调试非ZTS-20100525 / ssh2.so

extension=/opt/local/lib/php54/extensions/no-debug-non-zts-20100525/ssh2.so


  • 重新开始从出现且Xampp和SSH2仍然未找到GUI XAMPP的Apache Web服务器。

二。编译从终端方法(参考ssh2.so:zizifu的评论的http:// www.php.net/manual/en/ssh2.installation.php ):

II. The compile the ssh2.so from the terminal method (reference: zizifu's comment http://www.php.net/manual/en/ssh2.installation.php):

  • got the libssh2 archive from http://libssh2.org/ and:

./配置

请安装

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆