Need updated version of cURL


#1

Greetings,

My current version of cURL is 7.21.0 , but I need version 7.26.0 in order to integrate Amazon Checkout (PayPal alternative) into my site so I can accept payments.

It contacted support and they can’t update this. Instead, they said to “install your own custom php build and custom curl extension”. I am on the shared hosting program.

The question is how do I get at least cURL version 7.26.0 on my website? I don’t know much about installing my own custom PHP build and stuff. I just need the updated cURL version and that’s it. Do I add a command to my PHPRC file? Do I need to download something in addition?

Thanks
Kind regards


#2

Anyone know how to do this?


#3

Puzzling that this question hasn’t been answered yet, normally the forum is buzzing with experts ready with advice. Perhaps they are waiting for us to try and do it by ourselves and fail miserably and then they will step in. So let us see how far we get.

According to http://curl.haxx.se/ the most recent stable version of curl is 7.32.0

At my other host the instructions for installing it are as follows:

wget http://curl.haxx.se/download/curl-7.32.0.tar.gz tar -xzf curl-7.32.0.tar.gz cd curl-7.32.0 ./configure --prefix=$HOME --with-ssl=$HOME/lib make make install

I tried this (at my other host) and it seems to work. Doing ‘curl -V’ says version 7.19.7 but then running this script and doing ‘curl-7.32.0/src/curl -V’ says version 7.32.0

But the script might need changing for Dreamhost, please try it and let us know.

Then presumably you will need to edit your website so that it calls this new version of curl instead of the normal version.


#4

Greetings tomtavoy,

Thanks for the response and an URL for the new version. Unfortunately, I am hosting on a shared server, so I don’t know if your installation codes are allowable.

Dreamhost support pointed me to here: http://wiki.dreamhost.com/PHP.ini (Specifically: http://wiki.dreamhost.com/PHP.ini#Loading_PHP_5.3_Extensions ) . They say that if I screw up the server, they aren’t going to fix it and they aren’t kidding about it. Unfortunately, I don’t know what I’m doing other than increasing my file upload size with a one-line code in the PHPRC file. Because its me, its very likely the server would break since that’s usually what would happen.

So I need an expert who is knowledgeable about this cURL update through the Dreamhost shared server. I was hoping Dreamhost could simply update the version to 7.26.0 on my machine , since the current 7.21.0 version is from 2010?

Thanks
Kind regards


#5

Actually that script is for shared hosting … it installs the new version of curl into the directory ~/bin/ in your own userspace.

What one can’t do in shared hosting (and what that script doesn’t try to do) is move the new version of curl onto the normal execution path (for example, /usr/bin/). One can’t do this because that would affect the whole shared server.

Instead, the next step is to tweak something locally so that calls to ‘curl’ from your website pick up your customized version of curl instead of the shared version in /usr/bin/

Regarding breaking things: you may be misreading the warning on the wiki page where it says “Server changes may cause this to break. Be prepared to troubleshoot this yourself if this happens. We seriously aren’t kidding about this.”

I think they are not talking about your customizations breaking the server … they are saying that when something subsequently changes in the server due to Dreamhost maintenance/upgrade, those changes might cause your customizations to stop working. Which is a permanent risk. But as long as your customizations are inherently sensible and properly done, there is a reasonable chance that they will survive unscathed.


#6

Thanks for clarifying the warning about breaking the server, this doesn’t seem anywhere near as dangerous then.

As for your script, where do I save this command text to and how do I run it?

Thanks
Kind regards


#7

Well, I should say again that I don’t know if that script will actually work at Dreamhost, I’m doing it at my other host. But it could work. And considering that Dreamhost is blithely migrating from debian to ubuntu without expecting any problems, I’d go so far as to say that it might work.

Here is a way of doing it (for someone who runs Windows on their local machine and has plink installed):

  1. Select/right-click/copy that script
  2. At the Windows command-line do ‘notepad temp.txt’
  3. Hit ‘paste’ and ‘save’
  4. At the Windows command-line do ‘plink -m temp.txt myuser@myserver.dreamhost.com

(which will prompt you for a password unless you have passwordless login set up)

This will create ~/bin/curl in your account at ‘myuser’; to verify success, go into your shell command line there and do ‘~/bin/curl -V’


#8

P.S. simplification let us leave the local (Windows) machine out of the equation altogether.

I have put that script at sites.google.com/site/ttavoy/curl732.txt and you can run it by entering the following single line into your shell:

This creates the file ~/bin/curl and you can verify success by doing ~/bin/curl -V

Much nicer, huh?

(The -L parameter to curl makes it follow the redirections which google places in the way.)


#9

