[Apache/PHP-CGI] Premature end of script headers: ssl + curl

Pagina: 1
Acties:

  • T i M
  • Registratie: April 2004
  • Laatst online: 05-07 07:56
Opgelost

Ik ben tegen een probleem aangelopen waar ik niet uit kom. Op een server (Centos5 32-bit) heb ik al maanden een website draaien. Vorige week heb ik voor een upgrade van een software pakket de MySQL-server geupdate en heb daardoor ook PHP opnieuw moeten compilen. PHP draait in fast-CGI modus, suphp is actief en de webserver is Apache 2.2.

Vandaag kom ik erachter dat een bepaalde pagina niet meer werkte, die gaf een HTTP 500 fout. Die heeft voorheen altijd gewerkt. In de logs kwam ik de volgende melding tegen:

Premature end of script headers:

De pagina die niet meer werkt doet een request over een SSL verbinding om wat gegevens op te halen bij Mollie . De functie die daarvoor wordt gebruik is fsockopen in combinatie met het ssl stream socket. Als ik die regel code weghaal werkt het.

Het rare is dat een SSL request met behulp van Curl ook faalt en krijg ik dezelfde error in de logs te zien.

OpenSSL is geinstalleerd op de machine en is ook mee gecompileerd met PHP. Het rare is dat het vorige week allemaal nog werkte en ik geen nieuwere versie van PHP heb geinstalleerd.

Op internet kom ik veel tegen over de fout, maar mijn probleem lijkt compleet anders. De permissies van de bestanden zijn goed en de suPHP log heeft geen spannende dingen te melden.

Iemand die hier ervaring mee heeft?

Edit:

Heb geprobeerd om een test script te runnen vanaf de command line, dat gaf de volgende error:

Segmentation fault

Heb vervolgens twee scripts gemaakt, 1 die een verbinding opzet met fsockopen en 1 die met curl probeert te verbinding naar een https adres. Vervolgens gerund met een strace, waarvan de volgende output:

fsockopen
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
...
open("/dev/urandom", O_RDONLY|O_NOCTTY|O_NONBLOCK) = 4
fstat64(4, {st_mode=S_IFCHR|0444, st_rdev=makedev(1, 9), ...}) = 0
poll([{fd=4, events=POLLIN}], 1, 10)    = 1 ([{fd=4, revents=POLLIN}])
read(4, "9\257\232\320\273+\332\360\221%\242\325k\303\261\217\313\341\263\21/\262\327\234\317`\22\371\211o\234S"..., 48) = 48
close(4)                                = 0
getuid32()                              = 0
time(NULL)                              = 1353629110
write(3, "\200g\1\3\1\0N\0\0\0\20\0\0009\0\0008\0\0005\0\0\26\0\0\23\0\0\n\7\0\300"..., 105) = 105
read(3, 0xa94b730, 7)                   = -1 EAGAIN (Resource temporarily unavailable)
gettimeofday({1353629110, 597515}, NULL) = 0
poll([{fd=3, events=POLLIN|POLLPRI}], 1, 59998) = 1 ([{fd=3, revents=POLLIN}])
time(NULL)                              = 1353629110
read(3, "\26\3\1\0Q\2\0", 7)            = 7
time(NULL)                              = 1353629110
time(NULL)                              = 1353629110
read(3, "\0M\3\1P\256\275\267E\207\317*\36\353g\217\212EAn2,\rH\25!J\206\320x\0246"..., 79) = 79
read(3, "\26\3\1\22\214", 5)            = 5
read(3, "\v\0\22\210\0\22\205\0\7L0\202\7H0\202\0060\240\3\2\1\2\2\20\t\370\2165^\316b"..., 4748) = 4005
read(3, 0xa94c6da, 743)                 = -1 EAGAIN (Resource temporarily unavailable)
gettimeofday({1353629110, 600476}, NULL) = 0
poll([{fd=3, events=POLLIN|POLLPRI}], 1, 59995) = 1 ([{fd=3, revents=POLLIN}])
time(NULL)                              = 1353629110
read(3, "gh Assurance EV Root CA0\202\1\"0\r\6\t*"..., 743) = 743
read(3, "\26\3\1\2\r", 5)               = 5
read(3, "\f\0\2\t\0\200\273\274-\312\330Ft\220|C\374\365\200\351\317\333\331X\243\365h\264-K\10\356"..., 525) = 525
read(3, "\26\3\1\0\4", 5)               = 5
read(3, "\16\0\0\0", 4)                 = 4
time(NULL)                              = 1353629110
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++


Curl:
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
open("/dev/urandom", O_RDONLY|O_NOCTTY|O_NONBLOCK) = 4
fstat64(4, {st_mode=S_IFCHR|0444, st_rdev=makedev(1, 9), ...}) = 0
poll([{fd=4, events=POLLIN}], 1, 10)    = 1 ([{fd=4, revents=POLLIN}])
read(4, "\236\3Dx45\325\3432\330\357\213\344\254\364hgi\35\325<(\2171\345\27\233\332\366ZA\0"..., 48) = 48
close(4)                                = 0
getuid32()                              = 0
time(NULL)                              = 1353629143
open("/etc/pki/tls/certs/ca-bundle.crt", O_RDONLY|O_LARGEFILE) = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=468638, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6d70000
read(4, "# This is a bundle of X.509 cert"..., 4096) = 4096
read(4, "d4:81:4b:7b:31:0f:23:\n        63"..., 4096) = 4096
read(4, "lting, OU=Certification Services"..., 4096) = 4096
read(4, "  7a:f1:d8:98:45:4e:07:10:ef:16:"..., 4096) = 4096
read(4, "6:3C:0C:35:C5:3E:C2:7F:EF:3C:AA:"..., 4096) = 4096
read(4, "EzARMA8GA1UdEwEB/wQFMAMBAf8wDQYJ"..., 4096) = 4096
read(4, "     91:14:68:98:0a:1e:fe:da:04:"..., 4096) = 4096
read(4, "40:55:eb:\n                    3c"..., 4096) = 4096
read(4, "         bb:61:cd:f3:47:c0:99:a6"..., 4096) = 4096
read(4, "  X509v3 CRL Distribution Points"..., 4096) = 4096
read(4, "            a5:a4:69:b6:57:35:1c"..., 4096) = 4096
read(4, "3:fd:2e:99:ad:59:b5:0b:4d:d4:41:"..., 4096) = 4096
read(4, ":31:aa:ee:a3:67:da:db\n          "..., 4096) = 4096
read(4, "--END CERTIFICATE-----\n\n\nCertifi"..., 4096) = 4096
read(4, "1)\n    Signature Algorithm: sha1"..., 4096) = 4096
read(4, "yaVNpZ24sIEluYy4xPDA6BgNVBAsTM0N"..., 4096) = 4096
read(4, "only, OU=VeriSign Trust Network\n"..., 4096) = 4096
read(4, "        c8:0a:38:eb:f2:24:13:4f:"..., 4096) = 4096
read(4, "e:a6:f8:\n                    58:"..., 4096) = 4096
read(4, "VQQDExhodHRwOi8vd3d3LnZhbGljZXJ0"..., 4096) = 4096
read(4, "iSign, Inc. - For authorized use"..., 4096) = 4096
read(4, "WihT37ha88HQfqDjrw43bAuEbFrskLMm"..., 4096) = 4096
read(4, "QHFauzI13TccgTacxdu9o\nkoqQHgiBVr"..., 4096) = 4096
brk(0xa3e3000)                          = 0xa3e3000
read(4, "cmsxOjA4BgNVBAsTMShjKSAxOTk5IFZl"..., 4096) = 4096
read(4, "HKMQsw\nCQYDVQQGEwJVUzEXMBUGA1UEC"..., 4096) = 4096
read(4, ":f6:3c:e2:3d:9f:d7:1d:d9:c3:60:4"..., 4096) = 4096
read(4, ":96:FC:EE:5B:B3:CA:99:74:8B:95:E"..., 4096) = 4096
read(4, "6:9c:b2:\n                    cf:"..., 4096) = 4096
read(4, "b:22:ab:98:3d:57:e8:26:72:9a:b5:"..., 4096) = 4096
read(4, "S, O=Equifax Secure Inc., CN=Equ"..., 4096) = 4096
read(4, "ic Constraints: critical\n       "..., 4096) = 4096
read(4, ":b5:c9:7d:9d:a0:\n        d2:c6:0"..., 4096) = 4096
read(4, "2:4e:61:2d:03:\n        82:7d:91:"..., 4096) = 4096
read(4, "         X509v3 Authority Key Id"..., 4096) = 4096
read(4, " 10:fb:06:8f:30:04:de:a7:b4:63:b"..., 4096) = 4096
read(4, "rnal CA Root\n        Validity\n  "..., 4096) = 4096
read(4, "Bqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwE"..., 4096) = 4096
read(4, "m9vdDAeFw0wMDA1MzAx\nMDQxNTBaFw0y"..., 4096) = 4096
read(4, "f:a6:ca:3e:82:63:48:aa:e2:08:48:"..., 4096) = 4096
read(4, "    60:8d:7e:e6:60:6b:24:ef:60:a"..., 4096) = 4096
read(4, "3:13:86:82:\n        90:57:cb:57:"..., 4096) = 4096
read(4, "FICATE-----\nMIIDojCCAwugAwIBAgIQ"..., 4096) = 4096
read(4, "zNTk1OVowgZ4xFzAVBgNVBAoTDlZl\ncm"..., 4096) = 4096
read(4, "XJpc2lnbi5j\nb20vcnBhIChjKTAwMSww"..., 4096) = 4096
read(4, " 4 17:20:00 2000 GMT\n           "..., 4096) = 4096
read(4, "a9kC9n8O6mUE8c1U\nyrrJzOCE98g+EZf"..., 4096) = 4096
read(4, "XRob3JpdHkxDTALBgNVBAMTBENSTDEwK"..., 4096) = 4096
read(4, "MR0wGwYDVQQKExRBT0wgVGltZSBXYXJu"..., 4096) = 4096
read(4, "9v3 Basic Constraints: critical\n"..., 4096) = 4096
read(4, "my8YJPamTQr5O8t1wswvziRpyQoijlmn"..., 4096) = 4096
read(4, "CA:18:69:36:EB:AE:69:78:A1:F1\n--"..., 4096) = 4096
read(4, "ions of use, the Certification P"..., 4096) = 4096
read(4, "RnBMylj44ss0O1lKLQfelifwa+JwGDnj"..., 4096) = 4096
read(4, "RTIFICATE-----\nMIIFaDCCBFCgAwIBA"..., 4096) = 4096
read(4, "24:2C:33:D0:B1:9D:8C\n    Signatu"..., 4096) = 4096
read(4, ":0a:c7:4d:4f:5f:a7:af:a2:46:\n   "..., 4096) = 4096
read(4, ":1d:76:13:a9:d5:\n        e5:f1:1"..., 4096) = 4096
read(4, "9:1f:1d:fe:8f:3f:bb:a8:45:\n     "..., 4096) = 4096
read(4, "0x10001)\n        X509v3 extensio"..., 4096) = 4096
read(4, ":a5:18:1c:6c:\n                  "..., 4096) = 4096
read(4, "1UEAxMtQW1lcmljYSBP\nbmxpbmUgUm9v"..., 4096) = 4096
read(4, "2b:e0:d5:92:47:fa:67:5c:a5:13:\n "..., 4096) = 4096
read(4, "2:\n        24:31:83:f9:46:b1:06:"..., 4096) = 4096
read(4, "XJnMRAwDgYDVQQHEwdIYW1idXJnMTowO"..., 4096) = 4096
brk(0xa404000)                          = 0xa404000
read(4, "TAeFw0wMjA2MTExMDQ2MzlaFw0yNzA2M"..., 4096) = 4096
read(4, ":be:2d:ed:3f:1a:b7:\n        b2:6"..., 4096) = 4096
read(4, "        59:66:e0:9e:28:a8:5e:d3:"..., 4096) = 4096
read(4, "e:bf:95:c0:c0:06:\n              "..., 4096) = 4096
read(4, "t):\n                    00:dc:56"..., 4096) = 4096
read(4, "gQ0EgQ2hhaW5lZCBD\nQXMgQ2VydGlmaW"..., 4096) = 4096
read(4, "ss=ips@mail.ips.es\n             "..., 4096) = 4096
read(4, "dEgQTMBGB\nD2lwc0BtYWlsLmlwcy5lcz"..., 4096) = 4096
read(4, "         Netscape Revocation Url"..., 4096) = 4096
read(4, "lona, L=Barcelona, O=IPS Interne"..., 4096) = 4096
read(4, ":05:87:FE:84\n-----BEGIN CERTIFIC"..., 4096) = 4096
read(4, "2a:9a:e2:4a:b5:13:8a:\n          "..., 4096) = 4096
read(4, "BAAGjggRTMIIETzAdBgNVHQ4EFgQUHp9"..., 4096) = 4096
read(4, "lET1JFUzEeMBwGCSqGSIb3DQEJARYPaX"..., 4096) = 4096
read(4, "crl\n                URI:http://w"..., 4096) = 4096
read(4, "ty, CN=QuoVadis Root Certificati"..., 4096) = 4096
read(4, "BxgFjv2D\nrOpm2RgbaIr1VxqYuvXtdj1"..., 4096) = 4096
read(4, "76:43:40:13:13:67:3d:a2:54:\n    "..., 4096) = 4096
read(4, "       76:9c:10:61:8e:b6:53:3a:a"..., 4096) = 4096
read(4, "4:1b:c3:14:da:\n        f8:e7:49:"..., 4096) = 4096
read(4, "2:2a:61:c8:f8:09:58:fc:2d:02:b2:"..., 4096) = 4096
read(4, "ternet/OU=TDC Internet Root CA/C"..., 4096) = 4096
read(4, ":38:c4:a9:c4:61:88:d2:\n         "..., 4096) = 4096
read(4, "kgBhvhCAQEEBAMCAAcwgYEGA1Ud\nHwR6"..., 4096) = 4096
read(4, ":37:f6:97:82:e0:dd:71:69:ff:76:3"..., 4096) = 4096
read(4, "I:http://crl.usertrust.com/UTN-U"..., 4096) = 4096
read(4, ":\n                    01:07:38:6"..., 4096) = 4096
read(4, "USERTRUST Network, OU=http://www"..., 4096) = 4096
read(4, "6LhHC5ehb\nkkj7RwvCbNqtMoNB86XlQX"..., 4096) = 4096
read(4, ":6f:8e:e4:32:09:1d:4d:78:34:78:3"..., 4096) = 4096
read(4, "dentifier: \n                43:9"..., 4096) = 4096
read(4, "  Modulus (2048 bit):\n          "..., 4096) = 4096
read(4, "d9zL2z8cM/z1A57dEZgxXbhxInlrfa6u"..., 4096) = 4096
read(4, "netlock.net/docs cimen vagy kerh"..., 4096) = 4096
read(4, "blic Key Info:\n            Publi"..., 4096) = 4096
read(4, "aD8QFI\n-----END CERTIFICATE-----"..., 4096) = 4096
read(4, "byBhIE5ldExvY2sgS2Z0LiBJbnRlcm5l"..., 4096) = 4096
read(4, "q1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQU"..., 4096) = 4096
read(4, "a:9d:8b:41:6e:16:c9:20:e5:\n     "..., 4096) = 4096
brk(0xa425000)                          = 0xa425000
read(4, "C:DC:D7:10:C2:0E:A9:88:E7\n      "..., 4096) = 4096
read(4, "               CA:TRUE\n         "..., 4096) = 4096
read(4, "c Key Algorithm: rsaEncryption\n "..., 4096) = 4096
read(4, "a:\n        02:05:e6:bc:1e:b5:f2:"..., 4096) = 4096
read(4, "K51ZLZer+bMEkkySh\nNOsF/5oirpt9P/"..., 4096) = 4096
read(4, "\nU2lnbiBDbGFzcyAzIFB1YmxpYyBQcml"..., 4096) = 4096
read(4, "be:c3:67:2a:68:11:df:80:\n       "..., 4096) = 4096
read(4, "99:93:8c:91:70:e2:ab:0f:1c:be:93"..., 4096) = 4096
read(4, " \n                B1:3E:C3:69:03"..., 4096) = 4096
read(4, "            X509v3 Authority Key"..., 4096) = 4096
read(4, "hority/Email=rhn-noc@redhat.com\n"..., 4096) = 4096
read(4, "49:\n        c5:32:d6:e8:7a:97:ff"..., 4096) = 1694
read(4, "", 4096)                       = 0
close(4)                                = 0
munmap(0xb6d70000, 4096)                = 0
clock_gettime(CLOCK_MONOTONIC, {3360, 146542254}) = 0
time(NULL)                              = 1353629143
time(NULL)                              = 1353629143
write(3, "\26\3\1\0T\1\0\0P\3\1P\256\275\327\251\332\10_\21\2\200D\25;t\31q\354\313`;"..., 89) = 89
read(3, 0xa414b80, 7)                   = -1 EAGAIN (Resource temporarily unavailable)
clock_gettime(CLOCK_MONOTONIC, {3360, 148024101}) = 0
clock_gettime(CLOCK_MONOTONIC, {3360, 148284806}) = 0
poll([{fd=3, events=POLLIN|POLLPRI}], 1, 299933) = 1 ([{fd=3, revents=POLLIN}])
time(NULL)                              = 1353629143
read(3, "\26\3\1\0Q\2\0", 7)            = 7
time(NULL)                              = 1353629143
time(NULL)                              = 1353629143
read(3, "\0M\3\1P\256\275\330/\30\241\250\266iN\301\320\316J\341\251\254\271\371\26\277\331\371G\273\331`"..., 79) = 79
read(3, "\26\3\1\22\214", 5)            = 5
read(3, "\v\0\22\210\0\22\205\0\7L0\202\7H0\202\0060\240\3\2\1\2\2\20\t\370\2165^\316b"..., 4748) = 4005
read(3, 0xa415b2a, 743)                 = -1 EAGAIN (Resource temporarily unavailable)
clock_gettime(CLOCK_MONOTONIC, {3360, 151100556}) = 0
clock_gettime(CLOCK_MONOTONIC, {3360, 151234190}) = 0
poll([{fd=3, events=POLLIN|POLLPRI}], 1, 299930) = 1 ([{fd=3, revents=POLLIN}])
time(NULL)                              = 1353629143
read(3, "gh Assurance EV Root CA0\202\1\"0\r\6\t*"..., 743) = 743
brk(0xa446000)                          = 0xa446000
time(NULL)                              = 1353629143
time(NULL)                              = 1353629143
time(NULL)                              = 1353629143
time(NULL)                              = 1353629143
time(NULL)                              = 1353629143
time(NULL)                              = 1353629143
time(NULL)                              = 1353629143
time(NULL)                              = 1353629143
read(3, "\26\3\1\2\r", 5)               = 5
read(3, "\f\0\2\t\0\200\273\274-\312\330Ft\220|C\374\365\200\351\317\333\331X\243\365h\264-K\10\356"..., 525) = 525
read(3, "\26\3\1\0\4", 5)               = 5
read(3, "\16\0\0\0", 4)                 = 4
time(NULL)                              = 1353629143
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++


Oplossing:

Downgraden naar MySQL 5.1.45. Waarschijnlijk zit er iets in de php-mysql client waar die niet blij mee was.

[ Voor 91% gewijzigd door T i M op 23-11-2012 01:38 ]