can't download extensions via typo3 extension manager - php

i would like to know what causes the error:
Could not access remote resource https://repositories.typo3.org/mirrors.xml.gz.
by trying to download a extension in extension manager.
All configuration:
[SYS][curlUse] = 1
Seems to depend on my system because version 6.2 and 7.6.4 having same error. I am using Xampp on mac os. Their server is not down because i can call https://repositories.typo3.org/mirrors.xml.gz with browser.
Anyone knows how to solve that?

Adding the line
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); directly after
$ch = curl_init(); in curl.php and adding same line next to the other curl_setopt( ... ) in GeneralUtility.php solved this issue for typo3 7.6.4. thanks for your hints. Able to add extensions now.

Related

cURL error 60 when calling Azure Table Storage from App Service running PHP

I am using this SDK:
https://github.com/Azure/azure-sdk-for-php
And this addon:
https://github.com/cocteau666/php-azure-session
To handle session in Azure Table Storage for my PHP based Wordpress site running in an Azure App Service.
When running the code from the last link, I get the following error:
cURL error 60: SSL certificate problem: unable to get local issuer
certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
I am not using cURL directly, I am just using it through the code in azure-sdk-for-php and I cannot change that code.
So how do I identify which certificate is the problem and then globally define it so it will work.
I have already tried running this code just before and it doesn't throw an exception but it doesn't make any difference either. I don't know if I am using the correct .pem or whether this affects cURL globally.
curl_setopt($process, CURLOPT_CAINFO, dirname(__FILE__) . '/cacert.pem');
curl_setopt($process, CURLOPT_SSL_VERIFYPEER, true);
I found the solution here:
(although I used FTP for most of these steps)
Open the web app in portal.azure.com
Go to Application Settings and add this value in the App settings section: PHP_INI_SCAN_DIR = d:\home\site\ini
Open web app's scm panel, for example - https://osi-bout-test.scm.azurewebsites.net/
Go to Debug Console > CMD
Open the "site" folder
Upload the "cacert.pem" file (download it from here: http://curl.haxx.se/docs/caextract.html)
Create/open the "ini" folder
Create/open file with the name "settings.ini"
Put this line inside the file: curl.cainfo = "D:\home\site\cacert.pem"
Go back to the app in the portal.azure.com and STOP and then START.

Error using curl_init() in php environment on BlueMix

I use the PHP runtime on Bluemix. In my solution, I need to invoke the external API available on the Internet on port 3000.
I used curl to manage the API invocation using the following code:
$endPoint="http://".$this->server.":".$this->port.$endPoint;
$session = curl_init($endPoint);
curl_setopt($session, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($session);
In the Bluemix log I found the following error:
Got error 'PHP message: PHP Fatal error: Call to undefined function
curl_init() in /home/vcap/app/htdocs/include/service.php on line 50\n',
referer: http://m2msite.mybluemix.net/login.php
It does not seem to be a defined curl library inside my runtime.
I do not found any documentation on how to define the curl library in a Bluemix runtime.
Can anyone help me to configure my runtime in a correct way?
Many thanks in advance
I found the solution.
under the project root I create a directory .bp-config
Inside the directory I create a file option.json with the following content:
{
"PHP_EXTENSIONS": ["mysqli","curl"]
}
mysqli for mysql library and curl for the curl library.
So now I am able to use curl library inside my project
Has anyone the link for a complete documentation around this configuration steps ?
Ciao
the complete documentation for your this kind of configuration related to a PHP buildpack could be found here
https://docs.cloudfoundry.org/buildpacks/php/gsg-php-config.html

Unable to connect to Amazon S3 suddenly

I have been using this PHP class to upload images to S3. Here's an example code:
$s3 = new S3($awsAccessKey,$awsSecretKey);
$s3upload= $s3->putObject(
$s3->inputFIle($tmp_name, false),
$s3BucketName,
$filename,
S3::ACL_PUBLIC_READ
);
Out of nowhere I have been getting this error today:
Warning</b>: S3::putObject(): [7] Failed to connect to bucketName.s3.amazonaws.com port 80: No route to host in <b>/S3.php</b> on line <b>355
I have used the following script to check the curl settings, and I can get the whole google page, so there shouldn't be any problem with CURL
$ch = curl_init("http://google.com"); // initialize curl handle
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$data = curl_exec($ch);
print($data);
Anyone using that PHP class? Have you experienced this problem? How can I find out where the problem lays?
This can happen when some api calls get outdated. I would recommend using the official php libraries. They work almost the same way this library works, but they are being kept up-to-date by Amazon programmers.
I would recommend the official PHP library as well, it's well documented and works well.
No route to host might suggest network problems on your server.
Can you ping bucketName.s3.amazonaws.com from the server?

Fatal error: Call to undefined function http_get()

I tried to make cross domain request in php coding using http_get. In my server, there is no required modules installed. I dont know what to install to make posible of doing http_get.
The error which i got was
Fatal error: Call to undefined function http_get() in
C:\xampp\htdocs\article\index.php on line 2
I tried to do so (PECL pecl_http >= 0.1.0)
http_get — Perform GET request
but, i did not find out solution.
So, please help me to run http_get coding. Thanks in advance.
I think that you have to enable extension=php_http.dll in your php.ini file and after that restart your Apache Server.
I advise you to use cURL instead of http_get() (same manipulation, you have to enable extension=php_curl.dll and restart apache)
Hope that Helps :)
To directly answer the question, you've to enable extension=php_http.dll in php.ini and restart apache, but there's absolutely no need to use http_get() in our days.
Here's 3 good alternatives:
The php curl library
file_get_contents()
copy()
Curl usage:
// Get cURL resource
$curl = curl_init();
// Set some options - we are passing in a useragent too here
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => 'http://testcURL.com/?item1=value&item2=value2',
CURLOPT_USERAGENT => 'User Agent X'
));
// Send the request & save response to $resp
$resp = curl_exec($curl);
// Close request to clear up some resources
curl_close($curl);
file_get_content() usage:
$my_var = file_get_contents("https://site/");
copy() usage:
copy("https://site/image.png", "/local/image.png");

PHP curl and Web Proxy...maybe

I have a script which calls an external API using curl. This script worked perfectly when the website was on a dedicated server however I have had to move the server to a load balanced set up which sits behind a proxy and now for some reason I get
PHP Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: Entity: line 1: parser error : Start tag expected, '<' not found in...file name.
In Firebug it comes back as a 500 error if there is a result (formatted XML) otherwise it processes as normal.
I am running Zend CE 5.1.0 with only the default modules installed. Do I need to set something on the proxy or do I need to install additional modules to get this working.
If you need further information let me know.
Cheers
Did you defined your proxy in php?
Something like:
define('HTTP_PROXY_HOST', '192.168.100.100');
define('HTTP_PROXY_PORT', '8080');
if (defined('HTTP_PROXY_HOST') && HTTP_PROXY_HOST != '') {
curl_setopt($ch, CURLOPT_PROXY, HTTP_PROXY_HOST);
}
if (defined('HTTP_PROXY_PORT') && HTTP_PROXY_PORT != '') {
curl_setopt($ch, CURLOPT_PROXYPORT, HTTP_PROXY_PORT);
}

Categories