Thanks for the response and instructions.

For the first time ever, I was able to get putty shell working and entered the command that you provided. It looked like took a few minutes and installed a bunch of stuff related to curl 7.32.0 into an experimental folder on my domain. Putty seems like something interesting now that I actually got it working.

Using phpinfo(), it looks like the old 7.21.0 version is still on the machine.

How do I get 7.32.0 to work now that it’s in the server?

Thanks
Kind regards


#10

The ideal solution, in my opinion, would be if your application has a configuration section where you can tell it what execution path to work with. If so, put $HOME/bin at or near the front of that path.

If not, then stronger (more drastic) measures are called for. For example, if your .bash_profile file contains the line “path=$PATH:$HOME/bin” you could replace that line with “path=$HOME/bin:$PATH” (and then log out and in again for it to take effect).


#11

Greetings,

Unfortunately, I don’t have any configuration section for my script. Basically, I build everything in procedural PHP. I’ve never worked with bash files or anything like this before.

Is there some way to set this up using a simple PHP include file or PHP command to call this cURL version?

Thanks
Kind regards


#12

Does your silence mean problem is solved? If so it would be interesting to hear how you did it. I haven’t managed to find any php option that makes it pick up a custom $PATH. Maybe it would be necessary to install a whole custom php. Is this possible on shared hosting? Any experts reading this, please advise!


#13

Unfortunately, I’ve been waiting to see if you were going to come back with a solution on how to do this.

I’m not sure what to do next.


#14

If you’re calling cURL directly from your scripts just use the path to the binary.

exec ( “/home/user/path/to/curl [commands here]” );

If you want the later version to work “within” PHP itself then you’ll need to:

  • install the binary and libraries as Tom has previously outlined above
  • download, extract and upload the PHP cURL extension directory to your server
  • build the cURL module using your current DH PHP version and custom paths
  • load the extension into your domain’s PHP environment using a dispatcher and custom php.ini file

This isn’t a “fully customised PHP” per the wiki, but it’s certainly not standard nor simple if you’re not used to mucking about in shell.


#15

Greetings,

Unfortunately, I don’t think this will work. Basically, I have Amazon.com’s entire payment library in a directory. I’m guessing I would have to re-write the entire library put each of these curl commands in wherever the script uses curl?

What I was hoping for was some kind of php include file, require_once or some other command that configures which cURL version to use one time and it overrules whatever version is in the phpinfo(). So when cURL is used anywhere within the script, it automatically uses the requested newer version of cURL instead of the old default one in the machine.

Thanks
Kind regards


#16

The extension is loaded within PHP at runtime. To override it with a later version try the second part of my reply.


#17

Another puzzling aspect of this question is that there don’t appear to be loads of complaints all over the web from people unable to install amazon payments because of this problem.

If I may make an off-the-wall suggestion … are you actually sure that it needs curl version 7.26 or later? I had a look at

https://payments.amazon.co.uk/help/Checkout-by-Amazon/Technical-Resources/Code-Samples-for-Working-with-Your-Cart-and-Orders

and yes it does indeed say,

“Note: Be sure you are using PHP version 5.2.6 or later and curl version 7.26 or later when using the PHP code samples listed here.”

But … could it be that this statement is only there because the person putting this code together tested it with those versions of curl and PHP, so, to be on the safe side, they said that these versions are required?

By the way, I had a look at some of the PHP samples on that page, and they call

instead of something simpler like

so it would indeed be necessary to pursue part 2 of sXi’s suggestions instead of part 1.


#18

I’m wondering the same thing. I took a look at the cURL changelog, and I don’t see anything earthshattering in 7.26.0 which I’d expect Amazon’s library to be depending on.


#19

Unfortunately, I’ve been having problems and getting stuck on parts Amazon’s scripts not getting call responses. I had to contact their developer support and they advised me that the most probable cause is that my cURL version is incompatible with their minimum standard. This is the only reason I’m trying to get cURL updated to see if this will solve the problem, if it is the problem.

I’ve spent many hours messing around with the Amazon scripts, but I will keep looking anyways.

Thanks
Kind regards


#20

I found an example of another developer trying to integrate Amazon’s payment service into their site: https://forums.aws.amazon.com/message.jspa?messageID=410268

They pretty much have the same error I had and they had cURL 7.22.0 . After they realized they had the outdated version of cURL, they upgraded it and everything worked just fine for them.

Can someone at Dreamhost update the 2010 version of cURL on the machines to at least 7.26.0? 7.21.0 is over 3 years old after all. It looks like it only took a day or two for that other guy to do it, so it can’t be that difficult for the hosting service experts to do it!

Thanks
Kind regards