How to add extensions to PHP5.6 in Linux environment?

WBOY
Release: 2016-07-06 13:51:37
Original
1435 people have browsed it

I recently started to prepare to learn to use Composer. During the installation, I found that PHP needs to enable the php_openssl extension. When I tried to extend it, I was prompted with the message "cannot find config.m4". I also searched on Baidu but still couldn't solve it.

How to add extensions to PHP5.6 in Linux environment?

After searching on Baidu, most of the answers were to find config0.m4 and then rename it to config.m4. However, I searched and still didn’t find this file. I also searched for documents on the official website and thought that the package I downloaded was wrong.

Can anyone help me figure out the reason?

Reply content:

I recently started to prepare to learn to use Composer. During the installation, I found that PHP needs to enable the php_openssl extension. When I tried to extend it, I was prompted with the message "cannot find config.m4". I also searched on Baidu but still couldn't solve it.

How to add extensions to PHP5.6 in Linux environment?

After searching on Baidu, most of the answers were to find config0.m4 and then rename it to config.m4. However, I searched and still didn’t find this file. I also searched for documents on the official website and thought that the package I downloaded was wrong.

Can anyone help me figure out the reason?

The problem has been found. When I compiled and installed it myself, the ext folder in the compilation directory was not moved with --prefix=/usr/local/php, so I could not find those extensions. Thank you everyone.

You can compile and install this dependency

<code>sudo wget -O m4-1.4.9.tar.gz http://ftp.gnu.org/gnu/m4/m4-1.4.9.tar.gz
sudo tar zxvf m4-1.4.9.tar.gz 
cd m4-1.4.9/
./configure 
make
sudo make install</code>
Copy after login

First check if your extension_dir has this extension. If so, just enable it

If not, download the source code of php5.6, unzip the source code, and switch to the PHP source code directory
Follow the following steps to install. You need to change the path according to your own environment

cd ext/openssl
/usr/local/php5.6/bin/phpize
./configure --with-php-config=/usr/local/php5.6/bin/php-config

make
make install

Add configuration in php.ini
extension=openssl.so

Have you installed autoconf?

For Linux novices, it is always recommended to use the system’s package management tool to install PHP and various extensions:

CentOS default source is relatively old, please refer to: https://webtatic.com/packages/php55/
Ubuntu default source can basically be used directly, just sudo apt-get install php5 and that’s it

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template