I use WordPress and I recently moved my site from the cpanel host to a Linux server with directadmin panel.
Right after the transfer realized that customers have the following error when downloading via EDD plugin.
cURL error 28: Resolving timed out after 5001 milliseconds
I also got this error of w3_total_cache plugin.
Server informatin:
Centos 6.8 (Final)
cURL 7.54.0 (Final)
directadmin
cURL error 28: Resolving timed out after 5001 milliseconds means DNS resolving failed.
so just change the DNS server list in /etc/resolv.conf.
or maybe we can bind the hostname and ip address in /etc/hosts.
this image shows the demo.
As reported here:
https://wordpress.org/support/topic/dropbox-upload-fails-with-curl-timeout-error/
You can apply this temporary fix to extend the HTTP request timeout:
add_filter( 'http_request_timeout', function( $timeout ) { return 60; });
Wordpress default is 5 seconds.
To resolve this you have to set the curl connection time out and time out value at the time of curl initialization.
Just changes this two property value.
CURLOPT_CONNECTTIMEOUT => 30,
CURLOPT_TIMEOUT => 60,
For more details check This.
update these two lines here:
/usr/share/icingaweb2/modules/jira/library/Jira/RestApi.php
$opts = array(
CURLOPT_URL => $this->url($url),
CURLOPT_HTTPHEADER => $headers,
CURLOPT_USERPWD => $auth,
CURLOPT_CUSTOMREQUEST => \strtoupper($method),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CONNECTTIMEOUT => 30,
CURLOPT_TIMEOUT => 30,
You can set
set_time_limit(120);
in the wp-config.php after the MySQL settings section.
Related
i'm having a problem using Seller Center SDK from this site:
https://github.com/rocket-internet-berlin/SellerCenterSDK-PHP
i did exactly like what he told. and when i came to the point to test it
php ./genericGetter.php
i got error saying:
curl error 60: ssl certificate problem: unable to get local issuer certificate
i tried to turn off my firewall and added cacert.pem from this site https://curl.haxx.se/ca/cacert.pem to my php.ini and still no luck. can someone provide a solution?
You can try add it to php.ini
curl.cainfo=c:\path\to\cacert.pem
And try set opt_option if still not work.
$options = array(
CURLOPT_RETURNTRANSFER => true, // return web page
CURLOPT_HEADER => false, // don't return headers
CURLOPT_FOLLOWLOCATION => true, // follow redirects
CURLOPT_ENCODING => "", // handle all encodings
CURLOPT_USERAGENT => "spider", // who am i
CURLOPT_AUTOREFERER => true, // set referer on redirect
CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect
CURLOPT_TIMEOUT => 120, // timeout on response
CURLOPT_MAXREDIRS => 10, // stop after 10 redirects
CURLOPT_SSL_VERIFYPEER => false // Disabled SSL Cert checks
);
curl_setopt_array( $ch, $options );
just figured it out.
inside vendor\guzzlehttp\guzzle\src\HandlerCurlFactory.php, on line 329; change;
$conf[CURLOPT_SSL_VERIFYPEER] = true;
to
$conf[CURLOPT_SSL_VERIFYPEER] = false;
so far, i don't know the side effect that might happens. but, it does work fine now.
hopefully this is useful for those who wants to work with Seller Center SDK.
If you can trust the source that you are consuming the resources from then arguably I would say that you can deactivate that option temporally as you already did but I would recommend you to check the root of the issue for a long-term solution.
It seems that the issue is with curl not having a valid certificate:
Check if your server has the latest cacert.pem file which you can download from https://curl.haxx.se/docs/caextract.html and add to the server certs directory.
if the server uses a certificate signed by a CA represented in cacert then it might be expired, or the name might not match the domain name your SDK is using.
If you still not having a solution then check the link below to see if one of the options provided can give you a solution:
curl: (60) SSL certificate : unable to get local issuer certificate
The bellow is my curl config of PPHttpConfig.php for paypal adaptive payment SDK,
public static $DEFAULT_CURL_OPTS = array(
CURLOPT_SSLVERSION => 4,
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_TIMEOUT => 60, // maximum number of seconds to allow cURL functions to execute
CURLOPT_USERAGENT => 'PayPal-PHP-SDK',
CURLOPT_HTTPHEADER => array(),
CURLOPT_SSL_VERIFYHOST => 2,
CURLOPT_SSL_VERIFYPEER => FALSE,
CURLOPT_SSL_CIPHER_LIST => 'TLSv1',
);
But,getting error
Type PayPal\Exception\PPConnectionException
Message error:14077410:SSL
routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
OpenSSL error messages tend towards cryptic and generic.
The most common causes for this error are that
the server certificate has expired
the server cerificate is invalid
the client and server can not negotiate a protocol level or cipher acceptable to both parties.
Your version of OpenSSL is relatively recent (but still out of date / containing serious vulnerabilities). I'd like to think that PayPal wouldn't let their certificates expire.
Less common reasons for seeing this error are
your database is CA certs is out of date
CACert database can't be found (is your PHP running in a chroot?)
you've got some silly entries in your openssl.cnf or it can't be found
you are sitting behind a MITM proxy you didn't know about
You didn't say where the PHP is running, what its running on, nor what acces you have to the machine. If it's a Linux box and you have shell access, you might want to see what happens when you probe the server from the command line.
I updated my mac OS to OS X 10.9.
OS X 10.9/Apache 2.2.24/PHP 5.4.17
Now getting the error (Unknown SSL protocol error in connection to...) when attempting to connect to our remote server via cURL.
DEFINE("SSL_CERTTYPE", "PEM");
DEFINE("SSL_KEYPASS", "xxxxxxxxx");
DEFINE("SSL_CERT", $_SERVER['DOCUMENT_ROOT']."/certs/mycert.pem");
DEFINE("SSL_KEY", $_SERVER['DOCUMENT_ROOT']."/certs/mycert.key");
$options = array
(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => false,
CURLOPT_FOLLOWLOCATION => false,
CURLOPT_VERBOSE => false,
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSLCERT => SSL_CERT,
CURLOPT_SSLKEY => SSL_KEY,
CURLOPT_SSLKEYPASSWD => SSL_KEYPASS,
CURLOPT_SSLCERTTYPE => SSL_CERTTYPE,
);
I have tried setting the SSLVERSION to both 2 and 3 but I still get the error.
Not sure if this is an Apache or PHP issue. Any guidance would be greatly appreciated.
*It's also worth noting this was working on 10.8 prior to the update.
This actually has to do with curl: http://curl.haxx.se/mail/archive-2013-10/0036.html
Apparently Apple moved from OpenSSL to their own Secure Transport protocol which seems to have broken curl's handling of client-side certificates (if required for the connection). The only workaround I've found so far is to remove the client-side certificate requirement, which unfortunately isn't ideal.
-- Update --
It appears as though you should be able to use Keychain Access to get this to work, but I haven't been able to thus far.
I wrote some code that fill a login form and submit it via post method. Like:
$config = array(
'adapter' => 'Zend_Http_Client_Adapter_Curl',
);
$this->siteObj = new Zend_Http_Client('http://example.com', $config);
$this->siteObj->setCookieJar();
$this->siteObj->setUri('http://example.com/login');
$this->siteObj->setParameterPost( 'data[User][name]', 'user' );
$this->siteObj->setParameterPost( 'data[User][password]', 'password' );
$response = $this->siteObj->request('POST');
its works fine, but some times this error occur:
Error in cURL request: name lookup timed out
Error: An Internal Error Has Occurred.
whats the problem? what can I do to solve it?
I encountered the same problem:
From the shell, curl worked.
From the shell, the PHP script worked.
PHP could not ping the website.
The DNS config was right.
After restarting Apache, it worked. So strange.
It can be a timeout problem.
Try adjusting the connection timeout:
$config = array(
'adapter' => 'Zend_Http_Client_Adapter_Curl',
'timeout' => 100
);
you can also set single curl options:
$config = array(
'adapter' => 'Zend_Http_Client_Adapter_Curl',
'curloptions' => array(
CURLOPT_USERAGENT => 'Zend_Curl_Adapter',
CURLOPT_HEADER => 0,
CURLOPT_VERBOSE => 0,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_TIMEOUT => 10,
CURLOPT_SSL_VERIFYPEER => false,
),
);
If you find out that it is a timeout issue, I would not suggest to increase too much the timeout parameter, but rather to make a for loop with a number of retries.
It means that your DNS server failed to return a response in time. Check your DNS configuration (e.g. /etc/resolv.conf on Linux), and make sure they are alive and functional. Also try to ping the host in the URL from the same sever to get an idea whether the problem only in PHP or the any application running on the server (more likely).
I'm trying to use cURL with PHP and its giving me this error:
"Failed to connect to 208.77.188.166: Operation not permitted"
I'm pretty sure its a server issue - but just in case, here is my code:
<?php
$ch = curl_init();
$url ="http://www.example.com";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($ch) or die(curl_error($ch));
echo $output;
?>
cURL is enabled on Apache, I've tried changing permissions of the file to 777.
Any ideas?
It's possible that you need to enable allow_url_fopen (reference) -- you can do this in an .htaccess file if it's on apache.
You can enable this by putting this in an .htaccess file:
php allow_url_fopen on
Make sure you set all required CURL options:
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => false,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_ENCODING => "",
CURLOPT_USERAGENT => "spider",
CURLOPT_AUTOREFERER => true,
CURLOPT_CONNECTTIMEOUT => 120,
CURLOPT_TIMEOUT => 120,
CURLOPT_MAXREDIRS => 10,
I will also suggest you echo out errors also using something like this:
$hostconnect = curl_init($url);
$errmsgcurl = curl_error($hostconnect);
echo $errmsgcurl;
The above code is not tested and it just serves as an example.
Also would suggest trying out your code on a local apache server this way you can tell where the problem sits easily.
Many shared hosting providers prohibit outbound connections. Bluehost, for example, requires that you purchase a static IP before allowing outbound connections. Then you need to make sure CURL knows what outbound interface to use.
The error you are receiving is most likely do to a firewall blocking all outbound connections. Many shared hosting providers are blocking outgoing port 80 connections to try to stop rampant errors in PHP scripts that allow remote includes to then be used as an attack vector against the server.
Please contact your host, and if this is the case you will need to find an alternate way to connect to the remote host, or move hosting companies.
You should try using a version of curl installed on the server or on your workstation (command line version) and try to replicate the error, you may need to set a referrer header in the curl request, but that all depends on the server you are trying to contact.
Could be a proxy issue or some kind of authentication problem on the server - can you access this URL using a regular web browser ?