Solved

PHP and CURL

Posted on 2006-07-11
8
649 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:RQuadling
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:RQuadling
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
 

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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 40

Expert Comment

by:RQuadling
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:
RQuadling 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to create an extensible mechanism for linked drop downs.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

744 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

10 Experts available now in Live!

Get 1:1 Help Now