Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I recently compiled php 5.4 from source. I have Centos 6. I used this configuration:

# ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql
# make
# make install
# cp php.ini-dist /usr/local/lib/php.ini

I realize now that I do not have cURL installed. I don't know how to install cURL after a compiled installation of php. Using yum install php-curl installs cURL for php 5.3. I tried this already with an apache restart and it did not show up on my phpinfo file.

How do I install cURL under these circumstances?

share|improve this question
    
As you have the chosen to go the way of self-compiling you will have to stay with that. So, download the source package and compile it. –  Thomas Berger Oct 12 '12 at 20:24

1 Answer 1

Reinstall

As you've install PHP from source, you'll need to recompile PHP to include CURL.

# Return to PHP source directory
sh ~> cd /path/to/php/src

# Clean previus build
sh ~> make clean

# Configure with CURL
sh ~> ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-curl

# Compile & Reinstall PHP
sh ~> make
sh ~> sudo make install

Enable CURL without re-installing

Another option would be to build a shared-object CURL extension, and enable it within your php.ini file. The configuration format for PHP shared-object follows --with-<name>=shared,<path-to-lib>. Repeat the make clean step, and use the following configuration flags:

# Configure CURL for shared object ( you may need to use --with-curl=shared,/usr )
sh ~> ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-curl=shared

# Compile
sh ~> make

# Copy shared-object to php extensions (paths may differ)
sh ~> sudo cp -p modules/curl.so /usr/local/lib/php/extensions/no-debug-non-zts-BUILD_ID/curl.so

# Enable CURL into systems php.ini
sh ~> sudo echo 'extension=curl.so' >> /usr/local/lib/php.ini

Test

Easiest way to test if curl is enabled

# List all PHP modules & filter on CURL
sh ~> /usr/local/bin/php -m | grep curl
curl
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.