PHP add OpenSSL extension

Source: Internet
Author: User
Tags openssl zend

When installing the Laravel frame using composer, the system prompts that OpenSSL support is not turned on.
After the php.ini opened the OpenSSL but still not, and later ran Phpinfo () found
The OpenSSL extension is not installed at all, using php-i to view the options when compiling PHP, there is really no
Add--with-openssl, if recompile php again feel very troublesome, later online find information, found
You can add extensions without recompiling php.

Here is the note to add the OpenSSL module for PHP, which is really convenient, so it is necessary
Record it

System environment:
PHP 7.1.9

PHP Installation path:
/usr/local/php


First step: Find the same source code package as the version of PHP installed, (use PHP--version to view the PHP version)
If there is a source code package, direct decompression, no online download the same version and then unzip.
Use command: TAR-ZXVF xxxx.tar.gz

The second step: Enter the extracted directory, you will see an ext directory, enter the directory, which has a OpenSSL directory, as shown in

Step three: Enter the OpenSSL directory and execute the following command

1[Email protected] openssl]#/usr/local/php/bin/phpize//depending on your installation environment, find yourself installing phpize in PHP2CannotFindConfig.m4.//Tip The Config.m4 file cannot be found, perform the following MV Operation3Make sure this you run'/usr/local/php/bin/phpize' inchThe top level source directory of the module4 5[Email protected] openssl]#ls6 config0.m4 config.w32 CREDITS openssl.c openssl.mak php_openssl.h README tests XP_SSL.C7[Email protected] openssl]#MVCONFIG0.M4 CONFIG.M4//Rename the config0.m4 in the directory directly to CONFIG.M48[Email protected] openssl]#/usr/local/php/bin/phpize//Execute once more9Configuring for:TenPHP Api Version:20160303 OneZend Module Api No:20160303 AZend Extension Api No:320160303

Fourth step: After performing the above steps, you will see that the Configure file is generated in the OpenSSL directory, as

Then execute the following command:

1[Email protected] openssl]#/configure--with-openssl--with-php-config=/usr/local/php/bin/php-Config2Checking for grepthat handlesLongLines And-e .../bin/grep3Checking for Egrep.../bin/grep-E4Checking forAsedThat does not truncate output .../bin/sed5Checking for cc...cc6Checking forC compiler default outputfilename ... a.out7 ...8...//part of the execution process is omitted here9 Ten  One //After the Configure is finished, make compiles and some of the code is as follows: A[Email protected] openssl]# Make -/bin/SH/usr/src/lamp/php-7.1.9/ext/openssl/libtool--mode=compilecc-I.-i/usr/src/lamp/php-7.1.9/ext/openssl-dphp_atom_inc-i/usr/src/lamp/php-7.1.9/ext/openssl/include-i/usr/src/lamp/php-7.1.9/ext/openssl/main-i/usr/src/lamp/php-7.1.9/ext/openssl-i/usr/local/php/include/php-i/usr/local/php/include/php/main-i/usr/local/php/include/php/tsrm-i/ usr/local/php/include/php/zend-i/usr/local/php/include/php/ext-i/usr/local/php/include/php/ext/Date/lib-dhave_config_h-g-o2-c/usr/src/lamp/php-7.1.9/EXT/OPENSSL/OPENSSL.C-o Openssl.lo - mkdir. Libs the  cc-I.-i/usr/src/lamp/php-7.1.9/ext/openssl-DP - ... -...//part of the execution process is omitted here -  + //when the make compilation process finishes, perform the make install installation process -[Email protected] openssl]# Make Install +Installing Shared extensions:/usr/local/php/lib/php/extensions/no-debug-zts-20160303///The directory location of the generated openssl.so file depends on your PHP environment

Fifth step: Edit the php.ini file

vim/usr/local/php/etc/php.ini// turn on extension_dir option and specify extension file directory //  The default configuration file is as follows: extension_dir='./'// Open and configure as shown below extension_dir=  '/usr/local/php/etc/extension'   // own designation

As shown

Sixth step: Copy the openssl.so file in step fourth to the directory specified in Extension_dir in step fifth, as shown in

Seventh Step: Edit the php.ini file, open the OpenSSL extension, add the following code at the end of the php.ini file

1 extension=openssl.so

Save and exit, restart Apache, test as shown to indicate success

PHP add OpenSSL extension

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.