SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Being a unix veteran (SCO, 20 years or so) I am somewhat green to Linux, I have installed slackware 10.1 on a box, all options except for international languages where installed.
(Installation was error-free and was a charm, I have *never* installed a *nix this fast before)
My problem is that I can't get PHP to work with Curl, the Apache log tells me:
PHP fatal error: Call to undefined function: curl_init() in /var/www/htdocs/...
From what I gather, I need to recompile PHP with curl support (--with-curl[=DIR]) and for the life of me I have no clue where to begin.
Do I need to acquire the PHP source and recompile? or is the source already installed via slackware installation?
A somewhat walkthrough from a Linux guru would be greatly appreciated.
Originally posted by michaelsanford Hi Marc, welcome to Linux. What's the PHP code you're using?
You should be able to call curl externally with system() or exec() if you have curl installed (which it is with Slackware).
Ultimately my goal would be to run this from the unix prompt via curl, but the credit-card processing outfit only supplies PHP code that
I'm trying to convert so as to use curl directly without the use of PHP.
the snipit from the PHP code that causes the error is
$data_stream is put together from a PHP web form POST (parm=val&parm=val etc..)
$url is the payment processing outfit's script
//send the data and retrieve response from FirePay
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$data_stream);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
$result_tmp = curl_exec ($ch);
curl_close ($ch);
If I could have the equivalent for the above code but for command line curl, I would be happy as a p*g in sh*t.
So, I have a feeling that PHP that comes with Slackware 10.1 default is 4.0.1 which doesn't support curl_* per se. I would assume the command line would look something like this, if you wanted to pass it to exec()
I'm not entirely clear on which options you'd need to set, but look at the php.net documentation for curl_init() and compare it to man curl and try to flesh it out. It shouldn't be too hard.
Originally posted by michaelsanford Et un montrealais en plus! Didn't notice.
So, I have a feeling that PHP that comes with Slackware 10.1 default is 4.0.1 which doesn't support curl_* per se. I would assume the command line would look something like this, if you wanted to pass it to exec()
I'm not entirely clear on which options you'd need to set, but look at the php.net documentation for curl_init() and compare it to man curl and try to flesh it out. It shouldn't be too hard.
Yep, greater Montreal area.
I'll lookup and compare the options as you mentioned, so long as I can
get it to run from the unix prompt, I can then build a bubble around it in (bourne, bash, perl, whatever) for my purposes.
Ah, do you really think it is clever to mix up different techniques, when you can really do all this with php-only?
Installing PHP from source is not that hard (Documentation).
Also you could do the post-request without CURL as well: Example
Originally posted by cccc828 Ah, do you really think it is clever to mix up different techniques, when you can really do all this with php-only?
Installing PHP from source is not that hard (Documentation).
Also you could do the post-request without CURL as well: Example
I'm trying to *not* use PHP and go to command line only, problem being PHP, cURL is very green to me and am having trouble creating the equivalent of post#3 but for command line use only.
Basically I will have data pre-formatted as var=val&var=val etc... from a database and need to send this info to the command line cURL and having trouble converting the PHP cURL options (post #3) to command line ones.
I have data (var=val&var=val), the remote URL, no certificate and this must be sent SSL.
If I understood the Man-page correctly, it could work that way:
Code:
var = "foo=text&bar=othertext&banana=apple" //ensure that the content is "urlencoded"!
curl -d var -ciphers SSLv3+SSLv2 -o out.txt http://www.example.com/post.php //check [URL=http://www.openssl.org/docs/apps/ciphers.html] for the ciphers
This could work. However, try to use a sniffer such as snort to check the HTTP-Traffic. It is not that easy to debug HTTP-Applications without knowing what Headers are sent and received. Also you might want to try to do what you want to do without SSL first, get the basics to work and then try to master the SSL part. This is also a good idea, because it is kinda hard to debug encrypted POST information.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.