Home > Article > Backend Development > How to install curl extension in linux php
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.
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 #
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!