Curl error in debian 9

Hello

I use Nextcloud 12
I try to connect to my nextcloud page but i got these errors

Citation
PHP module cURL not installed.
Please ask your server administrator to install the module.
PHP modules have been installed, but they are still listed as missing
Please ask your server administrator to restart the web server.

These occurs occurred when i updated from Debian 8 to Debian 9

But curl is well installed

Citation
aptitude search curl | grep ^i
i A curl - command line tool for transferring data with URL syntax
i gnupg-curl - GNU privacy guard - a free PGP replacement (cURL)
i libcurl3 - easy-to-use client-side URL transfer library (OpenSSL flavour)
i libcurl3-gnutls - easy-to-use client-side URL transfer library (GnuTLS flavour)
i libcurl4-openssl-dev - development files and documentation for libcurl (OpenSSL flavour)
i php-curl - CURL module for PHP [default]
i A php7.0-curl - CURL module for PHP
i A python-pycurl - Python bindings to libcurl
i A python3-pycurl - Python bindings to libcurl (Python 3)

and php modules are OK

Citation
php -m
[PHP Modules]
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gettext
hash
iconv
json
libxml
openssl
pcntl
pcre
PDO
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zlib
[Zend Modules]
Zend OPcache

When i synchronize my calendar and contacts, i got this error

