Précédent   Forum des professionnels en informatique > PHP > Langage
Langage Forum sur le langage PHP, la POO, les conventions, la sécurité, etc. Avant de poster : FAQ Langage, toutes les FAQ PHP, cours langage et sources PHP
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 20/10/2011, 17h31   #1
Invité de passage
 
Inscription : juillet 2005
Messages : 20
Détails du profil
Informations forums :
Inscription : juillet 2005
Messages : 20
Points : 4
Points : 4
Par défaut segmentation fault à l'utilisation de curl

Bonjour,

je suis un peu coincé, mon curl me fait systématiquement des seg fault sans que je comprenne pourquoi.

Je me suis fait un cas simple pour tester, et pareil :
Code :
1
2
3
4
5
6
7
8
9
10
 
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://google.fr');
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT,15);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT,30);
curl_exec($ch);
J'ai vu çà et là des problèmes identiques en farfouillant sur le net, mais pas de réponse.

Ma conf, apache2, php5.3, ubuntu 11.10. J'ai essayé de réinstaller le package php5-curl mais ça n'a rien changé.

Si quelqu'un a déjà rencontré ce problème, et aurait une piste, je lui serais grandement reconnaissant de bien vouloir m'aiguiller
ssayen est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 20/10/2011, 17h33   #2
Modérateur
 
Inscription : septembre 2010
Messages : 7 193
Détails du profil
Informations forums :
Inscription : septembre 2010
Messages : 7 193
Points : 8 569
Points : 8 569
enlève CURLOPT_HEADER et CURLOPT_POST
__________________
http://blog.stealth35.com/
stealth35 est actuellement connecté   Envoyer un message privé Réponse avec citation 00
Vieux 20/10/2011, 17h52   #3
Invité de passage
 
Inscription : juillet 2005
Messages : 20
Détails du profil
Informations forums :
Inscription : juillet 2005
Messages : 20
Points : 4
Points : 4
Fait, mais ça ne change rien.

Nouveau code :
Code :
1
2
3
4
5
6
7
8
9
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://google.fr');
//curl_setopt($ch, CURLOPT_HEADER, 0);
//curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT,15);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT,30);
curl_exec($ch);
ssayen est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 20/10/2011, 17h54   #4
Modérateur
 
Inscription : septembre 2010
Messages : 7 193
Détails du profil
Informations forums :
Inscription : septembre 2010
Messages : 7 193
Points : 8 569
Points : 8 569
quelle est la version de ton PHP, et d’où provient cette version ?
__________________
http://blog.stealth35.com/
stealth35 est actuellement connecté   Envoyer un message privé Réponse avec citation 00
Vieux 20/10/2011, 18h34   #5
Invité de passage
 
Inscription : juillet 2005
Messages : 20
Détails du profil
Informations forums :
Inscription : juillet 2005
Messages : 20
Points : 4
Points : 4
Tous les "protagonistes" sont les packages fournis pour ubuntu.

php => PHP 5.3.6-13ubuntu3.2 with Suhosin-Patch (cli) (built: Oct 13 2011 23:09:42)
apache => Apache/2.2.20 (Ubuntu)
libcurl3 => 7.21.6-3ubuntu3
ssayen est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 21/10/2011, 17h11   #6
Invité de passage
 
Inscription : juillet 2005
Messages : 20
Détails du profil
Informations forums :
Inscription : juillet 2005
Messages : 20
Points : 4
Points : 4
Je suis toujours coincé, j'ai juste (un peu) avancé dans mes symptômes, à savoir que le seg fault n'a pas lieu en ligne de commande. Dans ce cas ça fonctionne très bien.

Je penche donc vers une incompatibilité entre les versions de cURL et d'Apache, ce qui me semble vraiment étonnant vu que ce sont les versions par défaut de la distrib Ubuntu 11.10.

Je suis toujours avide d'un oeil neuf là dessus, merci.
Laurent
ssayen est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 21/10/2011, 17h12   #7
Modérateur
 
Inscription : septembre 2010
Messages : 7 193
Détails du profil
Informations forums :
Inscription : septembre 2010
Messages : 7 193
Points : 8 569
Points : 8 569
t'as le backtace de du segfault ?
__________________
http://blog.stealth35.com/
stealth35 est actuellement connecté   Envoyer un message privé Réponse avec citation 00
Vieux 24/10/2011, 11h08   #8
Invité de passage
 
