I was trying to use strace to find out root cause, with not much luck - I see communications between PHP client and Junos SSH server:
[pid 26495] 14:41:38.940471 lstat("/var/www/html/looking-glass/./libs/phpseclib-1.0.11/Crypt/TripleDES.php", {st_mode=S_IFREG|0644, st_size=15967, ...}) = 0
[pid 26495] 14:41:38.940536 poll([{fd=13, events=POLLIN|POLLPRI|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
[pid 26495] 14:41:38.940582 sendto(13, "\0\0\2\364\10\0242\21g\337\0202\312\255\304\245\35\346\364\225\3003\0\0\0~diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256\0\0\0\17ssh-rsa,ssh-dss\0\0\0\323aes128-ctr,aes192-ctr,aes256-ctr,twofish128-ctr,twofish192-ctr,twofish256-ctr,aes128-cbc,aes192-cbc,aes256-cbc,twofish128-cbc,twofish192-cbc,twofish256-cbc,twofish-cbc,blowfish-ctr,blowfish-cbc,3des-ctr,3des-cbc\0\0\0\323aes128-ctr,aes192-ctr,aes256-ctr,twofish128-ctr,twofish192-ctr,twofish256-ctr,aes128-cbc,aes192-cbc,aes256-cbc,twofish128-cbc,twofish192-cbc,twofish256-cbc,twofish-cbc,blowfish-ctr,blowfish-cbc,3des-ctr,3des-cbc\0\0\0009hmac-sha2-256,hmac-sha1-96,hmac-sha1,hmac-md5-96,hmac-md5\0\0\0009hmac-sha2-256,hmac-sha1-96,hmac-sha1,hmac-md5-96,hmac-md5\0\0\0\4none\0\0\0\4none\0\0\0\0\0\0\0\0\0\0\0\0\0V\277:](\223\252q", 760, MSG_DONTWAIT, NULL, 0) = 760
[pid 26495] 14:41:38.940631 poll([{fd=13, events=POLLIN|POLLPRI|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
[pid 26495] 14:41:38.940665 poll([{fd=13, events=POLLIN|POLLERR|POLLHUP}], 1, 60000) = 1 ([{fd=13, revents=POLLIN}])
[pid 26495] 14:41:38.947365 recvfrom(13, "\0\0\3\324\t\24\352\275`d{y\336q\n\251}OD'\24\\\0\0\0\267ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1\0\0\0#ssh-rsa,ssh-dss,ecdsa-sha2-nistp256\0\0\0\235aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]\0\0\0\235aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]\0\0\0\247hmac-md5,hmac-sha1,[email protected],hmac-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96\0\0\0\247hmac-md5,hmac-sha1,[email protected],hmac-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96\0\0\0\25none,[email protected]\0\0\0\25none,[email protected]\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 8192, MSG_DONTWAIT, NULL, NULL) = 984
[pid 26495] 14:41:38.947423 poll([{fd=13, events=POLLIN|POLLPRI|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
[pid 26495] 14:41:38.951330 poll([{fd=13, events=POLLIN|POLLPRI|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
[pid 26495] 14:41:38.951379 sendto(13, "\0\0\0\214\6\36\0\0\0\200\2\2770p\2\375g$\0\5\301\7f\300\276/D\364\7\250a\235O:\314\255\244Y\237\37\\\216EY\3\322\237\207Sf\324\245\246\262ou,\10\371\360\260\377i\356\276\322\2217M\274B\213\367\35\25\246eF\377\254\377l\374\206\260?/8\2158-*M\30\316T\226\230\344\27\272\\\3+y\341\262K\234\203\314a`\217\340\371\267\10\235\214\2\302FE\241\206\377\23eW\300\251\232\275\325i\6aNs\203k\5\345", 144, MSG_DONTWAIT, NULL, 0) = 144
[pid 26495] 14:41:38.951428 poll([{fd=13, events=POLLIN|POLLPRI|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
[pid 26495] 14:41:38.951461 poll([{fd=13, events=POLLIN|POLLERR|POLLHUP}], 1, 60000) = 1 ([{fd=13, revents=POLLIN}])
[pid 26495] 14:41:39.016848 recvfrom(13, "\0\0\2\274\7\37\0\0\1\27\0\0\0\7ssh-rsa\0\0\0\3\1\0\1\0\0\1\1\0\352\265\274\17\354\26'\"d4\260\"\\\377\243\nR\\b\272\n\326M)\3642Z\265\273\325.\205\261b\214\17g\2511\2415\344\t7\311/\374U\r\213y\30\241+\20\241Hx\2710\27\225\333\f\251\314\315\245\1\302\264\1S\201\220o\201\326\220\177\202/lW0L\277\241\232\350j\244(\303\304g\273\26 \5\\8\272\303\0076\303\364\\\311\277'\0371h\6\377\320\247L7#'&`G\243\27c\234\371$Vl\202\22k\353\357s\300`I#\270\304\375f\315\3619\353!\275\362\v\266\364s)\252\363\244\335<I\31d\35\276\374 )\256\t*\206\211\232\266k\324*\31\376\210\263w\321s\262 \335{\257\223(\300\25\202\352\244\3244\314\205\345\3373\35o\37\226\r\2158\340\375\347?[d\302\327zX\177~OI\220M\324\205\242\240\217\376g\227\250'\t\272\334\353\377\262\231\375N\260\275\351\2043\0\0\0\201\0\334}\323\253)V\245\212\26\353\252,\345\350\310\355U<N\5\354d\276\370\305\353\365g\25rU+Hh\375\"~\24\212\326\340V7_\202\232\366\177\372\275\365\346\264I\302\0334\300\275\374?\375_\335\321I\35^bJ\206\260Z\235\315D\2457K=\251\302\271\30\270\331\240m\262wLl\34\227\\A\6\327\340\321\246,\244?Bf\6\226/\371\222\370\f;\221\37\305\2l\205^\204\3354k\372|\376\0\0\1\17\0\0\0\7ssh-rsa\0\0\1\0\2\262\227\336{\305\300\343\205Z\233\33\270\345\205c_\0\1\300\373&\3\264Z=\374Y~\214\373\255a\\h\365\262m\224\260\347\360\0\22F*\207$\347\275\232\3\232\2;\377\273t\302\tf$\240\271\303I\21\202\346\345\221\317\n\22\314\231\0269\324\205W\363\220$\257\3109\16=\350\305\\h\26PY\200tJE\302\2;\323:\273\357\177IRa\f\214P\31\214=%\370\335arL\204\35\353\4\22\247\202\327\262\254\262\332\36\2244h\373\301\"_hA\200\21\37\350j(\361\326a\31\301\31\346\353\20_i&3%\347/\t\22\23\312%5\342\267)\365\331\302[\216L\243a\210\316r9\377\227\256\320\355\223\256\215\274\372\247\322\252{7-\336\361\330\275\205D\202:k\347\240\226]>\366\224\207\267\334\232\333\237\236b\26\271\271e\325\333\337\263\200^oc1\207m=\246\33\357,\27\271\17\216.\262\202\231\0\0\0\0\0\0\0\0\0\0\f\n\25\0\0\0\0\0\0\0\0\0\0", 8192, MSG_DONTWAIT, NULL, NULL) = 720
[pid 26495] 14:41:39.026635 sendto(13, "\0\0\0\f\n\25 \tn~\232\210\36\224g\245", 16, MSG_DONTWAIT, NULL, 0) = 16
[pid 26495] 14:41:39.026803 poll([{fd=13, events=POLLIN|POLLPRI|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
[pid 26495] 14:41:39.027987 poll([{fd=13, events=POLLIN|POLLPRI|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
[pid 26495] 14:41:39.028244 sendto(13, "\272\"\24l\371\327q\257\325\213\16R\244C\335-5\266\324`\355\25\227\7\177\322\335\7?\372\327j\264c\216HG\215\25&J\257\327\321KhO9u\363pOe\322\0215\350\226q6\335\27\346\310", 64, MSG_DONTWAIT, NULL, 0) = 64
[pid 26495] 14:41:39.028305 poll([{fd=13, events=POLLIN|POLLPRI|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
[pid 26495] 14:41:39.028363 poll([{fd=13, events=POLLIN|POLLERR|POLLHUP}], 1, 60000) = 1 ([{fd=13, revents=POLLIN}])
[pid 26495] 14:41:39.132619 recvfrom(13, "4nHp\236\264\256n\277\200\375pk\317\314p\376\350\347.\227\236\242\226\352\265\274\30Gq7r5\254\5DvW\212r\352\262O\2744rs\6\304\266\23\3350n\354\211\2\344&\324\303\n9\343", 8192, MSG_DONTWAIT, NULL, NULL) = 64
[pid 26495] 14:41:39.132904 poll([{fd=13, events=POLLIN|POLLPRI|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
[pid 26495] 14:41:39.133096 sendto(13, "\211\253)\213|6\4\351s}\27\253BA%+f\335\t\323\216\366g\206\234\332\276\31S\3064\5\344\216\3z\316P\364F?\316l\303\315\313)%@<\326w\262\323Nw\214\272\202L\305\237\265\32", 64, MSG_DONTWAIT, NULL, 0) = 64
[pid 26495] 14:41:39.133507 close(13) = 0
[pid 26495] 14:41:39.133820 chdir("/") = 0
[pid 26495] 14:41:39.134129 setitimer(ITIMER_PROF, {it_interval={0, 0}, it_value={0, 0}}, NULL) = 0
[pid 26495] 14:41:39.134402 fcntl(9, F_SETLK, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}) = 0
[pid 26495] 14:41:39.134762 setitimer(ITIMER_PROF, {it_interval={0, 0}, it_value={0, 0}}, NULL) = 0
[pid 26495] 14:41:39.134916 read(12, 0x7f84f0ca9048, 8000) = -1 EAGAIN (Resource temporarily unavailable)
Please advice how can I troubleshoot this problem? I'm open to any patches testing.