Citation
{“reqId”:“UIQuwRdIPjrvPZMyabzT”,“level”:3,“time”:“2017-07-29T05:10:48+00:00”,“remoteAddr”:“192.168.0.254”,“user”:"–",“app”:“PHP”,“method”:“PROPFIND”,“url”:"/nextcloud/remote.php/dav/addressbooks/users/admin/Contacts/",“message”:“Call to undefined function OC\curl_init() at /var/www/nextcloud/lib/private/LargeFileHelper.php#120”,“userAgent”:“DAVdroid/1.6.3-ose (2017/07/08; dav4android; okhttp3) Android/6.0.1”,“version”:“12.0.0.29”}
{“reqId”:“ivKpwSZmnioTDs1OrIKY”,“level”:3,“time”:“2017-07-29T06:05:06+00:00”,“remoteAddr”:“192.168.0.254”,“user”:"–",“app”:“PHP”,“method”:“PROPFIND”,“url”:"/nextcloud/remote.php/dav/calendars/admin/contact_birthdays/",“message”:“Call to undefined function OC\curl_init() at /var/www/nextcloud/lib/private/LargeFileHelper.php#120”,“userAgent”:“DAVdroid/1.6.3-ose (2017/07/08; dav4android; okhttp3) Android/6.0.1”,“version”:“12.0.0.29”}

my apache logs

Citation
cat acces.log
192.168.0.4 - - [29/Jul/2017:13:03:13 +0200] “GET /nextcloud/ HTTP/1.1” 503 14083 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/css/jquery-ui-fixes.css HTTP/1.1” 200 816 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/css/jquery.ocdialog.css HTTP/1.1” 200 629 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/css/guest.css HTTP/1.1” 200 4422 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/vendor/select2/select2.css HTTP/1.1” 200 3095 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/vendor/jquery-ui/themes/base/jquery-ui.css HTTP/1.1” 200 5972 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/vendor/jquery-migrate/jquery-migrate.min.js HTTP/1.1” 200 3885 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/vendor/blueimp-md5/js/md5.min.js HTTP/1.1” 200 1603 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/vendor/bootstrap/js/tooltip.js HTTP/1.1” 200 4361 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/vendor/underscore/underscore.js HTTP/1.1” 200 14831 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/vendor/jquery/dist/jquery.min.js HTTP/1.1” 200 29556 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/vendor/handlebars/handlebars.min.js HTTP/1.1” 200 21798 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/vendor/es6-promise/dist/es6-promise.js HTTP/1.1” 200 6773 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/vendor/autosize/dist/autosize.min.js HTTP/1.1” 200 1332 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/vendor/davclient.js/lib/client.js HTTP/1.1” 200 3266 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/vendor/clipboard/dist/clipboard.min.js HTTP/1.1” 200 3354 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/vendor/snapjs/dist/latest/snap.js HTTP/1.1” 200 5892 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/vendor/backbone/backbone.js HTTP/1.1” 200 20077 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/vendor/DOMPurify/dist/purify.min.js HTTP/1.1” 200 5018 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/js/jquery.ocdialog.js HTTP/1.1” 200 1644 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/js/oc-dialogs.js HTTP/1.1” 200 7541 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/js/octemplate.js HTTP/1.1” 200 1401 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/js/l10n.js HTTP/1.1” 200 2478 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/js/public/appconfig.js HTTP/1.1” 200 997 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/js/config.js HTTP/1.1” 200 748 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/js/js.js HTTP/1.1” 200 18737 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/js/eventsource.js HTTP/1.1” 200 1688 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/js/oc-requesttoken.js HTTP/1.1” 200 170 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/js/mimetype.js HTTP/1.1” 200 1323 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/js/apps.js HTTP/1.1” 200 1205 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/vendor/moment/min/moment-with-locales.min.js HTTP/1.1” 200 66044 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/vendor/jquery-ui/ui/minified/jquery-ui.custom.min.js HTTP/1.1” 200 60015 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/js/mimetypelist.js HTTP/1.1” 200 1076 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/js/jquery.contactsmenu.js HTTP/1.1” 200 1058 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/js/placeholder.js HTTP/1.1” 200 1970 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/js/backgroundjobs.js HTTP/1.1” 200 589 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/js/oc-backbone.js HTTP/1.1” 200 206 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/js/jquery.avatar.js HTTP/1.1” 200 1842 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/js/jquery-ui-fixes.js HTTP/1.1” 200 209 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/search/js/search.js HTTP/1.1” 200 3494 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/vendor/select2/select2.js HTTP/1.1” 200 31000 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/js/files/fileinfo.js HTTP/1.1” 200 889 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/js/files/client.js HTTP/1.1” 200 5147 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/js/contactsmenu.js HTTP/1.1” 200 3444 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/l10n/fr.js HTTP/1.1” 200 11505 “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/img/logo-icon.svg?v=1 HTTP/1.1” 304 - “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/core/img/background.jpg?v=1 HTTP/1.1” 304 - “-” "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
192.168.0.4 - - [29/Jul/2017:13:03:14 +0200] “GET /nextcloud/cron.php HTTP/1.1” 503 14083 “-” “Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0”

and apache error

Citation
[Sat Jul 29 12:59:16.691028 2017] [:error] [pid 11524] [client 192.168.0.4:42436] PHP Fatal error: Call to undefined function OC\curl_init() in /var/www/nextcloud/lib/private/LargeFileHelper.php on line 120

When i try to launch a php script with curl, no problem
For example this one

<?php
//step1
$cSession = curl_init();
//step2
curl_setopt($cSession,CURLOPT_URL,"http://www.numeriquement.fr");
curl_setopt($cSession,CURLOPT_RETURNTRANSFER,true);
curl_setopt($cSession,CURLOPT_HEADER, false);
//step3
$result=curl_exec($cSession);
//step4
curl_close($cSession);
//step5
echo $result;
$version = curl_version();
// These are the bitfields that can be used 
// to check for features in the curl build
$bitfields = Array(
            'CURL_VERSION_IPV6', 
            'CURL_VERSION_KERBEROS4', 
            'CURL_VERSION_SSL', 
            'CURL_VERSION_LIBZ'
            );
foreach($bitfields as $feature)
{
    echo $feature . ($version['features'] & constant($feature) ? ' matches' : ' does not match');
    echo PHP_EOL;
}
$fileName="test.php";
$encodedFileName = rawurlencode($fileName);
                        $ch = curl_init("file://$encodedFileName");
echo $encodedFileName;
    echo PHP_EOL;
    echo $ch;
        echo PHP_EOL;
	curl_setopt($ch, CURLOPT_NOBODY, true);
	                        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
				                        curl_setopt($ch, CURLOPT_HEADER, true);
			$data = curl_exec($ch);
			 if ($data !== false) {	
  echo "true";
  }
        echo PHP_EOL;
curl_close($ch);												
?>

In Debian Jessie, not seen this kind of errors

What is the solution to go to my nextcloud page ?

Thanks

You are sure that you are not linking the nextcloud vhost to a different php configuration? Your script was run in the Nextcloud-DocumentRoot?

I copied my test.php into the nextcloud directory (/var/www/nextcloud).
I put the same permissions and owner than the nexcloud directory

Citation
-rw-r–r-- 1 www-data www-data 1,3K juil. 29 15:13 test.php

I lauched this script and the result is OK

The nextcloud application is not vhosted. It is in the same host than all applications (ampache, rss, website …)

This is strange, normally Nextcloud just checks for the curl_init function:

And if you manage to run your script in the same folder, so it should either work in both cases or in none of them. In Debian 8, were you using php7 from 3rd-party packages or via backports? Try to make sure that all these packages are removed properly. I did some tests back with debian 8, I didn’t test on fresh Debian 9. Besides of that, I’m running out of ideas …

Thanks for your responses
As you can see, all php packages installed are php 7

Citation
apt-cache policy curl gnupg-curl libcurl3 libcurl3-gnutls libcurl4-openssl-dev php-curl php7.0-curl python-pycurl python3-pycurl
curl:
Installé : 7.52.1-5
Candidat : 7.52.1-5
Table de version :
*** 7.52.1-5 500
500 http://ftp.fr.debian.org/debian stretch/main i386 Packages
100 /var/lib/dpkg/status
gnupg-curl:
Installé : 1.4.18-7+deb8u3
Candidat : 1.4.18-7+deb8u3
Table de version :
*** 1.4.18-7+deb8u3 100
100 /var/lib/dpkg/status
libcurl3:
Installé : 7.52.1-5
Candidat : 7.52.1-5
Table de version :
*** 7.52.1-5 500
500 http://ftp.fr.debian.org/debian stretch/main i386 Packages
100 /var/lib/dpkg/status
libcurl3-gnutls:
Installé : 7.52.1-5
Candidat : 7.52.1-5
Table de version :
*** 7.52.1-5 500
100 /var/lib/dpkg/status
libcurl4-openssl-dev:
Installé : 7.52.1-5
Candidat : 7.52.1-5
Table de version :
*** 7.52.1-5 500
100 /var/lib/dpkg/status
php-curl:
Installé : 1:7.0+49
Candidat : 1:7.0+49
Table de version :
*** 1:7.0+49 500
100 /var/lib/dpkg/status
php7.0-curl:
Installé : 7.0.19-1
Candidat : 7.0.19-1
Table de version :
*** 7.0.19-1 500
100 /var/lib/dpkg/status
python-pycurl:
Installé : 7.43.0-2
Candidat : 7.43.0-2
Table de version :
*** 7.43.0-2 500
100 /var/lib/dpkg/status
python3-pycurl:
Installé : 7.43.0-2
Candidat : 7.43.0-2
Table de version :
*** 7.43.0-2 500
100 /var/lib/dpkg/status

There are no php5.
In Debian 8, i was on php5.
If someone could test in Debian 9 ?

Thanks

I don’t know well php but It seems strange this error.
The line #120 in LargeFileHelper.php file is

Citation
$ch = curl_init(“file://$encodedFileName”);

What is OC/ before curl_init. OwnCloud ?
It’s normal to have OC/ before curl_init()
Why these lines aren’t the same .

It’s OK now.
Some php5 modules was again activated.
So i removed all the php5 modules and installed the php7 modules.

My history.log

Citation
Start-Date: 2017-07-29 17:59:56
Commandline: apt-get remove php5-common
Remove: php5-gd:i386 (5.6.30+dfsg-0+deb8u1), php5-apcu:i386 (4.0.7-1), php5-common:i386 (5.6.30+dfsg-0+deb8u1), php5-cli:i386 (5.6.30+dfsg-0+deb8u1), php5-readline:i386 (5.6.30+dfsg-0+deb8u1), php5-json:i386 (1.3.6-1), libapache2-mod-php5:i386 (5.6.30+dfsg-0+deb8u1), php5-mysql:i386 (5.6.30+dfsg-0+deb8u1)
End-Date: 2017-07-29 18:00:13
Start-Date: 2017-07-29 18:01:58
Commandline: apt-get autoremove --purge
Purge: libvpx1:i386 (1.3.0-3), libjson-c2:i386 (0.11-4)
End-Date: 2017-07-29 18:02:02
Start-Date: 2017-07-29 18:14:09
Commandline: apt-get install php7.0-mysql
Install: php7.0-mysql:i386 (7.0.19-1)
End-Date: 2017-07-29 18:14:20
Start-Date: 2017-07-29 18:29:40
Commandline: apt-get install php7.0-gd
Install: php7.0-gd:i386 (7.0.19-1)
End-Date: 2017-07-29 18:29:45
Start-Date: 2017-07-29 18:33:04
Commandline: apt-get install php-apcu
Install: php-apcu-bc:i386 (1.0.3-2, automatic), php-apcu:i386 (5.1.8+4.0.11-1)
End-Date: 2017-07-29 18:33:07
Start-Date: 2017-07-29 18:38:09
Commandline: apt-get install libapache2-mod-php
Install: libapache2-mod-php:i386 (1:7.0+49)
End-Date: 2017-07-29 18:38:10
Start-Date: 2017-07-29 19:28:58
Commandline: apt-get install php7.0-zip
Install: libzip4:i386 (1.1.2-1.1+b1, automatic), php7.0-zip:i386 (7.0.19-1)
End-Date: 2017-07-29 19:29:08
Start-Date: 2017-07-29 19:30:25
Commandline: apt-get install php7.0-mbstring
Install: php7.0-mbstring:i386 (7.0.19-1)
End-Date: 2017-07-29 19:30:30