Detailed explanation of how to install php curl extension on linux

藏色散人
Release: 2023-03-02 13:04:01
Original
2606 people have browsed it

How to install the php curl extension on Linux: First download PHP to the server and decompress it; then call the phpize program to generate the compiled configuration file; then compile and install; finally modify the "php.ini" file and restart "php- fpm" will do.

Detailed explanation of how to install php curl extension on linux

Installing PHP’s curl extension under Linux

I encountered such a problem during development today, how to When installing PHP's curl extension under Linux, my LNMP environment was originally compiled and installed, not installed using YUM.

My environment:

Linux: CentOs 6.4

PHP: 5.6.30

Solution:

1. Enter PHP The source code directory is the address where PHP was previously downloaded to the server and decompressed

cd /usr/local/src/php-5.6.30
Copy after login

2. Perform ext/curl

cd ext/curl
Copy after login

3 in the PHP source code directory. Call the phpize program to generate the compilation configuration file

/usr/local/php/bin/phpize
Copy after login

4. Call configure to generate the Makefile

./configure --with-curl=/usr/local/curl --with-php-config=/usr/local/php/bin/php-config
Copy after login

5. Compile and install

make & make install
Copy after login

At this time, you will be prompted to generate the path of the file curl.so:

/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/
Copy after login

6. Modify the php.ini file

vim /usr/local/php/lib/php.ini
extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/curl.so
Copy after login

7. Check

/usr/local/php/bin/php -m
Copy after login

If you see a curl item, the installation is successful

8. Restart php-fpm

pkill -9 php-fpm
./sbin/php-fpm
Copy after login

OK!

For more related knowledge, please visit PHP Chinese website!

The above is the detailed content of Detailed explanation of how to install php curl extension on linux. 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!