PHP SOAP cannot connect to an SSL WSDL source - php

Trying to make Soap connection to a https:// WSDL source via PHP/Win32, but keep getting the error:
Warning: SoapClient::SoapClient() [soapclient.soapclient]: I/O warning
: failed to load external entity "https://...
If I try to save the WSDL locally and access it then, the SoapFault->faultstring property has the message "SSL support is not available in this build".
After some Googling, seems like PHP SOAP cannot connect to a HTTPS source. HTTP is OK, though.
Is there a workaround for this? Or is there an alternative SOAP version/module I can install?

HTTPS support for SOAP in PHP5
If you’re seeing error messages about missing https wrappers when trying to use SOAP (”Unable to find the wrapper “https” – did you forget to enable it when you configured PHP?” or “[HTTP] SSL support is not available in this build”), you haven’t installed the SSL libraries to support secure transactions.
Uncomment
extension=php_soap.dll
in your php.ini
Uncomment
extension=php_openssl.dll
in your php.ini
Copy
ssleay32.dll
and
libeay32.dll
to your windows system32 directory
Reboot apache, et voila!
I originally found this answer at: http://webponce.com/rants/2008/04/https-support-for-soap-in-php5-under-windows/

I had the same problem. openSSL, cURL were enabled, initiated a SoapClient with option of location to stored certificated, etc, etc.. tried everything.
Turns out it does work in CLI mode. Thus php_sapi = CLI.
As we almost always run our webservices calls as a cronjob, scheduled task in Windows, this is not really a bad thing. I was really glad to get it working!
Update:
Okay, turns out when PHP is running as an Apache module, it uses the by opensll required libraries libeay32.dll and ssleay32.dll from the Apache install. When using PHP in CLI is uses the libraries from the PHP directory/install. Overwriting the 2 Apache dlls with the dlls from the PHP directory did the trick. It now also runs under Apache.
So your PHP version should match with the working dlls for the specific version. When it still doesn't work in the web interface. Please check that Apache isn't loading these dlls from a Windows System directory, specified earlier in your system defined path, which is picked up by Apache.

I've had success with SSL and SOAP using NuSOAP:
http://nusoap.sourceforge.net/

Related

'c:/wamp64/bin/php/php7.0.10/ext/php_oci8_12c.dll' - %1 is not a valid win32 application

