john-charles
john-charles

Reputation: 1469

How do I get php curl to run on my apache2.x Development server?

Before I begin, I will add that I've spent much time googling this and have attempted several solutions none of which have worked.

System Info:

Windows 7 Professional (x86, 32 bit )

Apache2 up and running C:\Program Files\Apache Software Foundation\Apache2.2\

PHP 5.3.8 C:\Program Files\PHP Also works. manually configured httpd.conf to enable php, note that php is working, except for curl.

I have enabled curl in my php.ini C:\Program Files\PHP\php.ini

This is near the end of my php.ini

[PHP]   
extension_dir = "ext"  
[PHP_CURL]  
extension=php_curl.dll

Note also that the file C:\Program Files\PHP\ext\php_curl.dll exists!

I have restarted the apache server and yet curl still does not function.

a quick test.php file:

<?php 

$curl_conn = curl_init();

?>

note that I have both php start and end tags correct stackoverflow just isn't showing the start php tag. puts out: Fatal error: Call to undefined function curl_init() in E:\path\to_project\test.php on line 3

I have now spent 3 hours trying to get curl to work, google has no helped, most of the solutions seem to involve making sure that the extension=module line in php.ini is not commented out, and as you can see above it is not commented out so that advice doesn't seem to help me.

Any ideas would be appreciated as this is rather frustrating. Thanks!

Upvotes: 2

Views: 2994

Answers (3)

Jeff S.
Jeff S.

Reputation: 11

I know this thread has long been closed, but for anyone like myself who encounters this problem subsequently, for me, the answer turned out to be a DIFFERENT copy of the php.ini file was being loaded than what I thought. I was editing the php.ini file in my PHP 5.4.3 directory, and there is another copy of the php.ini file that resides in the Apache directory - identical as far as I could tell from a quick glance.

De-commenting the extension=php_curl.dll line IN THE RIGHT FILE, the Apache folder, enabled the curl function for me.

Jeff S.

Upvotes: 1

pachox
pachox

Reputation: 11

You should add "C:\PHP" to the server's PATH environment variable:

  1. Right-click on My Computer, choose Properties
  2. Flip to the Advanced tab
  3. Click the Environment Variables button
  4. Double-click the Path variable in the list of System variables.
  5. Either add "C:\PHP;" to the beginning or ";C:\PHP" to the end (sans quotes, not both).
  6. Restart your computer for it to take effect.

Thanks to:

http://www.webcheatsheet.com/PHP/install_and_configure.php

Upvotes: 1

sp1111
sp1111

Reputation: 798

Have you copied cURL dependency files:

  libeay32.dll
  ssleay32.dll

to C:\Windows\System32 folder?

It could be that PHP cannot find these two files to run cURL extension.

Upvotes: 0

Related Questions