简体   繁体   English

如何在Linux上安装较旧的CURL(我具有较旧的PHP版本)

[英]How to install older CURL on Linux(I have older PHP version)

I need to add curl to my PHP, I read multiple articles which recommended just sudo apt-get install php5-curl 我需要在我的PHP中添加curl,我读了多篇文章,其中推荐sudo apt-get install php5-curl

But when I try it I get error as below 但是当我尝试它时,出现如下错误

Error: 错误:

The following packages have unmet dependencies: 以下软件包具有未满足的依赖性:

dropbox : Depends: python-gtk2 (>= 2.12) but it is not going to be installed dropbox:取决于:python-gtk2(> = 2.12),但不会安装

php5-curl : Depends: php5-common (= 5.4.45-1~dotdeb+6.1) but 5.4.31-1~dotdeb.0 is to be installed php5-curl:取决于:php5-common(= 5.4.45-1〜dotdeb + 6.1)但要安装5.4.31-1〜dotdeb.0

So I go a bit deeper and try to install it manualy, so I basicly download curl from curl website with: wget http://curl.haxx.se/download/curl-7.36.0.tar.gz and then just unpack it and just ./configure and sudo make and after that sudo make install 因此,我进行了更深入的尝试,尝试手动安装它,因此我基本上从curl网站下载了curl: wget http://curl.haxx.se/download/curl-7.36.0.tar.gz ,然后将其解压缩然后只是./configuresudo make ,然后执行sudo make install

Dispite the fact i didnt get any error It also didnt help. 尽管我没有得到任何错误的事实,但它也没有帮助。

From error I see that I have older version of my PHP than one in repository but I really have no clue what I can do now. 从错误中我看到我的PHP版本比存储库中的PHP版本要旧,但是我真的不知道现在该做什么。

Is here anyone who can help me? 这里有人可以帮助我吗?

If you're stuck with that version of PHP, you can build the cURL extension yourself and then activate it with PHP. 如果您坚持使用该版本的PHP,则可以自己构建cURL扩展,然后使用PHP激活它。 Normally, cURL is compiled into the PHP binary but you can also run it as a dynamic extension. 通常,cURL被编译到PHP二进制文件中,但是您也可以将其作为动态扩展运行。

When you downloaded, compiled, and installed cURL, this installed the curl program and libraries but has nothing to do with PHP. 当您下载,编译和安装cURL时,这将安装curl程序和库,但与PHP无关。

You can follow these steps to build a cURL PHP extension for your system: 您可以按照以下步骤为系统构建cURL PHP扩展:

  • Go to http://php.net/releases and download the source code for the version of PHP you are currently running 转到http://php.net/releases并下载您当前正在运行的PHP版本的源代码
  • Extract to a temporary location 提取到临时位置
  • From the command line, cd to php-5.xx/ext/curl 从命令行将cd转到php-5.xx / ext / curl
  • Run the following commands: 运行以下命令:
  • phpize
  • ./configure --with-curl=/usr/local (/usr/local should be correct, but you can try leaving it blank, or specify the --prefix you used when you installed cURL. ./configure --with-curl=/usr/local (/ usr / local应该是正确的,但是您可以尝试将其保留为空白,或者指定安装cURL时使用的--prefix
  • make && make install

After make install runs, it should say something like: 运行make install后,应该显示类似以下内容:

Installing shared extensions:     /usr/lib/php5/20121212/

This is where it will place curl.so 这是它将放置curl.so地方

Now, edit your php.ini file that PHP uses and add: 现在,编辑PHP使用的php.ini文件并添加:

extension=curl.so

Restart your webserver &/or PHP, check that cURL is loaded. 重新启动您的Web服务器和/或PHP,检查是否已加载cURL。

Note: If you don't have the phpize (it should have come with PHP) you might need to just build PHP to a temporary location and copy phpize to /usr/bin so you have it. 注意:如果没有phpize (它应该随PHP一起提供),则可能只需要将PHP生成到一个临时位置,然后将phpize复制到/usr/bin

Hope that helps. 希望能有所帮助。

You need to update your PHP version and then install curl. 您需要更新您的PHP版本,然后安装curl。

Do apt-get update to get the latest definitions, then apt-get upgrade to upgrade all packages, then apt-get install php5-curl . 执行apt-get update以获得最新的定义,然后apt-get upgrade升级所有软件包,然后apt-get install php5-curl

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM