PHP Developers Network
http://forums.devnetwork.net/

disabled function or other Problem. Help needed
http://forums.devnetwork.net/viewtopic.php?f=52&t=138845
Page 1 of 1

Author:  Jörg Wuest [ Wed Dec 04, 2013 9:19 am ]
Post subject:  disabled function or other Problem. Help needed

Hello,

I need to know which function could perhaps disabled by my Hoster.
After a Domain Move my Hoster had set some function's to diabled for security reasons. I can talk to my Hoster Support to enable this function's but i need to know what function this are.


Syntax: [ Download ] [ Hide ]
    Warning: stream_set_blocking() expects parameter 1 to be resource, null given in
    /var/www/web128032/html/Swift-4.2.2/lib/classes/Swift/Transport/StreamBuffer.php on line 265
     
    Warning: stream_set_timeout() expects parameter 1 to be resource, null given in
    /var/www/web128032/html/Swift-4.2.2/lib/classes/Swift/Transport/StreamBuffer.php on line 269


    Fatal error:
    Uncaught exception 'Swift_TransportException' with message 'Expected response code 220 but got code "", with message ""'
    in /var/www/web128032/html/Swift-4.2.2/lib/classes/Swift/Transport/AbstractSmtpTransport.php:386
    Stack trace:
    #0 /var/www/web128032/html/Swift-4.2.2/lib/classes/Swift/Transport/AbstractSmtpTransport.php(291):
       Swift_Transport_AbstractSmtpTransport->_assertResponseCode('', Array)
    #1 /var/www/web128032/html/Swift-4.2.2/lib/classes/Swift/Transport/AbstractSmtpTransport.php(119):
       Swift_Transport_AbstractSmtpTransport->_readGreeting()
    #2 /var/www/web128032/html/Swift-4.2.2/lib/classes/Swift/Mailer.php(80):
       Swift_Transport_AbstractSmtpTransport->start()
    #3 /var/www/web128032/html/includes/register1.php(203): Swift_Mailer->send(Object(Swift_Message))
   #4 /var/www/web128032/html/index.php(42): include('/var/www/web128...')
   #5 {main} thrown in /var/www/web128032/html/Swift-4.2.2/lib/classes/Swift/Transport/AbstractSmtpTransport.php on line 386



Greetings Jörg.

Author:  Weirdan [ Wed Dec 04, 2013 11:45 am ]
Post subject:  Re: disabled function or other Problem. Help needed

Check /var/www/web128032/html/Swift-4.2.2/lib/classes/Swift/Transport/StreamBuffer.php, line 265 to see what the first argument to the function call is, then find where the variable is assigned. There you'll find one of the functions producing a stream, like fopen or stream_socket_client (there are many various functions that may produce a stream). That function is what's failing.

Author:  Jörg Wuest [ Wed Dec 04, 2013 1:10 pm ]
Post subject:  Re: disabled function or other Problem. Help needed

Sure had the same thoughts, beetween a figured out that proc_open is disabled.

Syntax: [ Download ] [ Hide ]
echo function_exists('proc_open') ? "Yep, that will work" : "Sorry, that won't work";

Ouput was: "Sorry, that won't work"

Now i have to wait for my Hoster-Support then i can tell you if it now works. Ive seen many Posts an Question with the same Problem and Trace but no solutions (the most of them change the Hoster)

Anyway hier is the StreamBuffer.php:

I was not able to say for sure which Ressource will be filled in the func stream_set_blocking()
But i think it could be an disabled proc_open()

Author:  Weirdan [ Wed Dec 04, 2013 1:58 pm ]
Post subject:  Re: disabled function or other Problem. Help needed

See https://github.com/swiftmailer/swiftmai ... r.php#L257 - it's stream_socket_client that returned null.

Author:  Jörg Wuest [ Wed Dec 04, 2013 2:26 pm ]
Post subject:  Re: disabled function or other Problem. Help needed

Yes you are right!

hell what did my hoster all disabled? men i wrote him since 3 or 4 days first mail() then other now proc_open and stream_socket_client
Syntax: [ Download ] [ Hide ]
echo function_exists('stream_socket_client') ? "2 Yep, that will work" : "2 Sorry, that won't work";

$fp = stream_socket_client("tcp://www.example.com:80", $errno, $errstr, 30);
if (!$fp) {
    echo "$errstr ($errno)<br />\n";
} else {
    fwrite($fp, "GET / HTTP/1.0\r\nHost: www.example.com\r\nAccept: */*\r\n\r\n");
    while (!feof($fp)) {
        echo fgets($fp, 1024);
    }
    fclose($fp);
}

Output:
2 Sorry, that won't work
Warning: stream_socket_client() has been disabled for security reasons in /var/www/web128032/html/Backend/templates/admin.tpl on line 24


But i wonder why trows not this Errormessage to lines later?
https://github.com/swiftmailer/swiftmai ... r.php#L260

I think the support will hate me soon :D

Author:  Weirdan [ Wed Dec 04, 2013 2:52 pm ]
Post subject:  Re: disabled function or other Problem. Help needed


Author:  Jörg Wuest [ Wed Dec 04, 2013 3:02 pm ]
Post subject:  Re: disabled function or other Problem. Help needed

Ah yes ok i thought 0 == false. Ok know i unterstand.
Ok i wait for Request from my Support and will give feedback if solved or not (so can other participate from our Thread).

Thx you between!

greetings Jörg.

Author:  Jörg Wuest [ Thu Dec 05, 2013 5:38 am ]
Post subject:  Re: disabled function or other Problem. Help needed

So the Problem is solved.

To solve this trace you have to enable mail() and stream_socket_client()
My Hoster did not enable proc_open() because of Security Risks! But Swiftmailer (i think so) have build a Fallback for this function.

Thank you Weirdan for your Help.

Edit: fsockopen() was also enabled earlier, not sure if swiftmailer works with zhis function.

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/