Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enabling/Installing Curl Extension (OSX Server/PHP 5.3.3/Apache 2.2)

Tags:

php

macos

apache

I've been having some trouble getting CURL working with PHP on a server I inherited.

So far I have enabled the extension in my php.ini by uncommenting the extension=php_curl.dll line, and restarting apache.

However, I now receive the following error when starting PHP:

PHP Warning: PHP Startup: Unable to load dynamic library '/opt/local/lib/php/extensions/php_curl.dll

The php_curl.dll file doesn't exist in the aforementioned directory, and I can't find anywhere legitimate to download it from(doesn't seem to be included in PHP, or Curl).


UPDATE
Following the steps provided in the answer here, I was able to compile a new php_curl.so file and install it to the extensions directory.

Cudos go to Francois Deschenes!!

To compile a curl.so (php_curl.dll) module from scratch:

  1. Download and extract a new copy of your version of PHP.
  2. Open a terminal window and go to the curl directory (Type cd php-5.3.3/ext/curl/).
  3. Type phpize.
  4. Type ./configure.
  5. Type make.
  6. Type sudo make install.
  7. Uncomment extension=curl.so in your php.ini.

You should also make sure the extension is commented out before you start the processes, otherwise you may receive an error about the module already existing.


like image 248
Jeemusu Avatar asked Jun 28 '12 09:06

Jeemusu


2 Answers

Why don't use

sudo port install php5-curl 

(on php54: php54-curl)?

like image 121
Sándor Tóth Avatar answered Oct 25 '22 04:10

Sándor Tóth


Download the 'port' using the following URL and install it:

http://www.macports.org/install.php

There are different versions and you can select one installation pack for your Mac Version.

After installed, open a terminal and type the following command to install directly,

$ sudo port install php5-curl 

Otherwise - Login to port terminal by just typing

$ sudo port

and type

> install php5-curl

It will get few minutes to install all the dependancies and finally you will see the following message

--->  No broken files found.
like image 24
Harsha Avatar answered Oct 25 '22 04:10

Harsha