Home > Backend Development > PHP Problem > How to install curl extension in linux php

How to install curl extension in linux php

藏色散人
Release: 2023-03-02 09:18:01
Original
3300 people have browsed it

How to install the curl extension in linux php: first enter the php source code directory, execute phpize to generate the configuration file; then call configure to generate the Makefile; then compile and install through the command "make install"; finally open "curl.so "That's it.

How to install curl extension in linux php

Keywords:

Install php curl extension on linux

curl Related functions are undefined

Friendly link:

LAMP environment construction: https://blog.csdn.net/dong_alex/article/details/80661601
LNMP environment construction: https://blog.csdn.net/dong_alex/article/details/80712018

Many times, when installing php, not all extensions will be installed. Instead, install the required extensions on the already installed PHP according to specific needs.

For example, if the curl extension is not installed, the following error will be reported when using the curl function:

My environment: lamp environment built by linux centos7.4 php5.6 (php is run as an apache module) Custom compiled and installed, non-yum installation

Install curl:

# 
# 1. 进入php源码目录,执行phpize生成配置文件
# 切换到php源码目录下的 ext/curl/    例我的是: /root/packages/php-5.6.36/ext/curl 执行命令
cd /root/packages/php-5.6.36/ext/curl
/usr/local/php-5.6.36/bin/phpize

# 2. 调用configure生成Makefile文件
./configure --with-php-config=/usr/local/php-5.6.36/bin/php-config

# 3. 编译,并安装
make && make install

# 4. 配置php.ini 开启curl.so
extension= /usr/local/php-5.6.36/lib/php/extensions/no-debug-zts-20131226/curl.so

# 5. 重启服务器
service httpd restart

# 如果是nginx 使用的是php-fpm 重启php-fpm即可 命令: 
# kill -USR2  主进程ID (使用ps -e | grep php-fmp 可查出)

# 6. 查看 php -m 
#
Copy after login


For more related knowledge, please visit PHP Chinese website!

The above is the detailed content of How to install curl extension in linux php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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