SSL,SSH Support for lamp PHP

Source: Internet
Author: User

PHP supports SSL,ssh extension:

Ready: PHP can be successfully parsed

installation of 1.curl

[[Email protected]~]# cd/usr/local/src/

[Email protected]~]# wget https://curl.haxx.se/download/curl-7.47.1.tar.gz

[Email protected]~]# tar zxvf curl-7.47.1.tar.gz

[[Email protected]~]# CD curl-7.47.1

[[Email protected]~]#./configure--with-ssl--with-libssh2

Appears:configure:error:libSSH2 libs and/or directories were not found where specified!

[email protected]]# Yum install Libssh2 libssh2-devel

[[Email protected]~]#./configure--with-ssl--with-libssh2

Curl version:7.47.1

Host Setup:x86_64-pc-linux-gnu

Install prefix:/usr/local

compiler:gcc

SSL support:enabled (OpenSSL)

SSH support:enabled (libSSH2)

At this point SSL,ssh has been enabled.

Lamp 's php Installation:

[[Email protected]~]# CD php-5.1.14

[Email protected]~]#/configure--prefix=/usr/local/php--WITH-APXS2=/USR/LOCAL/APACHE2/BIN/APXS-- With-config-file-path=/usr/local/php/etc--with-mysql=/usr/local/mysql--with-mysqli=/usr/local/mysql/bin/mysql_ Config--with-libxml-dir--with-gd--with-jpeg-dir--with-png-dir--with-freetype-dir--with-iconv-dir-- With-zlib-dir--with-bz2--with-openssl--with-mcrypt--enable-soap--enable-gd-native-ttf--enable-mbstring-- Enable-sockets--enable-exif--disable-ipv6--with-curl--with-openssl--with-zlib-dir--enable-ftp

[[Email protected]~]# make

If a [sapi/cli/php] error occurs

Perform:

[Email protected]~]# make zend_extra_libs= '-liconv '

[Email protected]~]# ln-s/usr/local/lib/libiconv.so.2/usr/lib64/

[[Email protected]~]# make install

[Email protected]~]# CP Php.ini-production/usr/local/php/etc/php.ini

[[Email protected]~]# Vim/usr/local/php/etc/pnp.ini

Remove this line of annotations and change to Data.timezone = Asia/shanghai

Installing LIBSSH2 libraries and SSH2

[[Email protected]~]# cd/usr/local/src/

[Email protected]~]# wget http://www.libssh2.org/download/

[Email protected]~]# wget HTTP://PECL.PHP.NET/PACKAGE/SSH2

[Email protected]~]# tar-zxvf libssh2-1.4.2.tar.gz

[[Email protected]~]# CD libssh2-1.4.2

[[Email protected]~]#./configure--PREFIX=/USR/LOCAL/LIBSSH2

[[Email protected]~]# make && make install

[Email protected]~]# tar-zxvf ssh2-0.12.tgz

[[Email protected]~]# CD ssh2-0.12

[Email protected]~]#./configure--prefix=/usr/local/ssh2--WITH-SSH2=/USR/LOCAL/LIBSSH2--with-php-config=/usr/ Local/php/bin/php-config

[[Email protected]~] #make && make install

[Email protected]~]# CP modules/ssh2.so/usr/lib64/php/modules/

[[Email protected]~]# Vim/usr/local/php/etc/php.ini

Add one line: extension=ssh2.so

[Email protected]~]#/usr/local/php/sbin/php-fpm-i|grep SSH2

Appears: Content is configured successfully

[[Email protected]~]# vim/data/www/3.php

<?php

$user = "root";

$pass = "Li";

$connection =ssh2_connect (' 192.168.1.111 ', 22);

Ssh2_auth_password ($connection, $user, $pass);

$cmd = "ls";

$ret =ssh2_exec ($connection, $cmd);

Stream_set_blocking ($ret, true);

Echo (Stream_get_contents ($ret));

?>

[Email protected]~]#/usr/local/apache2/bin/apachectl Restart

Visit http://192.168.1.106/3.php

ssh execution is successful!!!

Problems that may occur:

The PHP version does not match the version of the SSH extension and requires an updated version.

SSL,SSH Support for lamp PHP

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.