Link to home
Start Free TrialLog in
Avatar of tstName
tstName

asked on

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.
Avatar of Richard Quadling
Richard Quadling
Flag of United Kingdom of Great Britain and Northern Ireland image

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.
Avatar of tstName
tstName

ASKER

Hi Richard Quadling,

The server is a mandrake linux server so I think dll will not play in this.
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.
ASKER CERTIFIED SOLUTION
Avatar of Richard Quadling
Richard Quadling
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tstName

ASKER

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
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.)

Avatar of tstName

ASKER

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.

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.
Avatar of tstName

ASKER


I do see curl module listed when I use php -m. But libcurl4.so is not updated after make install any idea?
Avatar of tstName

ASKER

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
NP. Glad to have been just as confused as you!