In order to access an remote Oracle database from php, I had to activate the extension php_oci8_12c. But when I do, it does not appear in the phpinfo().
On the other hand, I get in the php logs the error message:
[13-Jan-2017 08:39:48 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'c:/wamp64/bin/php/php7.0.10/ext/php_oci8_12c.dll' - %1 is not a Valid win32 application
I use php 5.6.25 and wampserver 3.0.6 (64 bit). How can I resolve this?
Well, I faced this error too and managed to fix it.
Before downloading every kind Oracle Client Version just take a look at your http://localhost/?phpinfo settings at Configure Command section.
This will tell, which version of Oracle was used to build your WAMP server.
The image above show this two lines:
"--with-pdo-oci=c:\php-sdk\oracle\x64\instantclient_12_1\sdk,shared"
"--with-oci8-12c=c:\php-sdk\oracle\x64\instantclient_12_1\sdk,shared"
Obviously tell us that InstantClient used is 64 bits.
There are two versions of InstantClient 12.1 x64: 12.1.0.2.0 and 12.1.0.1.0
I tested with 12.1.0.2.0 version and failed.
After that, I tested with old one, 12.1.0.1.0 version and worked.
Download from Instant Client for Microsoft Windows (x64) and extract the files below to "c:\oracle":
instantclient-basic-windows.x64-12.1.0.2.0.zip
instantclient-sqlplus-windows.x64-12.1.0.2.0.zip
instantclient-sdk-windows.x64-12.1.0.2.0.zip
This will create the following folder "C:\Oracle\instantclient_12_1".
Using "Windows Command Prompt" (WIN+R CMD) go to folder above and execute SQLPLUS:
sqlplus [user]/[pass]#[host]:[port]/[service]
You must be able to connect.
Finally, add the "C:\Oracle\instantclient_12_1" folder to the PATH enviroment variable, placing it on the leftmost place.
Close your WAMP server.
Yes close it, because the Enviroment Variable is only read at launch time.
So restarting the services may fail, leading you to a wrong result.
After restart, your PHPINFO would show the OCI8 and PDO_OCI loaded.
I hope it helps!

Bolt Extension Repo Currently Unavailable

I am running Bolt CMS locally on my machine using XAMPP. I just upgraded to version 2.0.1 today and everything seems to be working great. The only issue I am having is installing extensions.
On the view/install extensions page, I am seeing this message:
The Bolt extensions Repo at https://extensions.bolt.cm/list.json is currently unavailable. Check your connection and try again shortly.
I do have an active internet connection and am not sure why I cannot connect to the repository from the extensions page. Any help would be appreciated!
Update
In the CommandRunner.php file's setup method, there is this line:
$json = json_decode((file_get_contents($this->packageRepo)));
The problem is coming from the file_get_contents($this->packageRepo) call
The error message being returned from that call is
file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Update 2
The issue is not related to bolt CMS but rather my XAMPP configuration. However, if someone else using bolt CMS locally with XAMPP has already tackled this issue, I would appreciate their input.
At this point, I have not been able to solve the SSL issue with my local server.
I did, however, find a solution that allows me to install bolt extensions.
The solution is to open up the config.yml file and add the following:
extensions:
site: 'http://extensions.bolt.cm/'
This will tell bolt to use the http URL rather than https. I would recommend using the secure URL in production, but this has allowed me to install extensions on my local server until I solve the underlying problem.
I found that the following fixed it correctly for me!
PHP cURL error code 60
From that post:
Use this certificate root certificate bundle:
https://curl.haxx.se/ca/cacert.pem
Copy this certificate bundle on your disk. And use this on php.ini
curl.cainfo = "path_to_cert\cacert.pem"

PHP log full of suhosin errors

Hello I have simple php script well it is more a html file with few php lines.
Yet it produces tons of errors in log that look like this on every line:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20100525/suhosin.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20100525/suhosin.so: cannot open shared object file: No such file or directory in Unknown on line 0
I can not locate in nowhere in code where suhosin might been called...
This error is present on 2 different servers.
EDIT:
In phpinfo there is no suhosin present...
Thanks.
We will likely need more information in order to provide an accurate resolution, such as What version of PHP is installed on your system? however I will give you a general resolution.
Generally this issue is caused by PHP Upgrade, most recent PHP versions does not support suhosin as this only applied to older versions of php that needed additional security.
If you are on a shared hosting server you need to contact to your hosting provider and notify them about this issue, they are likely able to resolve it quickly.
If you are on a Dedicated server, VPS server or a localhost environment you can solve this issue by following the steps below:
Find your php.ini location [You can use phpinfo() to locate php.ini file]
Open the php.ini file and search suhosin.so
When you find suhosin comment this line extension = "suhosin.so" by adding semicolon at the beginning of the line, For example: ;extension = "suhosin.so"
Save this file
Restart Apache service httpd restart
Note: If ClouldLinux installed on your server, you need to force update CageFS by issuing the following command at the command line cagefsctl --force-update

enable curl in xampp, windows

trying to enable curl in xampp 3.0.12 in windows environment.
Updated the php.ini in the php folder to enable curl, and there is no php.ini file in the apache/bin folder.
phpinfo() says:
loaded configuration file: C:\xampp\php\php.ini
curl support:enbaled
curl information: 7.24.0
and when i try to run a http_get() command php says:
Fatal error: Call to undefined function http_get()
Restarted both windows and xampp several times to update the changes.
Would be grateful for some advice, as I searched through similar topics on the web but can't get any further.
Note that the function http_get() belongs to the pecl http extension and not to the curl extension. Refer to the documentation of the curl extension to learn how you can use it to retrieve documents via http. You'll also find a lot of posts on stackoverflow
Also note, that the function file_get_contents() can be used to get documents over http in a very simple way. Although it is limited it will fit in much cases. To retrieve a page you can issue:
file_get_contents('http://www.server.com/page.html');

Unable to use PHP curl on amazon ec2 free tier

I am currently moving my web app to amazon ec2. Since it's only for testing, I use the free version called ec2 free tier with windows server 2008 instance. However, Although I have done all I know and read this thread ( How to enable cURL in PHP / XAMPP ). I just couldn't use curl on my php script. it always creates the error
Call to undefined function curl_init() in C:\xampp\htdocs\index.php on line 2
Here are all thing I have tried
Install Wamp ( I tried it on XAMPP to)
Uncomment out php_curl in php.ini file ( and restart apache)
Copy two dll files to both system32 and syswow64
Could it have to do with the fact that I am using free vps?
Update:
Also, when I started the apache server in XAMPP , this error appeared
'PHP Startup: unable to load dynamic library curl.dll'
However, I have double checked the ext directory and the php_curl.dll was in there.
i think curl need to access remote sever from our web server. so i opened all traffic in my server outbound rule and it works. i think this is not good solution. still look for better way.
nope.
be sure, that you have the files in the right place, usually its in the plugins folder for php! maybe you cann add a absolute path to your php.ini!
be sure, you edit the correct ini file!
php completly independent to your operatingsystem!
just be sure to doublecheck everything. because its not saying, it has trouble loading your extention, its just saying, the function your trying to call, is not there. so i assume your extention ist not loading at all! :)
One reason I did notice for this cURL plugin to malfunction was the availability of copies of libeay32.dll and ssleay32.dll files. Please check whether your system32 folder has such copies and if so, please rename them to some other names and copy the ones found with the php installation. Sometimes you may need to restart your machine. This was documented here some time ago.
I had a similar problem, but it occours just with requests under https. I tried to create a curl request directly from the ec2 machine and got a error: "curl: (77) error setting certificate verify locations".
It looks like some kind of ssl validation fail because of a certificate not found. So I used a parameter -k (or --insicure) in my curl command, to ignore this validation and after that my curls request did directly from ec2 machine worked.
So I tried to apply a similar ideia in my curl command in php, (I suppoused that the curl php extension forward this requests to the operation system) and I found this curl opt:
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
After that it works to me.
Probably this isn't the best way to solve the problem, but solved my problem temporarelly.

Categories