Php compilation steps of the openssl module
Php
Compile
Openssl
Steps of the module
Recently, we intend to use composer in the php framework to manage dependencies. However, when executing the composer installation command (as shown below), we found that the system prompts that the openssl extension class library was not installed.
Install the composer command:
Sudocurl-s https://getcomposer.org/installer | sudo php
The exception is as follows:
Some settings onyour machine make Composer unable to work properly. Make sure thatyou fix the issues listed below and run this script again: The opensslextension is missing, which means that secure HTTPS transfers areimpossible. If possible youshocould enable it or recompile php with -- with-openssl |
This exception should be caused by the absence of the-with-openssl option during php compilation. However, when searching for related questions on the Internet, we found that we do not need to re-compile the php environment. we can use phpize to compile only the openssl. so file and add the file to the php. ini file.
1.Environment
1) Operating system:
Linuxubuntu 3.20.- 24-generic # 46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014x86_64 x86_64 x86_64 GNU/Linux
2) php source code directory:
/Home/wuguowei/software/php-5.5.14_source
3) php compiled Directory:
/Home/wuguowei/software/php5.5
2.Procedure
#Copy from source directoryOpensslDirectory to the compiled directory file
Sudocp-r/home/wuguowei/software/php-5.5.14_source/ext/openssl/home/wuguowei/software/php5.5/include/php/ext
#EnterPhpIn the compiled target file
Cd/home/wuguowei/software/php5.5/include/php/ext
#Execute the following code in sequence:
/Home/wuguowei/software/php5.5/bin/phpize
./Configure -- with-openssl? With-php-config =/home/wuguowei/software/php5.5/bin/php-config
Make & make install
#FindPhp. iniFile (usually in/Etc/php. in) In"DynamicExtensions", Add"Extension = openssl. so"
#RestartPhpServer
#View the compiledOpensslMethod
Php-I | grep 'openssl'
The correct result is as follows:
Root @ ubuntu:/home/wuguowei/software/composer # php-I | grep openssl Openssl OLDPWD =>/home/wuguowei/software/php5.5/include/php/ext/openssl _ SERVER ["OLDPWD"] =>/home/wuguowei/software/php5.5/include/php/ext/openssl |
#ViewPhpWhere is the command?
Whereis php
Which php