如何安装phpseclib? [英] How to install phpseclib?
问题描述
我已经在机器上安装了Apache,因此可以将localhost用作PHP服务器.那个有效.现在,我正在尝试使用PHP通过SFTP将文件发送到另一台服务器.我环顾四周,发现推荐了phpseclib.我似乎无法弄清楚如何安装phpseclib.这是网站提供的内容:
I have installed Apache on my machine so I can use localhost as a PHP server. That works. Right now I am trying to use PHP to send files via SFTP to another server. I looked around a bit and saw phpseclib was recommended. I can't seem to figure out how to install phpseclib. Here are the lines that the website gave:
set_include_path(get_include_path() . PATH_SEPARATOR . 'phpseclib');
include('Net/SFTP.php');
您必须设置包含路径.
You have to set the include path.
我理解这些词的意思,但是我无法使其正常工作.我正在使用Mac.我的服务器在/Users/diego/Sites/
中.我到底需要在哪里放置phpseclib
文件夹?我需要在php文件中添加哪些行,以便包含phpseclib
?
I understand what these words mean but I have been unable to get it working. I am using a mac. My server is in /Users/diego/Sites/
. Where exactly do I need to put the phpseclib
folder? What lines do I need to put in my php file so that phpseclib
is included?
推荐答案
By following the guide above, I figured out that apache2 was looking for php.ini
in my /etc/
folder. But I ran into a problem. In my /etc/
folder there was no php.ini
file. But there was php.ini.defualt
. So I 'saved as' php.ini.default
to php.ini
and then modified the include_path.
; UNIX: "/path1:/path2"
;include_path = ".:/php/includes"
include_path = ".:/Users/diego/pear/share/pear:/php/includes"
PHP不再抛出错误,指出找不到phpseclib
.
PHP is no longer throwing an error saying that phpseclib
cannot be found.
这篇关于如何安装phpseclib?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!