Solved

PHP and CURL

Posted on 2006-07-11
8
651 Views
Last Modified: 2013-12-12
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
Comment
Question by:xavier45
  • 4
  • 4
8 Comments
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 17088468
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
 

Author Comment

by:xavier45
ID: 17105600
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
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 17106592
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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 

Author Comment

by:xavier45
ID: 17112965
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
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 17115611
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
 

Author Comment

by:xavier45
ID: 17118575
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
 
LVL 40

Accepted Solution

by:
Richard Quadling earned 250 total points
ID: 17120834
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
 

Author Comment

by:xavier45
ID: 17126400
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now