fsockopenerror

Started by JuhaS14, March 18, 2004, 03:18:03 AM

Previous topic - Next topic

JuhaS14

Jees, eli monella tulee varmaan tälläistä virhettä:

Warning: fsockopen(): unable to connect to osoite:portti in /var/www/forum/Sources/Subs.php on line 1412

Tämä onnistuu korjata:

Sourcessa kansiossa olevaa Subs.php:ta editoimalla, etsi sieltä rivi:

$fp = fsockopen($match[1], 80, $temp, $temp, 1);

Muuta tämä rivi seuraavaksi:

$fp = @fsockopen($match[1], 80, $temp, $temp, 1);


Eli PHP:ssa laittamalla function eteen (tässä tapauksessa fsockopen()-functio) @ saadaan functio olematta palauttamatta mahdollista virheilmoitusta, eli jos osoitetta ei esim. ole olemassa.

Muutenkin tuota @-merkkiä kantsii funkkareitten eteen viljellä jos virheilmoituksia käyttäjille tulee PHP:sta (ei siis mitään suomennettuja), virheilmoitusten näkyminen käyttäjälle saattaa muuten aiheuttaa tietoturvariskejä.

JuhaS14

Huomatkaa että php.inissä pitää display_errors olla Off.

JuhaS14

Vielä hieman juttua:

eli korjatkaa myös Errors.php:ssa oleva rivi:

if ($errno & error_reporting() == 0)

Tälläiseksi:

if ($errno && error_reporting() == 0)

[Unknown]

Umm, that's not a good thing :P.

if ($errno & error_reporting() == 0)

Means: if $errno AND error_reporting().... equals 0, then...

if ($errno && error_reporting() == 0)

Means: if $errno is true, and error_reporting() equals 0, then...

-[Unknown]

JuhaS14

#4
Quote from: [Unknown] on March 18, 2004, 03:50:41 AM
Umm, that's not a good thing :P.

if ($errno & error_reporting() == 0)

Means: if $errno AND error_reporting().... equals 0, then...

if ($errno && error_reporting() == 0)

Means: if $errno is true, and error_reporting() equals 0, then...

-[Unknown]

Yeah, but that's fix the problem.... I turn off Error_display and type '@' before fsockopen() and it didn't help. So I think that is the only solution... :(

JuhaS14

Ok, _ÄLKÄÄ_ tehkö tuohon errors.php:hen muutoksia!

Jos ongelmia esiintyy säätäkää vain ja ainoastaan PHP.inistä errorleveleitä!


JuhaS14

Eli jos PHP.inissänne on seuraava rivi näin:

;   - Show all errors except for notices
;
error_reporting  =  E_ALL & ~E_NOTICE

"kommentoikaa" se, eli:

;   - Show all errors except for notices
;
;error_reporting  =  E_ALL & ~E_NOTICE


JuhaS14

Joo, eipä auttanut. :(

Byhähää, täytyy jatkaa testailuja, eli edelleen tulee:

2: fsockopen(): unable to connect to kennedy.fiiu.net:80
Tiedosto: /var/www/forum/Sources/Subs.php
Rivi: 1412

Owdy

Please report all bugs in offical side - Bugit kuuluu tuonne viralliselle puolelle ;)

http://www.simplemachines.org/community/index.php?board=60.0

Jos niitä ei sinne ilmoita, niin niitä ei  osata korjata.
Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

JuhaS14

On ilmoitettu jo asiasta tonne ja sitä ihmetellään sielläkin.. ;) Aattelin vaan tänne pistää vähän asiasta suomenkielistä infoa mikä auttaa ja mikä ei.

JuhaS14

Tähän tuli ilmeisesti ratkaisu:

Eli Errors.php:sta kyseinen rivi tulisi muuttaa:

if (($errno & error_reporting()) == 0)

Kokeilen itse tuota päivällä ja raportoin miten toimi.

JuhaS14

Ja tämä muuten toimi ;) Great.

Advertisement: