1

I am migrating my application from php 5 to php 7.2. I have a problem with theSoapclient call knowing that it works correctly with php 5.

After a lot of research I am progressing on my soapClient script with php 7.2, but I have a concern for stability. The script will load the wsdl a few times, like 1 time out of 40 and then indicate a loading problem.

[message:protected] => SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://ip?WSDL' : failed to load external entity "http://ip?WSDL"

I added the stream_context , cache_wsdl options but no stable result! it worked twice with this code bellow

$option = array (
        'location'          => $optionSc['location'],
        'uri'               => $optionSc['location'],
        'login'             => $optionSc['login'],
        'password'          => $optionSc['password'],
        'trace'             => 1, 
        'connection_timeout' => 0,
        'exceptions'        => 1
    );

after that it returns like I described first. anyone can help me with that if he fixed this problem I did a lot of researches but nothing is working fine and I am relly blocked!

Mariem05
  • 37
  • 7
  • Can you provide your WSDL file? This sounds like a connectivitiy issue though given that it "sometimes works" – ArSeN Mar 10 '20 at 19:03
  • it is too long to put it. But how could be a connectivity problem while it works correctly each day with php 5. I use the same wsdl file and same url location. – Mariem05 Mar 11 '20 at 11:13
  • @ArSeN could this be a problem in the server I am testing on it? is that what you meant by connectivity issue? – Mariem05 Mar 11 '20 at 17:00
  • Could be, yes. Hard to tell without knowing all the details. – ArSeN Mar 11 '20 at 17:21
  • I searched about SOAP and how proxy can disable its functionnalities. Then I found in phpinfo file that the server I am deploying my migration has a variable ** from_proxy setted 1 ** while on the server of php 5 (the working version) this variable does not exist. – Mariem05 Mar 12 '20 at 14:01
  • I think it is a problem of the server they provided to me to make the migration.. I need to make this variable disappear! – Mariem05 Mar 12 '20 at 14:02
  • Where exactly do you find this `from_proxy` variable? in the PHP config? under which section? – ArSeN Mar 12 '20 at 16:20
  • I called the phpinfo function that returns the server config. Then this variable is found under Apache Environment section. PS: I set in in my code to 0. it works yesterdays. I came today to test it again but the test is down.. OMG!!! – Mariem05 Mar 13 '20 at 10:27

2 Answers2

1

I've experienced a similar behaviour. PHP was reporting errors with parsing remote WSDL. The problem was weak certificate used by the remote server that kept being refused by OpenSSL, even before being processed by PHP.

Problem

I have confirmed this by trying to download the WSDL using curl

curl REMOTE_ADDRESS

which reported the following error

error:14082174:SSL routines:SSL3_CHECK_CERT_AND_ALGORITHM:dh key too small.

The diffie-hellman key base was 1024 instead of recommended 2048 which I checked using openssl command (see https://weakdh.org/)

openssl s_client -showcerts -connect admonitoring.mediaresearch.cz:443 </dev/null

Solution

Until the certificate problem is fixed and a new one, more secure, issued, I have managed to fix this problem by temporarily lowering Openssl security settings.

In /etc/ssl/openssl.cnf (Debian) comment out the following line

# comment out the following line in /etc/ssl/openssl.cnf
CipherString = DEFAULT@SECLEVEL=2
# or set SECLEVEL to 1
CipherString = DEFAULT@SECLEVEL=1
lukas
  • 11
  • 2
0

Instead of changing the settings on the whole system, I solved it by using:

$options['ssl']['ciphers'] = 'DEFAULT@SECLEVEL=1';

in the stream_context

user26432
  • 1
  • 2