Install the necessary packages before you can build/install ssh2 extension
yum install gcc php-devel php-pear libssh2 libssh2-devel make
Install the extension, (hit enter for autodetect when it prompts you)
pecl install -f ssh2
Once the install is completed, you just have to tell PHP to load the extension when it boots.
echo extension=ssh2.so > /etc/php.d/ssh2.ini
Restart your webserver and test to see if the changes took effect.
service httpd restart
You can check it installed with the following command
php -m | grep ssh2
When I ran "pecl install -f ssh2" it gave me following error:
ReplyDelete"PHP Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 3200 bytes) in /usr/share/pear/pearcmd.php on line 66
"
Should I change the value of pearcmd.php?
I doesnt got this i installed all and succs :)
DeleteThank you. It's good to know that I probably didn't leave something out.
DeleteI have not come across this problem. Did you manage to find out what was wrong? Has anyone else had the same problem? If so please leave a comment.
ReplyDeleteGood tutorial!!!! Tout a marché comme sur des roulettes.
ReplyDeleteWorked for me Centos 6.4 x64. Many Thanks
ReplyDeleteThanks for letting me know :)
DeleteWhen I run "pecl install -f ssh2", I've got this message:
ReplyDeleteNo releases available for package "pecl.php.net/ssh2"
install failed
Do you know what could be happening?
worked on centos 6.4 x64! Thanx!
ReplyDeleteThis line (touch /etc/php.d/ssh2.ini) gives the error "touch: cannot touch `/etc/php.d/ssh2.ini': No such file or directory" on centOS 6.4 x64 for me. However, if I skip that and check it (php -m | grep ssh2) it comes back with "ssh2".
ReplyDeleteThat touch command was redundant anyways as the echo command should create the file if it does not exist already and because there is a single > instead of two >>, then it replaces the file. I don't know why you got that error message. Are you not running as a subuser instead of root? Glad it's working anyway.
DeleteHi,
ReplyDeleteWhen i try to test if its installed successfully by
php -m | grep ssh2
I get
PHP Syntax Error: Unexpected '(' in /etc/php.d/ssh2.ini on line 37
What could be reason for this? Thanks for looking into this.
have you found a solution to your problem ?
Deletei use centos 7, it's work. thank for the guide.
ReplyDeleteThanks!!!!!!!!!!!!I need it!!!!!!!!!!!!
ReplyDeleteCentos 6.7.Work!
This helped me a lot on Centos 6.8 Thanks!
ReplyDeleteThis helped me on Centos 6.8 Thanks!
ReplyDeleteThank you so much, successful on Centos 6.9
ReplyDeleteWhere can i do find phpize????
ReplyDelete[root@servac etc]# pecl install -f ssh2
downloading ssh2-0.13.tgz ...
Starting to download ssh2-0.13.tgz (28,984 bytes)
.........done: 28,984 bytes
6 source files, building
running: phpize
sh: phpize: command not found
ERROR: `phpize' failed
[root@servac etc]# yum install php-devel
Loaded plugins: product-id, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
puppetlabs-deps | 951 B 00:00
puppetlabs-products | 951 B 00:00
rhel | 1.1 kB 00:00
rhel-source | 2.6 kB 00:00
rhel-source-beta | 1.3 kB 00:00
rhel-updates | 951 B 00:00
No package php-devel available.
Error: Nothing to do
Hey Дмитрий Ковергин,
DeleteSorry for the late response, but I thought the phpize command would have been installed when you ran installed the php-devel package with "yum install gcc php-devel php-pear". I assume this because the PHP documentation states:
"If the system is missing the phpize command, and precompiled packages (like RPM's) are used, be sure to also install the appropriate devel version of the PHP package as they often include the phpize command along with the appropriate header files to build PHP and its extensions."
- source: http://php.net/manual/en/install.pecl.phpize.php
When I enter pecl install -f ssh2 I get "-bash: pecl: command not found"
ReplyDeleteSounds to me like pecl was not installed. What is your output if you run the first command again:
Deleteyum install gcc php-devel php-pear libssh2 libssh2-devel make
THis stack overflow post on troubles installing pecl in centos may be helpful: https://stackoverflow.com/questions/19517095/struggling-to-install-php-pecl-on-centos
This is what I get:
DeletePackage gcc-4.4.7-18.el6.x86_64 already installed and latest version
No package php-devel available.
No package php-pear available.
Package libssh2-1.4.2-2.el6_7.1.x86_64 already installed and latest version
Package libssh2-devel-1.4.2-2.el6_7.1.x86_64 already installed and latest version
Package 1:make-3.81-23.el6.x86_64 already installed and latest version
When I enter "pecl install -f ssh2" I get "-bash: pecl: command not found"
ReplyDeleteHi,
ReplyDeleteWhen i try to test if its installed successfully by
php -m | grep ssh2
I get
PHP Syntax Error: Unexpected '(' in /etc/php.d/ssh2.ini on line 37
What could be reason for this? Thanks for looking into this.
Thanks a lot!! I follow your instruction step by step , and successfully installed!!
ReplyDeletePS. I also modify php.ini