Diego Diego - 7 months ago 468
PHP Question

How to install 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.


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?

Answer

I got it working by installing PEAR, following this guide.

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 is no longer throwing an error saying that phpseclib cannot be found.

Comments