• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3391
  • Last Modified:

Enable cURL in PHP

My mandrake linux server running with php apache mysql, all are working fine now. I installed curl rpm succesfully. But curl module is not enabled in php if I look on phpinfo.php. any one help me to enable curl in php. I do see some documents that saying I need to compile PHP with curl.  But PHP is already installed and running fine now. If I compile php will it effect on other applications like Mysql,Postgresql,sendmail etc...Please let me get a solution to enable curl in php.
Thanks in advance.
0
tstName
Asked:
tstName
  • 6
  • 5
1 Solution
 
Richard QuadlingSenior Software DeveloperCommented:
Hi tstName,


Do you have a PHP.INI (or equivalent) file? If so look for ;ext=php_curl.dll and remove the ; You may need to restart the web server.

Regards,

Richard Quadling.
0
 
tstNameAuthor Commented:
Hi Richard Quadling,

The server is a mandrake linux server so I think dll will not play in this.
0
 
Richard QuadlingSenior Software DeveloperCommented:
Ah. No. But then again. I just realised that you have compiled curl into PHP. I just activate curl by editing the ini file. Sorry. No dufus brain not on.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
Richard QuadlingSenior Software DeveloperCommented:
Ah. I see the issue.

CURL is an external library/application.

To get CURL accessible from PHP, you need to compile PHP with the library.

From the PHP 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.




Once you've recompiled PHP to include the CURL library, phpinfo(); should show the module and its state/version.

Compiling PHP will not affect other applications (normally) unless you forget to include a module (--with-xxxx) which is required for comminication.

From what I've seen of PHP on *ix, the phpinfo(); gives your current ./configure line. Use that and then add the CURL options to add CURL to PHP>
0
 
tstNameAuthor Commented:
Hi  Richard Quadling,

Thanks for the help. can you please tell me what are the steps to recomplie php. I do not need to upgrade php version.
 here the configuration options from phpinfo

'./configure' '--host=i386-redhat-linux' '--build=i386-redhat-linux' '--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--enable-force-cgi-redirect' '--disable-debug' '--enable-pic' '--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--with-db3'  '--with-dom=/usr' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-gd' '--enable-gd-native-ttf' '--with-ttf' '--with-gdbm' '--with-gettext' '--with-ncurses' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png' '--with-pspell' '--with-regex=system' '--with-xml' '--with-expat-dir=/usr' '--with-zlib' '--with-layout=GNU' '--enable-bcmath' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-discard-path' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--without-oci8' '--with-pear=/usr/share/pear' '--with-imap=shared' '--with-imap-ssl' '--with-kerberos=/usr/kerberos' '--with-ldap=shared' '--with-mysql=shared,/usr' '--with-pgsql=shared' '--with-snmp=shared,/usr' '--with-snmp=shared' '--enable-ucd-snmp-hack' '--with-unixODBC=shared' '--enable-memory-limit' '--enable-bcmath' '--enable-shmop' '--enable-versioning' '--enable-calendar' '--enable-dbx' '--enable-dio' '--enable-mcal' '--with-apxs2=/usr/sbin/apxs'

thanks
0
 
Richard QuadlingSenior Software DeveloperCommented:
Because you want to add a new library to PHP, you need to compile PHP. Unfortunately, I can't help you there as I am on windows.

Though, I believe it is something like

./configure ...
make ...

But I'm not sure.

I would start by reading http://www.php.net/manual/en/install.unix.php and see what you know and don't know.

NOTE : (From the PHP Manual) ...

Prerequisite knowledge and software for compiling:

Basic Unix skills (being able to operate "make" and a C compiler)
An ANSI C compiler
flex: Version 2.5.4
bison: Version 1.28 (preferred), 1.35, or 1.75
A web server
Any module specific components (such as gd, pdf libs, etc.)

0
 
tstNameAuthor Commented:
I compiled php 4.3.3 with curl ( --with-curl=/usr ) and installed it without any error. but after restart httpd , i dont see any change in the phpinfo. I believe the installation was not success. during the make process I got the warning below,
----
Zend/zend_extensions.lo Zend/zend_hash.lo Zend/zend_list.lo Zend/zend_indent.lo Zend/zend_builtin_functions.lo Zend/zend_sprintf.lo Zend/zend_ini.lo Zend/zend_qsort.lo Zend/zend_multibyte.lo Zend/zend_execute.lo sapi/cli/php_cli.lo sapi/cli/getopt.lo main/internal_functions_cli.lo -lcrypt -lnsl -lcrypt -lintl -lcurl -lz -lssl -lcrypto -lresolv -lm -ldl -lnsl -lcurl -lz -lssl -lcrypto -ldl -lssl -lcrypto -ldl -lz -lcrypt -lcrypt  -o sapi/cli/php
ext/mysql/libmysql/my_tempnam.o(.text+0x40): In function `my_tempnam':
/home/vinod/php-4.3.3/ext/mysql/libmysql/my_tempnam.c:115: the use of `tempnam' is dangerous, better use `mkstemp'
 
Build complete.
(It is safe to ignore warnings about tempnam and tmpnam).  
-------
when I install , i got the messages,
# make install
Installing PHP SAPI module:       cgi
Installing PHP CGI into: /usr/bin/
Installing shared extensions:     /usr/lib/extensions/no-debug-non-zts-20020429/Installing PEAR environment:      /usr/share/pear/
[PEAR] Archive_Tar: Archive_Tar not installed
[PEAR] Console_Getopt: Console_Getopt not installed
requires package `Archive_Tar' >= 0.4
requires package `Console_Getopt' >= 0.11
[PEAR] PEAR: PEAR: Dependencies failed
[PEAR] DB: DB not installed
[PEAR] HTTP           - already installed: 1.2.1
requires package `Net_SMTP' >= 1.1.0
[PEAR] Mail: Mail: Dependencies failed
[PEAR] Net_SMTP: Net_SMTP not installed
[PEAR] Net_Socket: Net_Socket not installed
[PEAR] XML_Parser: XML_Parser not installed
[PEAR] XML_RPC: XML_RPC not installed
Installing build environment:     /usr/lib/php/build/
Installing header files:          /usr/include/php/
 
Installing helper programs:       /usr/bin/
  program: phpize
  program: php-config
  program: phpextdist


after I restart the httpd service, i do not see any changes.
could anyone help me

thanks in advance.

0
 
Richard QuadlingSenior Software DeveloperCommented:
As this is a CGI version, you SHOULD be able to run it from the command line.

Can you try this ...

./php -m

in the appropriate folder.
0
 
tstNameAuthor Commented:

I do see curl module listed when I use php -m. But libcurl4.so is not updated after make install any idea?
0
 
tstNameAuthor Commented:
RQuadling,

At last I solved the problem. apxs  was  in wrong place that was the problem to generate libphp4.so. But still I unable to find httpd-devel package for mandrake linux.
Thanks  for your help
0
 
Richard QuadlingSenior Software DeveloperCommented:
NP. Glad to have been just as confused as you!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

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