Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 660
  • Last Modified:

PHP and CURL

pls i need a step by step information on how to install PHP with CURL(as in make PHP work with CURL)
as i have been reading so many articles and i don't seem to get it to work because i don't understand what they usually meant.
i have
PHP 4.4.1 and libcurl 7.15.3

thanks
0
xavier45
Asked:
xavier45
  • 4
  • 4
1 Solution
 
Richard QuadlingSenior Software DeverloperCommented:
What OS are you using? For Windows, edit your php.ini (or equivalent) and remove the ; in from of ;extension=php_curl.dll

Restart your web server.

From the manual for other OS.

In order to use PHP's CURL functions you need to install the libcurl package (which you've got, but not sure if it is installed correctly - make sure you follow libcurl's installation instructions - do they provide a test script to prove installation is successful?). PHP requires that you use libcurl 7.0.2-beta or higher. In PHP 4.2.3, you will need libcurl version 7.9.0 or higher. From PHP 4.3.0, you will need a libcurl version that's 7.9.8 or higher. PHP 5.0.0 requires a libcurl version 7.10.5 or greater.

Your version is OK.

To get curl active within *ix, you need to compile PHP. Again, from the manual ...

To use PHP's CURL support you must also compile PHP --with-curl[=DIR] where DIR is the location of the directory containing the lib and include directories. In the "include" directory there should be a folder named "curl" which should contain the easy.h and curl.h files. There should be a file named libcurl.a located in the "lib" directory. Beginning with PHP 4.3.0 you can configure PHP to use CURL for URL streams --with-curlwrappers.

Note to Win32 Users:
In order to enable this module on a Windows environment, libeay32.dll and ssleay32.dll must be present in your PATH.  You don't need libcurl.dll from the CURL site.



0
 
xavier45Author Commented:
i'm on Win XP Pro and i after doing what you adviced i get this error when i try to open a PHP page that uses CURL

Fatal error: Call to undefined function: curl_init() in C:\Program Files\xampp\htdocs\grabgmail\GrabGmail.class.php on line 162

pls help
0
 
Richard QuadlingSenior Software DeverloperCommented:
If your php directory is NOT in your path - add it. This makes EVERYTHING a LOT easier.

RIght click "My Computer" and choose Properties|Advanced|Environment Variables|System Variables|Path|Edit

I use PHP a LOT!!!!, so my path is ...

C:\BATCH;C:\PHP5;C:\PEAR;C:\Program Files\WinRAR;C:\PKWare;D:\SAGE\UTILS;C:\Program Files\Microsoft SQL Server\80\Tools\BINN;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;D:\Data\Web Sites\Quick Scripts\public_html;C:\Program Files\Support Tools\;C:\Program Files\Windows Resource Kits\Tools\;D:\cygwin\bin;C:\Essbase\bin;C:\Program Files\Intel\DMIX;D:\Program Files\InVu\;C:\Program Files\QuickTime\QTSystem\

I have C:\PHP5 near the front of the path. Just do. You don't need to if you just want to add it to the end.


Having saved that open a cmd prompt.

Type PATH [enter] just to make sure PHP is in the path.

If you are using a different directory then make sure you add that directory!

At the cmd prompt type

C:\>php -i | find "Configuration File" [enter]

This will return something like ...

Configuration File (php.ini) Path => C:\WINDOWS\php-cli.ini

The file (C:\window\php-cli.ini) could be anywhere/anything.

Edit that file and check that extension=php_curl.dll has no ; in front of it.

Save file.

Back at the cmd prompt type

C:\>php -m [enter]

You will get back something like ...

[PHP Modules]
bcmath
calendar
com_dotnet
ctype
curl
date
dom
ftp
gd
hash
iconv
libxml
mhash
mssql
odbc
pcre
Reflection
session
SimpleXML
SPL
standard
tidy
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
xsl
zlib

[Zend Modules]
Zend Extension Manager


The actual list will depend upon your settings.

If you see curl there, then PHP managed to load the curl library and the functions are available.

If you get ANY error or CURL is not present, then let me know.

This is working, so far, at the cli version of windows.

Now create a file called info.php containing

<?php phpinfo(); ?>

And save that in your webroot somewhere.

Open your browser and open the info.php

Look for "Configuration File" and curl. See if the same config file is used (I use different ones for CLI/FCGI/CGI/ISAPI).

If you are using the same config file and curl is NOT present, restart your web server. Then recheck.

At this stage, any errors would be important.

Let me know.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
xavier45Author Commented:
i couldn't get it to work because i'm lost

i did this "RIght click "My Computer" and choose Properties|Advanced|Environment Variables|System Variables|Path|Edit" and added this "C:\Program Files\xampp\php(thats my php installation dir)" but when i get to the command prompt it does not display that as part of the PATH items.

pls help
0
 
Richard QuadlingSenior Software DeverloperCommented:
Really!

You MAY need to reboot. I've never done so. Also, the change on affects NEW command prompt windows. Open ones CAN get the new environment, but I don't know how other than closing the program and then re-running it.
0
 
xavier45Author Commented:
ok i was able to go pass all that now and cmd loaded all the modules including curl but when i get to the phpinfo page i could not find curl anywhere on that page(even after restarting my webserver).
0
 
Richard QuadlingSenior Software DeverloperCommented:
And is the config file you edited the same one as is seen by the phpinfo() ?

And daft question, is YOUR pc also the webserver?
0
 
xavier45Author Commented:
i ngot it working now...
the problem is from me(or should i say from xampp - for placing the php config file in the apache bin dir)
like i said earlier i use XAMPP and while i was busy editing and updating the PHP config file in the PHP dir, little did i know the config file is in the APACHE bin dir.

it was earlier this morning that i check their website at apachefriends.com and found out about it from the FAQ section.

who reads the manual these days -:)

anyway thanks guyz...so much
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now