I try to move an php application to a new server.

While on the old server a curl php call works correctly on the new server I get the error:

{"error":"Referrer Header Required"}

As both servers have different Debian, PHP and curl versions, I try to compile curl 7.51 from sources on the new server. A simple compiling works, then I have new version of curl installed. But I still do not have a new curl module for php. When I try to include libcurl.so in php, it complains

PHP Warning: PHP Startup: Invalid library (maybe not a PHP library) '/usr/local/lib/libcurl.so' in Unknown on line 0

There are some differences in the enabled features in curl on both servers. I want to enable some of the features while compiling, but I do not get this new version to work with php. And it does not seem to enable those features on compiling anyway, I run

./configure --enable-debug --with-gssapi

but after make && make install those features are still not enabled in the new version.

  1. How do I get a new compiled version of a module that I can include in php?
  2. How do I get a new curl module for php with some features enabled?

On the old server there is Debian Wheezy installed:

PHP 5.4.39-0+deb7u2

curl 7.26.0 (x86_64-pc-linux-gnu) libcurl/7.26.0 OpenSSL/1.0.1e zlib/1.2.7 libidn/1.25 libssh2/1.4.2 librtmp/2.3 Protocols: dict file ftp ftps gopher http https imap imaps ldap pop3 pop3s rtmp rtsp scp sftp smtp smtps telnet tftp Features: Debug GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP

On the new server, there is Debian Jessie installed:

PHP 5.6.27+dfsg-0+deb8u1

curl 7.38.0 (x86_64-pc-linux-gnu) libcurl/7.38.0 OpenSSL/1.0.1t zlib/1.2.8 libidn/1.29 libssh2/1.4.3 librtmp/2.3 Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smtp smtps telnet tftp Features: AsynchDNS IDN IPv6 Largefile GSS-API SPNEGO NTLM NTLM_WB SSL libz TLS-SRP

Thanks a lot,

Jaroslaw

  • You almost certainly need to completely recompile and build all of php, and all the php packages and modules you use. If you go down that route, completely remove the built-in php packages first. – Zoredache Dec 9 '16 at 19:42
up vote 0 down vote accepted

By moving complex system from server with older software infrastructure, to one with newer ( especially by few versions ) there is always risk of incompatibility with further. Especially if system you are migrating consists of modules prepared to work with third party software ( programs, libraries ) of older versions than installed. Generally speaking you have to resolve such problems by creating consistent environment. It may be achieved by upgrading php modules or/and downgrading third party software ( programs, libraries )

How do I get a new compiled version of a module that I can include in php?

Well, if it's module available to general public then check package from Debian repository. It has php5-curl ( details at https://packages.debian.org/stable/php/php5-curl ). That may work.

There may be some problems caused by eventual differences in module configuration or interface may have changed between versions.

But if code of tat module was altered in any way by author of system you are migrating to new server, then you will have to consult source code (if it has repository then consult commits of proper files related to module ).

How do I get a new curl module for php with some features enable

You may alter source module package that comes with Debian or get it from repository of developer(s) and configure it according your needs.

But always keep in mind that generally speaking modifications of packages may eventually lead to some security issues or incompatibility with your systems, so they should be performed wisely.

In case that fail, you may try downgrading curl to same version as installed on old server. Using existing Debian infrastructure or manually. But every part of system that do not come from Debian repository won't be upgraded automatically by Debian. That may lead to security and stability issues if left unattended. So that's much less convenient ( and less secure ) way.

  • Thanks for the answer to my questions. The original problem (Referrer Header Required) seems not be caused by curl but by the server on the other site. So for now I will stick with the curl version provided by the debian package. Thank you anyway. – Jaroslaw S. Dec 10 '16 at 0:15

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.