Inscription : juillet 2005
Messages : 20
Détails du profil
Informations forums :
Inscription : juillet 2005
Messages : 20
Points : 4
Points : 4
Voici le strace du process apache qui seg fault, je ne vois pas grand chose...

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
epoll_wait(46, {{EPOLLIN, {u32=3339941032, u64=140577619539112}}}, 8, 10000) = 1                                                                                
accept(3, {sa_family=AF_INET, sin_port=htons(40250), sin_addr=inet_addr("192.168.1.***")}, [16]) = 47
fcntl(47, F_GETFD)                      = 0
fcntl(47, F_SETFD, FD_CLOEXEC)          = 0
semop(131073, {{0, 1, SEM_UNDO}}, 1)    = 0
getsockname(47, {sa_family=AF_INET, sin_port=htons(80), sin_addr=inet_addr("192.168.1.**")}, [16]) = 0
fcntl(47, F_GETFL)                      = 0x2 (flags O_RDWR)
fcntl(47, F_SETFL, O_RDWR|O_NONBLOCK)   = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fdac712f000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fdac712d000
read(47, "GET /testCurl.php HTTP/1.1\r\nHost"..., 8000) = 809
stat("/*****/*****/public/testCurl.php", {st_mode=S_IFREG|0664, st_size=418, ...}) = 0
open("/.htaccess", O_RDONLY|O_CLOEXEC)  = -1 ENOENT (No such file or directory)
open("/*****/.htaccess", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/*****/*****/.htaccess", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/*****/*****/public/.htaccess", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fdac712b000
open("/*****/*****/public/testCurl.php/.htaccess", O_RDONLY|O_CLOEXEC) = -1 ENOTDIR (Not a directory)
mmap(NULL, 528384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fdac3b20000
setitimer(ITIMER_PROF, {it_interval={0, 0}, it_value={60, 0}}, NULL) = 0
rt_sigaction(SIGPROF, {0x7fdac5d9a900, [PROF], SA_RESTORER|SA_RESTART, 0x7fdac8e06420}, {SIG_DFL, [], 0}, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [PROF], NULL, 8) = 0
umask(077)                              = 022
umask(022)                              = 077
getcwd("/", 4095)                       = 2
chdir("/*****/*****/public")       = 0
setitimer(ITIMER_PROF, {it_interval={0, 0}, it_value={30, 0}}, NULL) = 0
lstat("/*****/*****/public/testCurl.php", {st_mode=S_IFREG|0664, st_size=418, ...}) = 0
lstat("/*****/*****/public", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/*****/*****", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/*****", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/*****/*****/public/testCurl.php", O_RDONLY) = 48
fstat(48, {st_mode=S_IFREG|0664, st_size=418, ...}) = 0
fstat(48, {st_mode=S_IFREG|0664, st_size=418, ...}) = 0
fstat(48, {st_mode=S_IFREG|0664, st_size=418, ...}) = 0
fstat(48, {st_mode=S_IFREG|0664, st_size=418, ...}) = 0
mmap(NULL, 418, PROT_READ, MAP_SHARED, 48, 0) = 0x7fdac3b1f000
munmap(0x7fdac3b1f000, 418)             = 0
close(48)                               = 0
stat("/tmp/cachegrind.out.6982", 0x7fffe57b85d0) = -1 ENOENT (No such file or directory)
open("/tmp/cachegrind.out.6982", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 48
flock(48, LOCK_EX|LOCK_NB)              = 0
fstat(48, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fdac3b1f000
write(48, "version: 1\ncreator: xdebug 2.1.2"..., 115) = 115
write(48, "fl=php:internal\nfn=php::curl_ini"..., 34) = 34
write(48, "10 40\n\n", 7)               = 7
write(48, "fl=php:internal\nfn=php::curl_set"..., 36) = 36
write(48, "11 5\n\n", 6)                = 6
write(48, "fl=php:internal\nfn=php::curl_set"..., 36) = 36
write(48, "12 0\n\n", 6)                = 6
write(48, "fl=php:internal\nfn=php::curl_set"..., 36) = 36
write(48, "13 0\n\n", 6)                = 6
write(48, "fl=php:internal\nfn=php::curl_set"..., 36) = 36
write(48, "14 0\n\n", 6)                = 6
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
chdir("/*****/apache2-gdb-dump/")         = 0
rt_sigaction(SIGSEGV, {SIG_DFL, [], SA_RESTORER|SA_INTERRUPT, 0x7fdac917f060}, {SIG_DFL, [], SA_RESTORER|SA_RESETHAND, 0x7fdac917f060}, 8) = 0
kill(6982, SIGSEGV)                     = 0
rt_sigreturn(0x1b46)                    = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
Je n'arrive pas à récuper le core, on voit dans le strace qu'il va à la fin dans le dossier indiqué par la directive CoreDumpDirectory mais je n'obtiens rien dedans.
ssayen est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 16h38.


 
 
 
 
Partenaires

Hébergement Web