LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Curl and PHP...? (https://www.linuxquestions.org/questions/linux-software-2/curl-and-php-208687/)

hurieka 07-23-2004 08:36 AM

Curl and PHP...?
 
Hello,
I`m new here, I find this forum on google, this forum is great and biiig...and I`ll come here again every day because I`m newbie in linux world...:(

I search forum and I can`t find how I can compile PHP to use CURL software...that is big problem for me and on net I can`t find all steps...
Can somebody help to me?
I think that I have that software on server:
cd usr/bin
curl --version
curl 7.9.8 (i386-redhat-linux-gnu) libcurl 7.9.8 (OpenSSL 0.9.7a) (ipv6 enabled)

But I can`t use that software in PHP!
Why?
What I must do now?

Also, is this software secure? (with this software somebody can use telnet, ftp, http and much more...)

Can somebody provide here secure setup of this software in PHP?

Thank you...

Sorry for my english:(

hurieka 07-24-2004 06:19 AM

Can somebody help me with this?
Pleaseeeeeee....
That is not much text for you, please...

pimp1911 09-26-2004 02:26 PM

bump. I would like to know the steps as well. According to the php website you are suppose to do a
to 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. I am little confused on the lib directory. The libcurl.a file is in a different directoy so how would you do the ./configure command to factor in that all the files needed are in different directories.

Simon_6162 09-27-2004 06:33 PM

here is my config line for php

'./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-db4=/usr' '--with-curl' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-gd' '--enable-gd-native-ttf' '--without-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-dom=shared,/usr' '--with-dom-xslt=/usr' '--with-dom-exslt=/usr' '--with-xmlrpc=shared' '--with-pcre-regex=/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-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--with-pear=/usr/share/pear' '--with-imap=shared' '--with-imap-ssl' '--with-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,/usr' '--enable-memory-limit' '--enable-bcmath' '--enable-shmop' '--enable-calendar' '--enable-dbx' '--enable-dio' '--enable-mcal' '--enable-mbstring=shared' '--enable-mbstr-enc-trans' '--enable-mbregex' '--with-apxs2=/usr/sbin/apxs'


that is the default configure on fedora core 2. it looks like php can be configured with --with-curl

I have no idea how it is used in PHP though

I hope thats some help


p.s. you know you can list the current config by making the following php file right ?

<?php phpinfo(); ?>

pimp1911 09-27-2004 10:00 PM

I tried just using ./configure --with-curl. And I have a test.php that I can look at via my browser to show me the php environment. Test.php just has the <?php phpinfo(); ?> in it. When I look at it and do a find for curl. It doesnt show up. If I do a php -m it does show up. Also if you dont mind see if you have a libphp4.so and do a ldd on this file. Does curl show up there.

Simon_6162 09-28-2004 05:58 AM

ok well i have a section in php info that says:

curl
CURL support enabled
CURL Information libcurl/7.11.1 OpenSSL/0.9.7a ipv6 zlib/1.2.1.1

what systems are you running e.g redhat 9, fedora etc? are there no prebuild binaries that already have curl built into them. I'm just using the standard fedora ones.

Does curl work properly from the command line ?

the output of ldd libphp4.so
linux-gate.so.1 => (0x003ff000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0x00632000)
libnsl.so.1 => /lib/libnsl.so.1 (0x00302000)
libexpat.so.0 => /usr/lib/libexpat.so.0 (0x00111000)
libpspell.so.15 => /usr/lib/libpspell.so.15 (0x00f69000)
libpcre.so.0 => /lib/libpcre.so.0 (0x002c2000)
libpanel.so.5 => /usr/lib/libpanel.so.5 (0x00781000)
libncurses.so.5 => /usr/lib/libncurses.so.5 (0x00e14000)
libgmp.so.3 => /usr/lib/libgmp.so.3 (0x00bbb000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x0021d000)
libpng12.so.0 => /usr/lib/libpng12.so.0 (0x00411000)
libz.so.1 => /usr/lib/libz.so.1 (0x00130000)
libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x00141000)
libdb-4.2.so => /lib/tls/libdb-4.2.so (0x00317000)
libcurl.so.2 => /usr/lib/libcurl.so.2 (0x006be000)
libbz2.so.1 => /usr/lib/libbz2.so.1 (0x0015f000)
libresolv.so.2 => /lib/libresolv.so.2 (0x0016e000)
libm.so.6 => /lib/tls/libm.so.6 (0x00180000)
libdl.so.2 => /lib/libdl.so.2 (0x001a3000)
libssl.so.4 => /lib/libssl.so.4 (0x001a7000)
libcrypto.so.4 => /lib/libcrypto.so.4 (0x00486000)
libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x009c1000)
libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x00577000)
libcom_err.so.2 => /lib/libcom_err.so.2 (0x008d7000)
libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x00a6a000)
libc.so.6 => /lib/tls/libc.so.6 (0x00785000)
libaspell.so.15 => /usr/lib/libaspell.so.15 (0x008da000)
libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x00a8c000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x001db000)
libpthread.so.0 => /lib/tls/libpthread.so.0 (0x001e3000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x0046f000)

hope this helps.

pimp1911 09-28-2004 11:14 PM

Okay this is what I did. I uninstalled the package version of Curl that comes with Fedora Core 1. That is curl version 7.10.6 and removed the devlelopment curl package as well. You may have to use a rpm -e --nodpes on the curl package to get it removed. I downloaded the source for Curl version 7.11.1 and did a ./.configure --with-ssl since I use ssl. And then did a make and make install on the new version of curl. Then I went over to my php source and used a portion of your .configure to recompile php. A suggestion first though would be to write down your phpinfo "configure " info just in case you have to recompile to what you orginaly had before. Then I did this. make clean. And then ran this from my php source.

./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-db4=/usr --with-curl --with-exec-dir=/usr/bin --with-freetype-dir=/usr --with-gd --enable-gd-native-ttf --without-gdbm --with-zlib --with-gettext --with-ncurses --with-gmp --with-iconv --with-jpeg-dir=/usr --with-openssl --with-regex=system --with-xml --with-layout=GNU --enable-bcmath --enable-exif --enable-ftp --enable-magic-quotes --enable-safe-mode --enable-sockets --enable-sysvsem --enable-sysvshm --enable-track-vars --enable-trans-sid --enable-yp --enable-wddx --with-pear=/usr/share/pear --with-kerberos --with-ldap=shared --with-mysql --enable-memory-limit --enable-bcmath --enable-shmop --enable-calendar --enable-dbx --enable-dio --enable-mcal --enable-mbstring=shared --enable-mbstr-enc-trans --enable-mbregex --with-apxs2=/opt/app/apache2/bin/apxs


Play close attention to ---apxs2=. This is the location of apache or apache2 in my case.
And --sysconfdir=. This is the location of your php.ini.

Once this completed I did a make and a make install. I have a test.php that I can access via my webserver that shows the details of my compile for php and I saw that curl is now present. A little gotcha here. You may have to bounce your webserver or close your browser and rerun the test.php(which has phpinfo in it). There is alot of extra stuff in the compile of php that I will be playing around with to get down to the bare minimun of just allowing curl. Thanks for your help. I have been searching the internet for 3 or 4 days on this subject.

You can verify by doing a php -m command and seeing if curl shows up. Or do a ldd command on libphp4.so and see if curl comes up there.


All times are GMT -5. The time now is 04:10 PM.